-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a build.zig that allows building the garbage collector using the Zig build system. It implements a subset of the configuration options offered by CMake and following the naming convention in CMake for all those options. There are two new GitHub Actions workflows: - zig build is essentially a copy of the cmake build workflow - it builds the collector and runs tests - zig xbuild uses zig to cross-compile for different platforms - we don't actually run the tests as that would require emulation The README is slightly updated, not just adding an explanation of zig but restructuring the whole section on how to build the GC somewhat. The build.zig follows the format used in zig v0.12. The final 0.12 version is not out yet, so users will have to use a build from the zig master branch for now. This is not ideal but the whole zig build system is so new that there have been backwards incompatible changes from 0.11 which is why we opt to use 0.12 that is likely going to be closer to the final form.
- Loading branch information
Showing
4 changed files
with
623 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow is for zig-basd build/test running on multiple platforms. | ||
# TODO: move from nightly to zig 0.12 once it is released | ||
name: zig build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.os }} thr:${{ matrix.enable_threads }} rwlock::${{ matrix.enable_rwlock }} redir:${{ matrix.redirect_malloc }} dll:${{ matrix.shared_libs }} cpp::${{ matrix.enable_cplusplus }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
# Deliver the feedback for all matrix combinations. | ||
fail-fast: false | ||
|
||
matrix: | ||
os: [ ubuntu-latest ] | ||
#os: [ macos-latest, ubuntu-latest, windows-latest ] | ||
enable_cplusplus: [ false, true ] | ||
build_type: [ Release ] | ||
gc_assertions: [ true ] | ||
large_config: [ true ] | ||
enable_threads: [ false, true ] | ||
enable_rwlock: [ false, true ] | ||
redirect_malloc: [ false, true ] | ||
shared_libs: [ false, true ] | ||
exclude: | ||
- enable_threads: false | ||
enable_rwlock: true | ||
- os: macos-latest | ||
enable_cplusplus: false | ||
- os: ubuntu-latest | ||
enable_cplusplus: false | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Install zig" | ||
run: | | ||
mkdir zig && cd zig && curl https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.1814+5c0d58b71.tar.xz | tar Jx --strip-components=1 && cd .. | ||
- name: Build | ||
run: > | ||
zig/zig build | ||
-Dbuild_shared_libs=${{ matrix.shared_libs }} | ||
-Dbuild_tests=true | ||
-Denable_cplusplus=${{ matrix.enable_cplusplus }} | ||
-Denable_gc_assertions=${{ matrix.gc_assertions }} | ||
-Denable_large_config=${{ matrix.large_config }} | ||
-Denable_redirect_malloc=${{ matrix.redirect_malloc }} | ||
-Denable_rwlock=${{ matrix.enable_rwlock }} | ||
-Denable_threads=${{ matrix.enable_threads }} | ||
-Denable_werror=true | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This workflow uses Zig and its excellent cross-compilation support to test | ||
# compiling for multiple platforms. No tests are actually run since it would | ||
# require emulation. | ||
# TODO: move from nightly to zig 0.12 once it is released | ||
name: zig cross-compile | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.ttriple }} dll:${{ matrix.shared_libs }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ttriple: [ aarch64-linux-musl, wasm32-wasi, x86_64-linux-gnu.2.27, x86_64-linux-musl, x86_64-windows-gnu ] | ||
shared_libs: [ false, true ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Install zig" | ||
run: | | ||
mkdir zig && cd zig && curl https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.1814+5c0d58b71.tar.xz | tar Jx --strip-components=1 && cd .. | ||
- name: Build | ||
run: > | ||
zig/zig build | ||
-Dtarget=${{ matrix.ttriple }} | ||
-Dbuild_shared_libs=${{ matrix.shared_libs }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.