diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/build_win.sh | 34 | ||||
| -rwxr-xr-x | scripts/fetch_win_deps.sh | 29 | ||||
| -rwxr-xr-x | scripts/run_win.sh | 9 |
3 files changed, 72 insertions, 0 deletions
diff --git a/scripts/build_win.sh b/scripts/build_win.sh new file mode 100755 index 0000000..493e322 --- /dev/null +++ b/scripts/build_win.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e + +# 1. Build native tools (asset_packer) +echo "Building native tools..." +cmake -S . -B build_native -DDEMO_BUILD_TOOLS=OFF -DDEMO_BUILD_TESTS=OFF +cmake --build build_native --target asset_packer + +# 2. Cross-compile for Windows +echo "Cross-compiling for Windows..." +cmake -S . -B build_win \ + -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-MinGW-w64.cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DASSET_PACKER_PATH=$(pwd)/build_native/asset_packer \ + -DDEMO_BUILD_TOOLS=OFF \ + -DDEMO_BUILD_TESTS=OFF + +cmake --build build_win + +# 3. Copy runtime DLLs to build_win so we can run it +cp third_party/windows/lib/wgpu_native.dll build_win/ + +# Copy MinGW DLLs (pthread, etc.) +echo "Copying MinGW DLLs..." +MINGW_BIN=$(dirname $(find /opt/homebrew -name "libwinpthread-1.dll" | grep x86_64 | head -n 1)) +if [ -d "$MINGW_BIN" ]; then + cp "$MINGW_BIN/libwinpthread-1.dll" build_win/ + cp "$MINGW_BIN/libgcc_s_seh-1.dll" build_win/ 2>/dev/null || true + cp "$MINGW_BIN/libstdc++-6.dll" build_win/ 2>/dev/null || true +else + echo "Warning: Could not find MinGW DLLs. You might need them to run the exe." +fi + +echo "Build complete. Output: build_win/demo64k.exe" diff --git a/scripts/fetch_win_deps.sh b/scripts/fetch_win_deps.sh new file mode 100755 index 0000000..a32f047 --- /dev/null +++ b/scripts/fetch_win_deps.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -e +set -x + +# Create directories +mkdir -p third_party/windows/lib +mkdir -p third_party/windows/include/GLFW + +echo "Fetching GLFW 3.4..." +curl -L -o glfw.zip https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.bin.WIN64.zip +unzip -q glfw.zip +cp glfw-3.4.bin.WIN64/lib-mingw-w64/libglfw3.a third_party/windows/lib/ +cp glfw-3.4.bin.WIN64/include/GLFW/* third_party/windows/include/GLFW/ +rm -rf glfw.zip glfw-3.4.bin.WIN64 + +echo "Fetching wgpu-native v0.19.4.1..." +curl -L -o wgpu.zip https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-windows-x86_64-release.zip +unzip -q wgpu.zip -d wgpu_temp +# Copy import library (renaming for MinGW convention, though it can usually read .lib) +cp wgpu_temp/wgpu_native.dll.lib third_party/windows/lib/libwgpu_native.dll.a +# Copy runtime DLL (will be needed next to executable) +cp wgpu_temp/wgpu_native.dll third_party/windows/lib/wgpu_native.dll +# Copy headers +mkdir -p third_party/windows/include/webgpu +cp wgpu_temp/webgpu.h third_party/windows/include/webgpu/ +cp wgpu_temp/wgpu.h third_party/windows/include/webgpu/ +rm -rf wgpu.zip wgpu_temp + +echo "Windows dependencies fetched." diff --git a/scripts/run_win.sh b/scripts/run_win.sh new file mode 100755 index 0000000..853a985 --- /dev/null +++ b/scripts/run_win.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ ! -f build_win/demo64k.exe ]; then + echo "Error: build_win/demo64k.exe not found. Run scripts/build_win.sh first." + exit 1 +fi + +echo "Running with Wine..." +# Wine might output a lot of debug info, but for now we let it flow. +wine build_win/demo64k.exe "$@" |
