diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-26 07:40:45 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-26 07:40:45 +0100 |
| commit | 667212bd5dea1c791cf140c184b31ffc2dce12ac (patch) | |
| tree | ee92283577d83515a9951964c569ddc8e1111df0 /scripts/project_init.sh | |
| parent | f7a34b7401695a4a9137889eb4eb322694f8c5c9 (diff) | |
chore(scripts): document and guard mingw-w64 setup
- check_all.sh: guard Windows cross-compile step with command -v check
instead of failing unconditionally; print install hint when skipped
- project_init.sh: add Linux/WSL setup path alongside existing macOS
path — installs build-essential/cmake/glfw/wgpu-native via apt-get,
prints mingw-w64 install hint if cross-compile toolchain is absent
Diffstat (limited to 'scripts/project_init.sh')
| -rwxr-xr-x | scripts/project_init.sh | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/scripts/project_init.sh b/scripts/project_init.sh index 4ee1c13..953e5e5 100755 --- a/scripts/project_init.sh +++ b/scripts/project_init.sh @@ -32,18 +32,52 @@ else echo "glfw3webgpu already present." fi -# Check for brew dependencies (macOS) +# Platform-specific system dependencies if command -v brew >/dev/null 2>&1; then + # macOS for pkg in wgpu-native glfw; do if ! brew list "$pkg" >/dev/null 2>&1; then - echo "Warning: $pkg not found via brew. Installing..." + echo "Installing $pkg via brew..." brew install "$pkg" else echo "$pkg found (via brew)." fi done +elif command -v apt-get >/dev/null 2>&1; then + # Linux / WSL + echo "Installing Linux build dependencies..." + sudo apt-get update -qq + sudo apt-get install -y \ + build-essential cmake git python3 \ + libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev libxrandr-dev + + if [ ! -f /usr/local/lib/libwgpu_native.so ]; then + echo "wgpu-native not found. Fetching prebuilt release..." + WGPU_VER="v0.19.4.1" + curl -L -o /tmp/wgpu_linux.zip \ + "https://github.com/gfx-rs/wgpu-native/releases/download/${WGPU_VER}/wgpu-linux-x86_64-release.zip" + mkdir -p /tmp/wgpu_tmp + unzip -q /tmp/wgpu_linux.zip -d /tmp/wgpu_tmp + sudo cp /tmp/wgpu_tmp/libwgpu_native.so /usr/local/lib/ + sudo cp /tmp/wgpu_tmp/wgpu.h /tmp/wgpu_tmp/webgpu.h /usr/local/include/ + sudo ldconfig + rm -rf /tmp/wgpu_linux.zip /tmp/wgpu_tmp + echo "wgpu-native installed." + else + echo "wgpu-native found." + fi + + # Windows cross-compilation toolchain (optional) + if ! command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then + echo "" + echo "Note: mingw-w64 not found (needed for Windows cross-compile)." + echo " sudo apt-get install -y mingw-w64 && ./scripts/fetch_win_deps.sh" + else + echo "mingw-w64 found." + fi else - echo "Warning: Homebrew not found. Ensure wgpu-native and glfw are installed manually." + echo "Warning: Neither Homebrew nor apt-get found." + echo "See doc/HOWTO.md for manual installation instructions." fi echo "Done." |
