Skip to content

Commit 85f4042

Browse files
committed
build linux use zig
1 parent eb32629 commit 85f4042

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
include:
1212
- { os: windows-latest, target: windows, platform: win32-x64}
1313
- { os: windows-latest, target: windows, platform: win32-x86, cmake_arch: "-A Win32"}
14-
- { os: ubuntu-latest, target: linux, platform: linux-x64}
14+
- { os: ubuntu-latest, target: linux, platform: linux-x64, zig_build: true}
1515
- { os: macos-latest, target: darwin, platform: darwin-x64}
1616
- { os: macos-latest, target: darwin, platform: darwin-arm64}
1717
steps:
@@ -42,11 +42,20 @@ jobs:
4242
- name: Build-linux
4343
if: startsWith(matrix.os, 'ubuntu')
4444
run: |
45-
mkdir build
46-
cd build
47-
cmake .. -DCMAKE_BUILD_TYPE=Release -DEMMY_CORE_VERSION=${{env.TAG}}
48-
cmake --build . --config Release
49-
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
45+
if [[ "${{ matrix.zig_build }}" == "true" ]]; then
46+
sudo snap install zig --classic --beta
47+
mkdir -p build
48+
# 使用Zig作为工具链编译C++项目
49+
cmake -B build -G Ninja -DCMAKE_C_COMPILER=zig -DCMAKE_C_COMPILER_ARG1=cc -DCMAKE_CXX_COMPILER=zig -DCMAKE_CXX_COMPILER_ARG1=c++ -DCMAKE_BUILD_TYPE=Release -DEMMY_CORE_VERSION=${{env.TAG}}
50+
cmake --build build --config Release
51+
cmake --install build --config Release --prefix ${{ github.workspace }}/artifact/
52+
else
53+
mkdir build
54+
cd build
55+
cmake .. -DCMAKE_BUILD_TYPE=Release -DEMMY_CORE_VERSION=${{env.TAG}}
56+
cmake --build . --config Release
57+
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
58+
fi
5059
- name: Build-macosx
5160
if: startsWith(matrix.os, 'macos')
5261
run: |

0 commit comments

Comments
 (0)