Port the toolkit GUI to Windows (wxMSW, cross-built with mingw-w64)

Build: the wx-rs build script chose the platform with cfg!(), which in a
build script describes the build host, so a Linux-to-Windows build took the
GTK path. It now reads CARGO_CFG_TARGET_*, and Windows/GNU builds through
wx-config exactly like GTK, against a static wxMSW from
scripts/build-wx-windows.sh. The C++ runtime is linked statically, so the
.exe imports only Windows system DLLs. crates/alkane-gui/build.rs embeds an
application manifest (Common Controls v6, per-monitor DPI v2, UTF-8 code
page, Windows 10/11), the icon and version info.

Bridge on wxMSW (patches 0007/0008):
- the upstream frame's invisible "OSX key events" child sat above the UI on
  MSW and swallowed every click and key; it is no longer created there
- light/dark is chosen before the first window (wxMSW ignores it later) and
  follows the Windows app mode, with dark grid rules for the data view
- the generic wxDataViewCtrl gets mouse input in its inner main window, so
  drag-select and the per-cell / per-icon tooltips bind there (GTK keeps
  its native GtkTreeView paths; the icon hit-test is shared)
- sizes cross the Rust/C++ boundary in DIPs (identity on GTK), so columns,
  icons, KPI cards and the status bar scale at 125-200 %
- vector shapes go through GDI+ (anti-aliased like Cairo on GTK); selected
  rows use the themed list-view text colour like the native renderer
- the frame never opens larger than the monitor work area; title-bar icon
  from the executable; upstream menu insert no longer reads UTF-8 as UTF-16

App: OS differences live in alkane_core::platform (settings in
%APPDATA%\alkane-toolkit, owner-only secret files, NUL, console-less helper
processes). SSH password logins use SSH_ASKPASS with the toolkit itself as
the helper on every platform, replacing sshpass, which Windows lacks.
Release builds are GUI-subsystem; headless modes attach to the parent
console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 18:32:44 -06:00
co-authored by Claude Opus 5.5
parent 569ef9dcd8
commit be5edfc2bf
31 changed files with 2271 additions and 267 deletions
+22 -18
View File
@@ -1,22 +1,26 @@
#!/bin/sh
# Build the alkane-toolkit GUI for Windows (x86_64) from Linux, via mingw-w64.
# wx-rs upstream supports MSW (it downloads and builds wx 3.2.2.1 with MSVC
# via nmake, or links an msys2 mingw64 wx). Two supported routes:
# 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.
#
# A) On Windows: install msys2/mingw64 wx + rust-gnu, run `cargo build
# --release -p alkane-gui` there (wx-rs build.rs handles msys2 paths).
# B) Cross from Linux: not automated yet - wxMSW needs the MSVC or msys2
# toolchain; tracked as follow-up. The Rust side cross-compiles fine;
# only the C++ bridge + wx need the Windows toolchain.
#
# This script documents route A and fails here if run on Linux.
# 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
if [ "$(uname -s)" = "Linux" ]; then
echo "Route B (Linux cross to MSW) is not automated yet."
echo "Run scripts/build-gui-windows.sh on Windows (msys2 mingw64 + rust),"
echo "or use CI with a Windows runner."
exit 1
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
cd "$(dirname -- "$0")/.."
cargo build --release -p alkane-gui
echo "binary: target/release/alkane-toolkit.exe"
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/<profile>/alkane-toolkit.exe"