#!/bin/sh # Build the alkane-toolkit GUI for Windows (x86_64) on Linux by cross-compiling # with mingw-w64 against the vendored wxWidgets 3.3.3 (wxMSW), the same way CI # builds the release .exe. The result is one self-contained executable: the C++ # runtime is linked statically and it imports only DLLs Windows itself ships. # # Usage: scripts/build-gui-windows.sh [cargo build args...] # defaults to `--release`; e.g. `scripts/build-gui-windows.sh` or # `scripts/build-gui-windows.sh --profile dev`. # Needs: mingw-w64 (posix-threads variant), the rustup target # x86_64-pc-windows-gnu, and the wxMSW prefix from build-wx-windows.sh # (built on first use). set -e REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) cd "$REPO" . "$REPO/scripts/windows-cross-env.sh" if [ ! -x "$WX_RS_WXCONFIG" ]; then sh "$REPO/scripts/build-wx-windows.sh" fi rustup target list --installed 2>/dev/null | grep -qx "$ALKANE_WIN_TARGET" || rustup target add "$ALKANE_WIN_TARGET" [ "$#" -gt 0 ] || set -- --release cargo build --offline --target "$ALKANE_WIN_TARGET" -p alkane-gui "$@" TDIR=$(cargo metadata --no-deps --format-version 1 --offline 2>/dev/null \ | tr ',' '\n' | grep -o '"target_directory":"[^"]*"' | head -1 | cut -d'"' -f4) echo "binary: ${TDIR:-$REPO/target}/$ALKANE_WIN_TARGET//alkane-toolkit.exe"