Add wxWidgets 3.2.6 submodule and wxBase WASM build script

- Add wxWidgets v3.2.6 as git submodule for wxBase utilities
- Create build-wxbase-wasm.sh script to compile wxBase for Emscripten
- Disable WASM-incompatible features: zlib, expat, xlocale, fswatcher
- Successfully builds libwx_baseu-3.2-Emscripten.a (3.1MB)

This provides wxString, wxFile, wxDateTime and other base utilities
needed for the KiCad board data model without GUI dependencies.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-11-27 08:32:40 +01:00
commit d6e946b101
3 changed files with 71 additions and 0 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "kicad"]
path = kicad
url = git@github.com:VV-EE/kicad-source-mirror.git
[submodule "wxwidgets"]
path = wxwidgets
url = https://github.com/wxWidgets/wxWidgets.git

67
scripts/build-wxbase-wasm.sh Executable file
View file

@ -0,0 +1,67 @@
#!/bin/bash
# Build wxBase (non-GUI wxWidgets) for WebAssembly
# This builds only the base utilities needed by KiCad core (wxString, wxFile, etc.)
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
echo "=== Building wxBase for WASM ==="
echo "Project root: $PROJECT_ROOT"
echo "Build dir: $BUILD_DIR"
echo "wxWidgets source: $WX_SOURCE"
# Verify we're in the right place
if [ ! -f "$WX_SOURCE/CMakeLists.txt" ]; then
echo "ERROR: wxWidgets source not found at $WX_SOURCE"
echo "Make sure the wxwidgets submodule is initialized"
exit 1
fi
# Clean if requested (must be before mkdir to properly reset CMake cache)
if [ "$1" = "--clean" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with emcmake
# Disable all GUI and most optional features - we only need wxBase utilities
# Note: zlib/expat "builtin" versions use POSIX file descriptors not available in WASM,
# so we disable them. We'll use Emscripten's ports if compression is needed.
emcmake cmake "$WX_SOURCE" \
-DwxUSE_GUI=OFF \
-DwxBUILD_SHARED=OFF \
-DwxBUILD_SAMPLES=OFF \
-DwxBUILD_TESTS=OFF \
-DwxBUILD_DEMOS=OFF \
-DwxBUILD_BENCHMARKS=OFF \
-DwxUSE_REGEX=OFF \
-DwxUSE_ZLIB=OFF \
-DwxUSE_EXPAT=OFF \
-DwxUSE_LIBJPEG=OFF \
-DwxUSE_LIBPNG=OFF \
-DwxUSE_LIBTIFF=OFF \
-DwxUSE_WEBREQUEST=OFF \
-DwxUSE_SECRETSTORE=OFF \
-DwxUSE_LIBSDL=OFF \
-DwxUSE_LIBMSPACK=OFF \
-DwxUSE_FSWATCHER=OFF \
-DwxUSE_XLOCALE=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
# Build
echo ""
echo "=== Building ==="
emmake make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
echo ""
echo "=== Build complete ==="
ls -lh "$BUILD_DIR"/lib/*.a 2>/dev/null || echo "Libraries built in $BUILD_DIR"

1
wxwidgets Submodule

@ -0,0 +1 @@
Subproject commit 5ff25322553c1870cf20a2e1ba6f20ed50d9fe9a