Skip to content
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

Zig CC cross-compilation support for Windows on Linux host. #128

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

svladykin
Copy link
Contributor

Was able to cross-compile everything on Linux for Windows with Zig. Some minor cleanup was needed.

It would be great to add a CI check for that. Here is the script:

export ZIG=zig-linux-x86_64-0.12.0-dev.1834+f36ac227b
rm -rf build && mkdir build && cd build
curl -o zig.tar.xz "https://ziglang.org/builds/$ZIG.tar.xz"
tar -xf zig.tar.xz
export CC="$(pwd)/$ZIG/zig cc -target x86_64-windows"
cmake -DCMAKE_SYSTEM_NAME=Windows ..
make

Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c729344) 99.81% compared to head (6d2af7e) 99.81%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #128   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          21       21           
  Lines        2195     2195           
  Branches      388      388           
=======================================
  Hits         2191     2191           
  Misses          1        1           
  Partials        3        3           
Files Coverage Δ
condition/sc_cond.c 100.00% <ø> (ø)
ini/sc_ini.c 100.00% <ø> (ø)
logger/sc_log.c 100.00% <ø> (ø)
memory-map/sc_mmap.c 100.00% <ø> (ø)
signal/sc_signal.c 100.00% <ø> (ø)
thread/sc_thread.c 100.00% <ø> (ø)
uri/sc_uri.c 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c729344...6d2af7e. Read the comment docs.

@tezc
Copy link
Owner

tezc commented Dec 21, 2023

To add it to CI, we should setup Linux for Windows first right? If you already know how to do it, you can add a job to windows.yml. Otherwise, let's handle it later.

@svladykin
Copy link
Contributor Author

It actually can be executed on any Linux. Let me try to add it to .ubuntu.yml.

@svladykin
Copy link
Contributor Author

Checked the build log for x64-ubuntu / Zig Windows, it works as expected.

@tezc
Copy link
Owner

tezc commented Dec 21, 2023

thank you

@tezc tezc merged commit 2fa40dd into tezc:master Dec 21, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants