ci: get windows and ubuntu builds working again

This commit is contained in:
Rekai Nyangadzayi Musuka 2024-02-10 15:08:27 -06:00 committed by paoda
parent 66192daf6c
commit f71aaafe41
5 changed files with 47 additions and 16 deletions

View File

@ -4,6 +4,7 @@ on:
push:
paths:
- "**.zig"
- "dl_sdl2.ps1"
branches:
- main
schedule:
@ -15,12 +16,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# os: [ubuntu-latest, windows-latest]
runs-on: ${{matrix.os}}
steps:
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0
version: 0.12.0-dev.2063+804cee3b9
- run: |
git config --global core.autocrlf false
- uses: actions/checkout@v3
with:
submodules: recursive
- name: prepare-linux
if: runner.os == 'Linux'
run: |
@ -29,16 +34,11 @@ jobs:
- name: prepare-windows
if: runner.os == 'Windows'
run: |
vcpkg integrate install
vcpkg install sdl2:x64-windows
git config --global core.autocrlf false
.\dl_sdl2.ps1
- name: prepare-macos
if: runner.os == 'macOS'
run: |
brew install sdl2
- uses: actions/checkout@v3
with:
submodules: recursive
- name: build
run: zig build -Doptimize=ReleaseSafe -Dcpu=baseline
- name: prepare-executable
@ -57,6 +57,5 @@ jobs:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0-dev.3395+1e7dcaa3a
- run: zig fmt src/**/*.zig
version: 0.12.0-dev.2063+804cee3b9
- run: zig fmt --check {src,lib}/**/*.zig build.zig build.zig.zon

2
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "lib/SDL.zig"]
path = lib/SDL.zig
url = https://github.com/MasterQ32/SDL.zig
url = https://github.com/paoda/SDL.zig
[submodule "lib/zgui"]
path = lib/zgui
url = https://git.musuka.dev/paoda/zgui

View File

@ -39,14 +39,14 @@ pub fn build(b: *std.Build) void {
// https://github.com/MasterQ32/SDL.zig
const sdk = Sdk.init(b, null);
sdk.link(exe, .static);
sdk.link(exe, .dynamic);
exe.root_module.addImport("sdl2", sdk.getNativeModule());
// https://git.musuka.dev/paoda/zgui
// .shared option should stay in sync with SDL.zig call above where true == .dynamic, and false == .static
const zgui_pkg = zgui.package(b, target, optimize, .{ .options = .{ .backend = .sdl2_opengl3 } });
zgui_pkg.link(exe);
sdk.link(zgui_pkg.zgui_c_cpp, .static);
sdk.link(zgui_pkg.zgui_c_cpp, .dynamic);
b.installArtifact(exe);

View File

@ -30,8 +30,8 @@
.hash = "12207da7e1f5d6180666db9575f84373055b230cb4259a4b6310562293338dc10b9d",
},
.@"zba-gdbstub" = .{
.url = "https://git.musuka.dev/paoda/zba-gdbstub/archive/8c3a166a5daa453c3627dda42bc169c20a470c68.tar.gz",
.hash = "12201dd0f0ae0c9efc8928aedd6970738f146675b2b9cbe8190177e37d1d849a6b6d",
.url = "https://git.musuka.dev/paoda/zba-gdbstub/archive/8d2c76e410357166f092008ff5c7f7f097a043a7.tar.gz",
.hash = "1220a171c7e14769386e3f4aab6aed53b5e176d654bdf1428a15b972effed750bf30",
},
.tomlz = .{
.url = "https://github.com/paoda/tomlz/archive/f0aebccc31d48a131e57108cb05c8acfe4991eb8.tar.gz",

32
dl_sdl2.ps1 Normal file
View File

@ -0,0 +1,32 @@
$SDL2Version = "2.30.0"
$ArchiveFile = ".\SDL2-devel-mingw.zip"
$Json = @"
{
"x86_64-windows-gnu": {
"include": ".build_config\\SDL2\\include",
"libs": ".build_config\\SDL2\\lib",
"bin": ".build_config\\SDL2\\bin"
}
}
"@
New-Item -Force -ItemType Directory -Path .\.build_config
Set-Location -Path .build_config -PassThru
if (!(Test-Path -PathType Leaf $ArchiveFile)) {
Invoke-WebRequest "https://github.com/libsdl-org/SDL/releases/download/release-$SDL2Version/SDL2-devel-$SDL2Version-mingw.zip" -OutFile $ArchiveFile
}
Expand-Archive $ArchiveFile
if (Test-Path -PathType Leaf .\SDL2) {
Remove-Item -Recurse .\SDL2
}
New-Item -Force -ItemType Directory -Path .\SDL2
Get-ChildItem -Path ".\SDL2-devel-mingw\SDL2-$SDL2Version\x86_64-w64-mingw32" | Move-Item -Destination .\SDL2
New-Item -Force .\sdl.json -Value $Json
Remove-Item -Recurse .\SDL2-devel-mingw
Set-Location -Path .. -PassThru