Files
alkane-toolkit/scripts/windows-cross-env.sh
T
noahandClaude Opus 5.5 3f5e9917f2 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>
2026-11-02 18:32:44 -06:00

39 lines
1.7 KiB
Bash
Executable File

# shellcheck shell=sh
# Toolchain environment for cross-building the toolkit for Windows
# (x86_64-pc-windows-gnu) on Linux. One definition, used by
# scripts/build-gui-windows.sh locally and by the CI Windows job:
#
# . scripts/windows-cross-env.sh # export into this shell
# sh scripts/windows-cross-env.sh --github-env # append to $GITHUB_ENV
#
# WX_WINDOWS_PREFIX selects the wxMSW prefix built by build-wx-windows.sh.
# `cargo test --target x86_64-pc-windows-gnu` runs the test .exe files through
# scripts/wine-run.sh, so the Windows build is unit-tested on every Linux host.
# The posix-threads mingw variants are required: libstdc++'s std::thread and
# the wx build both use them, and mixing in the win32-thread variant at link
# time fails on missing pthread symbols.
WX_WINDOWS_PREFIX="${WX_WINDOWS_PREFIX:-$HOME/.cache/wx-3.3.3-mingw}"
ALKANE_WIN_TARGET=x86_64-pc-windows-gnu
# Sourced scripts cannot rely on $0, so locate the checkout through git.
ALKANE_REPO="${ALKANE_REPO:-$(git rev-parse --show-toplevel)}"
_alkane_win_env() {
cat <<EOF
WX_WINDOWS_PREFIX=$WX_WINDOWS_PREFIX
WX_RS_WXCONFIG=$WX_WINDOWS_PREFIX/bin/wx-config
ALKANE_WIN_TARGET=$ALKANE_WIN_TARGET
CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc-posix
CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++-posix
AR_x86_64_pc_windows_gnu=x86_64-w64-mingw32-ar
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc-posix
WINDRES=x86_64-w64-mingw32-windres
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER=$ALKANE_REPO/scripts/wine-run.sh
EOF
}
if [ "${1:-}" = "--github-env" ]; then
_alkane_win_env >> "${GITHUB_ENV:?GITHUB_ENV is required}"
else
eval "$(_alkane_win_env | sed 's/^/export /')"
fi