Skip to content

Commit b437b30

Browse files
committed
Add build-linux-cross to CI
1 parent cf2270e commit b437b30

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build on Linux using cross-compiler
2+
on:
3+
workflow_dispatch:
4+
workflow_call:
5+
6+
jobs:
7+
ubuntu-22-riscv64-vulkan-cross:
8+
runs-on: ubuntu-22.04
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Setup Riscv
16+
run: |
17+
sudo dpkg --add-architecture riscv64
18+
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' \
19+
/etc/apt/sources.list /etc/apt/apt-mirrors.txt
20+
sudo apt-get clean
21+
sudo apt-get update
22+
sudo apt-get install -y --no-install-recommends \
23+
build-essential \
24+
crossbuild-essential-riscv64 \
25+
libvulkan-dev:riscv64
26+
27+
- name: Setup Vulkan SDK
28+
run: |
29+
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
30+
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list \
31+
https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
32+
sudo apt-get update -y
33+
sudo apt-get install -y vulkan-sdk
34+
35+
- name: Build
36+
run: |
37+
cmake -B build -DCMAKE_BUILD_TYPE=Release \
38+
-DGGML_VULKAN=ON \
39+
-DGGML_OPENMP=OFF \
40+
-DLLAMA_BUILD_EXAMPLES=ON \
41+
-DLLAMA_BUILD_TESTS=OFF \
42+
-DCMAKE_SYSTEM_NAME=Linux \
43+
-DCMAKE_SYSTEM_PROCESSOR=riscv64 \
44+
-DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc \
45+
-DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++ \
46+
-DCMAKE_C_FLAGS_INIT='-fPIC' \
47+
-DCMAKE_CXX_FLAGS_INIT='-fPIC' \
48+
-DCMAKE_FIND_ROOT_PATH=/usr/lib/riscv64-linux-gnu \
49+
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
50+
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
51+
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH
52+
53+
cmake --build build --config Release -j $(nproc)

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
push:
1111
branches:
1212
- master
13-
paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
13+
paths: ['.github/workflows/build.yml', '.github/workflows/build-linux-cross.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
1414
pull_request:
1515
types: [opened, synchronize, reopened]
1616
paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m', '**/*.metal', '**/*.comp']
@@ -606,6 +606,9 @@ jobs:
606606
-DGGML_SYCL_F16=ON
607607
cmake --build build --config Release -j $(nproc)
608608
609+
build-linux-cross:
610+
uses: ./.github/workflows/build-linux-cross.yml
611+
609612
macOS-latest-cmake-ios:
610613
runs-on: macos-latest
611614

0 commit comments

Comments
 (0)