Skip to content

Commit

Permalink
msvc target
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane committed Apr 22, 2024
1 parent df1a787 commit a97781a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/zig-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ jobs:

matrix:
# TODO: move from nightly to zig 0.12 final when released.
zig_version: [ "0.12.0-dev.3666+a2b834e8c" ]
os: [ macos-latest, ubuntu-latest ]
zig_version: [ "master" ]
# os: [ macos-latest, ubuntu-latest, windows-latest ]
os: [ windows-latest ]
gc_assertions: [ true ]
large_config: [ false ]
enable_threads: [ false, true ]
Expand Down Expand Up @@ -79,17 +80,30 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: "Install zig on Linux/x86_64"
if: runner.os == 'Linux'
run: |
mkdir zig && curl https://ziglang.org/builds/zig-linux-x86_64-${{matrix.zig_version}}.tar.xz | tar Jx --directory=zig --strip-components=1
- name: "Install zig on MacOS/x86_64"
if: runner.os == 'macOS'
run: |
mkdir zig && curl https://ziglang.org/builds/zig-macos-x86_64-${{matrix.zig_version}}.tar.xz | tar Jx --directory=zig --strip-components=1
- uses: korandoru/setup-zig@v1
with:
zig-version: ${{ matrix.zig_version }}
- name: Build
run: >
zig/zig build
zig build
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-Ddisable_handle_fork=${{ matrix.disable_handle_fork }}
-Denable_gc_assertions=${{ matrix.gc_assertions }}
-Denable_gc_debug=${{ matrix.enable_gc_debug }}
-Denable_large_config=${{ matrix.large_config }}
-Denable_munmap=${{ matrix.enable_munmap }}
-Denable_parallel_mark=${{ matrix.parallel_mark }}
-Denable_redirect_malloc=${{ matrix.redirect_malloc }}
-Denable_rwlock=${{ matrix.enable_rwlock }}
-Denable_thread_local_alloc=${{ matrix.thread_local_alloc }}
-Denable_threads=${{ matrix.enable_threads }}
-Denable_werror
test
- name: "MSVC target"
if: runner.os == 'Windows'
run: >
zig build -Dtarget=native-native-msvc
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-Ddisable_handle_fork=${{ matrix.disable_handle_fork }}
-Denable_gc_assertions=${{ matrix.gc_assertions }}
Expand Down
5 changes: 4 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ pub fn build(b: *std.Build) void {
// -U GC_MISSING_EXECINFO_H
// -U GC_NO_SIGSETJMP
flags.append("-D HAVE_SYS_TYPES_H") catch unreachable;
flags.append("-D HAVE_UNISTD_H") catch unreachable;
if (lib.rootModuleTarget().abi != .msvc)
flags.append("-D HAVE_UNISTD_H") catch unreachable
else
flags.append("-D _CRT_SECURE_NO_WARNINGS") catch unreachable;

const have_getcontext = !t.abi.isMusl();
if (!have_getcontext) {
Expand Down

0 comments on commit a97781a

Please sign in to comment.