-
Notifications
You must be signed in to change notification settings - Fork 288
Build with zig #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Build with zig #431
Conversation
Add the necessary files to build a static library with Zig. The build also includes producing execuable that can be cross-compiled Signed-off-by: inge4pres <fgualazzi@gmail.com>
Signed-off-by: inge4pres <fgualazzi@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mizux can you have a look as well?
@@ -0,0 +1,12 @@ | |||
.{ | |||
.name = .cpu_features, | |||
.version = "0.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not using the cpu version instead ?
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v5 | ||
- uses: mlugg/setup-zig@v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why specifying the version and a mirror ?
For a CI I would be happy to target the default/last release pointed by the actions than fixing it a lagging behind in few months...
same for mirror not sure it is needed according to the doc in
https://github.com/mlugg/setup-zig/blob/8d6198c65fb0feaa111df26e6b467fea8345e46f/README.md?plain=1#L45-L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would split this in 3 files;
-
zig.yml
following the clang_format.yml Check but for Zig Check
Currently seems we have two CI workflows:
-
amd64_linux_zig.yml
-
aarch64_linux_zig.yml
note:ubuntu-20.04-arm64
are thid party runner maybe using a regular ubuntu-latest+QEMU to cross compile et run should be more robust against the gh runner infra
Maybe to extend to Macos (brew?) and windows too later ?
thus, adding Zig
to BuildSystem and a svg logo (e.g. https://github.com/ziglang/logo/blob/master/zig-mark.svg) and we should be able to generate badges too to update the README.md CI table...
ref: https://github.com/google/cpu_features/blob/main/scripts/generate_badges.d
Reason for this PR
Relates to:
Details
Additional context
The build scripts is derived from what CMake does; it compiles a static library and an executable that links to it for testing.
The Github workflow simply ensure compilation via build.zig succeeds and runs the executable on 4 Linux targets.
Further work
build.zig
could also be extended to include atest
step that runs the c++ tests in thetest
folder.