Add Windows cross-build and Gitea release; share CI setup
- just windows-deps / windows / package-windows: cross-compile with Odin objects + lld-link against an xwin SDK, static VC runtime - Release workflow runs on v* tags, builds Linux and Windows packages, uploads them to the package registry and creates a Gitea release - Shared toolchain setup as a local composite action Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9ee2eabe9a
commit
e893c45d4f
6 files changed
+165
-66
No files matched your search
@@ -1,5 +1,13 @@
|
||||
name := "HanjaKanaMun"
|
||||
build_dir := "build"
|
||||
odin_version := "dev-2026-09"
|
||||
xwin_version := "0.10.0"
|
||||
|
||||
# Windows cross-compilation inputs (see `windows-deps`)
|
||||
xwin := env("XWIN", build_dir / "xwin")
|
||||
xwin_sdk := env("XWIN_SDK", build_dir / "xwin-sdk")
|
||||
raylib_windows := env("RAYLIB_WINDOWS", build_dir / "raylib-windows")
|
||||
lld_link := env("LLD_LINK", "lld-link")
|
||||
|
||||
# List available recipes
|
||||
default:
|
||||
@@ -22,17 +30,65 @@ test:
|
||||
mkdir -p {{build_dir}}
|
||||
odin test tests -vet -define:ODIN_TEST_THREADS=1 -out:{{build_dir}}/tests
|
||||
|
||||
# Optimized build into build/, with the assets it needs at runtime
|
||||
# Optimized native build into build/<os>/, with the assets it needs at runtime
|
||||
release:
|
||||
mkdir -p {{build_dir}}/{{name}}
|
||||
odin build . -vet -o:speed -out:{{build_dir}}/{{name}}/{{name}}
|
||||
cp -R assets {{build_dir}}/{{name}}/
|
||||
mkdir -p {{build_dir}}/{{os()}}/{{name}}
|
||||
odin build . -vet -o:speed -out:{{build_dir}}/{{os()}}/{{name}}/{{name}}
|
||||
cp -R assets {{build_dir}}/{{os()}}/{{name}}/
|
||||
|
||||
# Release build packed as build/<name>_<version>_<os>_<arch>.tar.gz
|
||||
# Native release build packed as build/<name>_<version>_<os>_<arch>.tar.gz
|
||||
package version="dev": release
|
||||
tar -czf {{build_dir}}/{{name}}_{{version}}_{{os()}}_{{arch()}}.tar.gz -C {{build_dir}} {{name}}
|
||||
tar -czf {{build_dir}}/{{name}}_{{version}}_{{os()}}_{{arch()}}.tar.gz -C {{build_dir}}/{{os()}} {{name}}
|
||||
@echo "{{build_dir}}/{{name}}_{{version}}_{{os()}}_{{arch()}}.tar.gz"
|
||||
|
||||
# Download the Windows SDK + CRT (via xwin, accepting Microsoft's license) and raylib.lib. Linux x86_64 only.
|
||||
windows-deps:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
mkdir -p {{build_dir}}
|
||||
if [ ! -x "{{xwin}}" ]; then
|
||||
curl -fsSL https://github.com/Jake-Shadle/xwin/releases/download/{{xwin_version}}/xwin-{{xwin_version}}-x86_64-unknown-linux-musl.tar.gz \
|
||||
| tar -xz -C {{build_dir}} --strip-components=1 xwin-{{xwin_version}}-x86_64-unknown-linux-musl/xwin
|
||||
fi
|
||||
if [ ! -d "{{xwin_sdk}}/crt" ]; then
|
||||
"{{xwin}}" --accept-license --arch x86_64 --cache-dir {{build_dir}}/xwin-cache splat --output "{{xwin_sdk}}"
|
||||
fi
|
||||
# Odin's Linux/macOS releases don't ship raylib's Windows library, so take it from the Windows release
|
||||
if [ ! -f "{{raylib_windows}}/raylib.lib" ]; then
|
||||
mkdir -p "{{raylib_windows}}"
|
||||
curl -fsSL -o {{build_dir}}/odin-windows.zip \
|
||||
https://github.com/odin-lang/Odin/releases/download/{{odin_version}}/odin-windows-amd64-{{odin_version}}.zip
|
||||
unzip -o -j {{build_dir}}/odin-windows.zip 'dist/vendor/raylib/windows/raylib.lib' -d "{{raylib_windows}}"
|
||||
fi
|
||||
|
||||
# Cross-compile a Windows x86_64 build into build/windows/ (run `just windows-deps` first)
|
||||
windows:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
obj_dir={{build_dir}}/obj-windows
|
||||
out_dir={{build_dir}}/windows/{{name}}
|
||||
mkdir -p "$obj_dir" "$out_dir"
|
||||
rm -f "$obj_dir"/*.obj
|
||||
odin build . -vet -o:speed -target:windows_amd64 -build-mode:obj -out:"$obj_dir/{{name}}.obj"
|
||||
# Odin can't link for Windows from other platforms, so link with lld-link.
|
||||
# The VC runtime is linked statically (no VCRUNTIME140.dll needed); the
|
||||
# Universal CRT is used from Windows itself (built into Windows 10+).
|
||||
{{lld_link}} /nologo /machine:x64 /subsystem:windows /entry:mainCRTStartup \
|
||||
/out:"$out_dir/{{name}}.exe" "$obj_dir"/*.obj "{{raylib_windows}}/raylib.lib" \
|
||||
/libpath:"{{xwin_sdk}}/crt/lib/x86_64" \
|
||||
/libpath:"{{xwin_sdk}}/sdk/lib/um/x86_64" \
|
||||
/libpath:"{{xwin_sdk}}/sdk/lib/ucrt/x86_64" \
|
||||
/nodefaultlib:msvcrt /nodefaultlib:vcruntime /nodefaultlib:libucrt \
|
||||
libcmt.lib libvcruntime.lib ucrt.lib \
|
||||
kernel32.lib user32.lib gdi32.lib winmm.lib shell32.lib opengl32.lib \
|
||||
advapi32.lib bcrypt.lib ntdll.lib synchronization.lib
|
||||
cp -R assets "$out_dir/"
|
||||
|
||||
# Windows build packed as build/<name>_<version>_windows_x86_64.zip
|
||||
package-windows version="dev": windows
|
||||
cd {{build_dir}}/windows && zip -qr ../{{name}}_{{version}}_windows_x86_64.zip {{name}}
|
||||
@echo "{{build_dir}}/{{name}}_{{version}}_windows_x86_64.zip"
|
||||
|
||||
# Format all Odin files with odinfmt (settings in odinfmt.json)
|
||||
fmt:
|
||||
odinfmt -w .
|
||||
|
||||
Reference in new issue
Block a user