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

Add Windows Zig example programs build #6

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/zig-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Zig C++ Windows AMD64
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: windows-latest
env:
CC: zig cc -target riscv64-linux-musl
CXX: zig c++ -target riscv64-linux-musl

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
choco install ninja
git submodule update --init --recursive --depth=1
# Install Zig
curl -L https://ziglang.org/builds/zig-windows-x86_64-0.14.0-dev.2441+3670910f2.zip -o zig.zip
7z.exe x -y zig.zip
shell: bash

- name: Build all examples
working-directory: ${{github.workspace}}
run: |
export PATH=$PWD/zig-windows-x86_64-0.14.0-dev.2441+3670910f2:$PATH
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSTRIPPED=ON -DCMAKE_TOOLCHAIN_FILE=cmake/zig-toolchain.cmake
cmake --build build --parallel 8
shell: bash
6 changes: 6 additions & 0 deletions cmake/zig-toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(CMAKE_C_COMPILER "zig" cc -target riscv64-linux-musl)
set(CMAKE_CXX_COMPILER "zig" c++ -target riscv64-linux-musl)

if (CMAKE_HOST_WIN32)
# Windows: Disable .d files
set(CMAKE_C_LINKER_DEPFILE_SUPPORTED FALSE)
set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED FALSE)
endif()
4 changes: 4 additions & 0 deletions programs/asm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project(asmjit)

option(ZLIB_BUILD_EXAMPLES "" OFF)


include(FetchContent)
FetchContent_Declare(
zlib
Expand All @@ -11,6 +12,9 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(zlib)

# Disable shared zlib from ALL
set_target_properties(zlib PROPERTIES EXCLUDE_FROM_ALL TRUE)

# Add the RISC-V asmjit static library
add_library(riscv_asmjit STATIC IMPORTED)
if (ZIG_COMPILER)
Expand Down
Loading