Commit graph

108 commits

Author SHA1 Message Date
Viktor Vaczi
d2f1a496f5 feat(webgl): Replace legacy GL with modern OpenGL ES 3.0
Major refactoring to remove ALL legacy OpenGL immediate mode calls from
WEBGL_GAL and replace them with WebGL 2.0/OpenGL ES 3.0 compatible code.

Key changes:
- Add MVP matrix uniform support (replaces glMatrixMode/glOrtho/glLoadMatrix)
- Add matrix math helpers (computeOrthoMatrix, multiplyMatrix4x4, etc.)
- Replace glBegin/glEnd/glVertex with vertex manager pattern
- Rewrite DrawCursor to use vertex manager and DrawLine() calls
- Rewrite DrawBitmap to use vertex manager with SHADER_FONT mode
- Replace glEnableClientState with glVertexAttribPointer
- Replace glDrawBuffer with glDrawBuffers (WebGL 2.0 API)
- Add fullscreen_quad.cpp/h for compositor Present()
- Update SHADER class with mat4 uniform support
- Add MultiplyMatrix() to vertex_manager for Transform()
- Remove all legacy GL stubs from wasm_stubs.cpp

Build now completes with FULL_ES3 mode (no LEGACY_GL_EMULATION).
Remaining issue: wxWidgets GL library calls glColor3f internally.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 23:33:49 +01:00
Viktor Vaczi
6c2cf85177 feat(webgl): Fix GL initialization and add GLSL ES shader conversion
Progress on WEBGL_GAL rendering:

- Fix GLImmediateShim initialization by adding GL function dependencies
  (glBegin, glEnd, glVertex2f, etc.) to $GLImmediateShim__deps
- Add COLOR4D(EDA_COLOR_T) constructor stub to wasm_stubs.cpp
- Fix GAL context locking - add LockContext/UnlockContext calls
- Add exception catching to build (-sNO_DISABLE_EXCEPTION_CATCHING)
- Create GLSL ES 1.00 shader converter in generate_shaders.py:
  - Remove #version 120 directive (ES 1.00 default)
  - Add precision highp float/int qualifiers
  - Convert int * float to float literals (2 * x -> 2.0 * x)
- Update build script to clean output files for linker flag changes
- Add console capture to test spec for debugging

Current status:
- WASM builds and loads successfully
- GLImmediateShim initializes correctly
- WEBGL_GAL creates successfully
- Shader compilation fails due to Emscripten LEGACY_GL_EMULATION
  prepending code that conflicts with custom shader precision

Next: Investigate shader compilation with LEGACY_GL_EMULATION or
consider alternative approaches for GL compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 21:59:21 +01:00
Viktor Vaczi
c23bc974be feat(webgl): Wire up WEBGL_GAL test harness with proper canvas setup
- Add wasm_stubs.cpp with WASM-specific stub implementations for
  COLOR4D::BLACK/WHITE, GLU tesselator, PGM_BASE, and other KiCad
  dependencies
- Update Makefile to include KiCad sources (GAL base class, display
  options, HiDPI canvas) and test scenarios
- Fix kiglew.h to define GLEW guard (__glew_h__) preventing conflicts
  with Emscripten's GLEW header
- Update test HTML to create canvas before module load (MODULARIZE
  requires passing canvas in Module config, not preRun)
- Update Playwright tests to find canvas elements correctly
- Add #window-container for wxWidgets GL canvas support

Build produces 8.4MB WASM with full WEBGL_GAL implementation.
Tests pass but rendering still shows dark output (debugging in progress).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 21:32:53 +01:00
Viktor Vaczi
c381fdb85c feat(webgl): Add WEBGL_GAL implementation (compiles, not yet rendering)
Copy and adapt OpenGL GAL to WebGL:
- Copy all OpenGL GAL source files to tests/gal-regression/wasm/webgl/
- Rename classes from OPENGL_* to WEBGL_*
- Add kiglew.h with WebGL2/GLES3 headers and GLEW stubs
- Add webgl_antialiasing.h/cpp adapted for WEBGL_COMPOSITOR
- Add shader generator (generate_shaders.py) for WASM build
- Update Makefile with all KiCad dependencies (C++20, GLM, clipper2, etc.)

Build produces 544KB JS + 4.9MB WASM. Tests run but render blank
(expected - GL context initialization needs WebGL adaptation).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 21:04:42 +01:00
Viktor Vaczi
a4f444fea8 feat(webgl): Add WebGL GAL test infrastructure (Phase 1)
Add complete test infrastructure for WebGL GAL visual regression testing:

- scripts/test-gal-regression.sh: Master script that builds both backends,
  runs tests, and performs two-level comparison (native vs baseline,
  webgl vs native)
- scripts/build-gal-webgl-test.sh: WASM build using Makefile with em++
- tests/gal-regression/wasm/: WebGL test harness (stub WEBGL_GAL)
- tests/e2e/gal-webgl.spec.ts: Playwright test for screenshot capture

Fix Homebrew Emscripten environment in scripts/common/env.sh:
- Set EMSDK_PYTHON for Python 3.10+ (em++ reads this, not $PYTHON)
- Add bundled LLVM to PATH (Emscripten needs its clang with WASM backend)

Verified: Native vs Baseline passes (28/28), WebGL generates blank
screenshots as expected (WEBGL_GAL implementation is Phase 2).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 16:11:31 +01:00
Viktor Vaczi
344cf3c432 docs(gal-test): Add README and document DrawBitmap limitation
- Add comprehensive README documenting all 28 GAL test scenarios
- Document known limitation: DrawBitmap uses legacy OpenGL immediate
  mode (glBegin/glEnd) incompatible with shader-based test harness
- Add shader accessor for DrawBitmap workaround attempt
- Clean up debug code from bitmap scenario

The DrawBitmap limitation is acceptable because:
- It's primarily used for reference images in schematics
- WebGL port will need its own bitmap rendering implementation
- All other 69 GAL methods are fully tested

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 13:37:08 +01:00
Viktor Vaczi
051fb87cab feat(gal-test): Add 100% GAL API test coverage (28 scenarios)
Expand GAL native test harness from 24 to 28 scenarios covering all 70
GAL methods. New scenarios:

- scenario_text_attrs.cpp (24): Text attribute APIs (SetGlyphSize,
  SetFontBold/Italic/Underlined, SetTextMirrored, justification)
- scenario_glyphs.cpp (25): DrawGlyph/DrawGlyphs with stroke glyphs
- scenario_bitmap.cpp (26): DrawBitmap with test patterns
- scenario_transform.cpp (27): Transform() API documentation

Additional API coverage in existing scenarios:
- Flush() in test harness
- SetFlip(), SetRotation() in screen-transform
- SetDepthRange() in depth-testing
- GetGridPoint() in grid-native

New stub files:
- kifont_stub.h: STROKE_GLYPH factory functions for letter glyphs
- bitmap_base_stub.h: Test pattern generators (checkerboard, gradient)

Note: Bitmap scenario shows empty panels - DrawBitmap uses legacy OpenGL
immediate mode (glBegin/glEnd) which doesn't work while shader is active.
This is a known limitation when testing outside KiCad's VIEW rendering flow.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:27:06 +01:00
Viktor Vaczi
650109e10f feat(webgl): Add 4 new GAL test scenarios for expanded coverage
Expand test coverage from ~19% to ~25% of GAL API with modular scenario files:
- bezier-curves: Tests DrawCurve() with S-curves, waves, hearts, and control points
- arc-segments: Tests DrawArcSegment() with thick arc strokes (PCB trace style)
- segment-chain: Tests DrawSegmentChain() with zigzags, spirals, sharp corners
- group-caching: Tests BeginGroup/EndGroup/DrawGroup for cached geometry

Architecture:
- New scenarios in separate files under scenarios/
- Forward declarations in main gal_test_scenarios.cpp
- CMakeLists.txt updated to compile new scenario modules

Also:
- Remove unused build-wxwidgets-native.sh (using system wxWidgets)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:58:52 +01:00
Viktor Vaczi
490f531521 feat(webgl): Add GAL native test harness for visual regression testing
Add a standalone test application that compiles KiCad's actual OPENGL_GAL
against system wxWidgets to generate baseline screenshots for comparing
native OpenGL rendering against WebGL rendering in the browser.

Architecture:
- Compiles 18 KiCad GAL source files from the kicad submodule
- Uses template-based private member accessor (safer than #define private public)
- Generates shader C++ files from GLSL (10 shader pairs for SMAA AA)
- Minimal stubs for KiCad dependencies (PGM_BASE, ADVANCED_CFG, etc.)

Test coverage:
- 11 scenarios testing ~19% of GAL API
- basic-lines, line-widths, circles, arcs, rectangles, polygons
- alpha-blending, transforms, grid-cursor, segments, complex-scene

Key insights documented:
- GAL uses world-to-screen transformation requiring 1:1 pixel mapping
- FBO reading required for clean screenshots on macOS
- Layer depth needed for proper z-ordering in complex scenes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:42:31 +01:00
Viktor Vaczi
5147917ea7 Add feature branch patch management system
Rename docs/ to features/ with per-feature folders. Add script to generate
patches for root repo and submodules.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 16:17:52 +01:00
Viktor Vaczi
c42f660507 Update kicad submodule: preserve CMAKE_MODULE_PATH
Fix build failure where custom Find*.cmake modules in wasm/cmake
were being ignored because KiCad's CMakeLists.txt was overwriting
CMAKE_MODULE_PATH.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 18:00:39 +01:00
Viktor Vaczi
e89a54dcb2 Merge branch 'fix-kicad-tests' 2026-01-05 16:32:14 +01:00
Viktor Vaczi
5d93e11358 Fix indirect call to null error and logging.sh worktree support
wxwidgets submodule:
- Add m_isCreated flag to skip UpdateElementRegistry() during construction
- Prevents virtual method calls on partially constructed objects

scripts/common/logging.sh:
- Change -d to -e for .git check to support git worktrees

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 16:25:11 +01:00
Viktor Vaczi
85e0f2f59a Reduce KiCad fork divergence with CMake cleanup
- Update kicad submodule: reverted 12 Find*.cmake to upstream,
  deleted FindCURL.cmake (-284 lines, -13 files changed)
- Add GLM_VERSION to build-pcbnew.sh (workaround for KiCad
  overwriting CMAKE_MODULE_PATH)
- Update kicad-diff-stats.sh to compare working tree vs upstream

Fork diff reduced from 81 to 68 files.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 14:03:03 +01:00
Viktor Vaczi
25e0531475 Updated CLAUDE.md 2026-01-05 11:18:44 +01:00
Viktor Vaczi
c2a69cf9db Add KiCad fork diff statistics script
- scripts/kicad-diff-stats.sh: Shows how far our KiCad fork has diverged
  from upstream (last non-our commit)
- Outputs: commit count, files changed, lines added/deleted, file list
- Logs to logs/kicad-diff/ with timestamps
- Update CLAUDE.md with script reference

Current status: 5 commits, 81 files, +1536/-395 lines on top of upstream

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 11:16:46 +01:00
Viktor Vaczi
a0a6023400 Fix Docker build caching with checksum-based rsync
Replace timestamp-based rsync + touch with checksum-based sync:
- Use --checksum to only transfer files with actual content changes
- Remove touch mechanism that caused all files to appear "newer"
- Exclude .git, logs, .idea, node_modules from sync

The old approach created a perpetual timestamp mismatch:
1. rsync -a preserved host timestamps
2. touch set container timestamps
3. Next build saw mismatch → transferred everything → touched again

With --checksum mode:
- Changed files: transferred with current time → rebuilt (correct)
- Unchanged files: not transferred → keep timestamp → no rebuild (correct)

Tested scenarios:
- Consecutive builds: ~2 min (cached) vs ~6+ min (was full rebuild)
- Modified wxWidgets file: only that file recompiled
- Modified KiCad file: only that file recompiled

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 10:20:08 +01:00
Viktor Vaczi
ac48f7c57a Added logs .gitignore. 2026-01-03 13:52:34 +01:00
Viktor Vaczi
ea5dc26a96 Restore elementtracker.h and add build logging
- Restore missing elementtracker.h in wxWidgets (required for E2E tests)
- Add automatic log file redirection for build scripts

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 11:55:54 +01:00
Viktor Vaczi
582b282a6c Add missing GLU_TESS_BOUNDARY_ONLY constant for idftools
The idftools/vrml_layer.cpp uses this GLU tessellation constant
which was missing from our WASM GLU stub header.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 11:24:24 +01:00
Viktor Vaczi
2b96d4ba21 Add Quick Start docs and branch-specific Docker builds
- README.md: Add Quick Start section with full build sequence
- docker/README.md: Document branch-specific builds with git worktrees
- docker/build.sh: Use branch name for COMPOSE_PROJECT_NAME
- docker/docker-compose.yml: Remove hardcoded container_name

Each branch now gets isolated Docker containers/volumes, enabling
parallel development across git worktrees.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 09:08:12 +01:00
Viktor Vaczi
38a01cac4d Update wxWidgets: fix ComboBox assertion crash for WASM
Updates wxWidgets submodule with fixes for WASM compatibility:
- wxComboBox::SetSelection now matches GTK behavior (silently ignores invalid indices)
- wxTrap no longer crashes in WASM (EMSCRIPTEN case added)

This fixes the "indirect call to null" crash that occurred when KiCad's
layer combobox called SetSelection during initialization.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 09:05:57 +01:00
Viktor Vaczi
cb58b43bd1 Enable OpenGL GAL and 3D viewer stubs for WASM
Changes:
- Add glu_wasm_impl.cpp: GLU tesselator using KiCad's earcut triangulation
- Add GL/glu.h: GLU header for WASM builds
- Add 3D viewer stubs for KICAD_BUILD_3D_VIEWER_WASM=ON
- Remove obsolete gl_canvas_stub.cpp (OpenGL now uses real impl)
- Remove obsolete glu_stub.c (replaced by glu_wasm_impl.cpp)
- Update build-pcbnew.sh comment about GLU implementation

The OpenGL GAL now works in WASM using WebGL with LEGACY_GL_EMULATION.
3D viewer is stubbed out but builds successfully.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 08:19:40 +01:00
Viktor Vaczi
ca4f7eb40d Add research doc: OpenGL, GAL, and WebGL strategy
Documents:
- Current LEGACY_GL_EMULATION implementation
- GLU tesselator status (solved with earcut)
- Where KiCad uses legacy GL (OPENGL_GAL + 3D Viewer)
- The GAL API abstraction (~40 clean methods)
- Strategy options: keep emulation vs create WEBGL_GAL
- Recommendation for short/medium term approach

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 10:40:03 +01:00
Viktor Vaczi
251056e506 Clean up test infrastructure and fix test assertions
- Replace test.skip() with proper expect() assertions when app fails to load
- Remove button-finder utility (no longer needed with element registry)
- Remove kicad tests (tested separately)
- Add findByName/clickByName helpers for bitmap buttons
- Fix element lookups: use clickByName for bitmap buttons, clickTreeItem
  for treebook pages, selectComboItem for wxChoice items
- Add SetName() to shape buttons in bitmapbuttons_test.cpp
- Remove verbose logging from print and threadpool tests
- Update README to reflect current test infrastructure

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 20:18:19 +01:00
Viktor Vaczi
2ecb79996d Fix KiCad test logs not being saved
Add testLogger fixture parameter to the first test so the logging
fixture lifecycle runs and writes console output to logs/kicad/pcbnew/.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 17:43:43 +01:00
Viktor Vaczi
6c6b4e47ff Fix wxCollapsiblePane crash in element registry
Update wxwidgets submodule with fix that skips GetLabel() for
wxCollapsiblePane widgets during element registry updates to avoid
WASM memory access errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 15:13:53 +01:00
Viktor Vaczi
64142aa8de Extend element registry and migrate all tests to semantic selectors
Phase 2 of element registry migration - eliminate hardcoded coordinates:

Element tracker additions:
- wxTreeCtrl items (clickTreeItem, findTreeItem)
- wxDataViewCtrl items and column headers
- wxPropertyGrid rows
- wxListBox items
- wxSpinButton arrows
- wxSlider thumb/track
- wxTextCtrl area
- wxSearchCtrl field
- wxAuiManager pane content areas
- wxCalendarCtrl dates

Test migrations:
- 24 test files updated to use element registry helpers
- Replaced coordinate-based clicks with semantic selectors
- Added find-hardcoded-coords.sh script for auditing

Remaining coordinates are legitimate (scroll positioning, drawing, test.fail blocks).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 14:17:51 +01:00
Viktor Vaczi
04eebab024 Migrate tests to use rendered element registry for toolbar, menu, layout, and AUI tests
Update tests to use semantic identifiers instead of hardcoded pixel positions:
- toolbar.spec.ts: Use clickToolbarTool('New') instead of click(box.x + 30, box.y + 45)
- menu.spec.ts: Use clickMenuBarItem('File') instead of click(box.x + 30, box.y + 15)
- layout.spec.ts: Use getSplitterSash() to get actual sash position for drag operations
- aui.spec.ts: Use clickAuiButton('close', 'Properties') for panel button clicks

Also extends element-tracker.ts with:
- WxRenderedElement interface for toolbar tools, menu items, sashes, AUI parts
- findRenderedByLabel(), findRenderedByType() query functions
- clickToolbarTool(), clickMenuBarItem(), getSplitterSash(), clickAuiButton() helpers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:06:54 +01:00
Viktor Vaczi
0a093b918e Add element registry for semantic E2E test automation
Replace hardcoded pixel coordinates with semantic element lookups in tests.
The element registry (added to wxWidgets) tracks all wxWindow instances,
enabling tests to find buttons by label text instead of pixel positions.

Changes:
- Add element-tracker.ts with clickByLabel, findByLabel, findByType, etc.
- Migrate clipboard, dialog, timer, filedialog, logerror tests to use registry
- Update fixtures.ts to export element-tracker utilities
- Update README with element registry documentation
- Update wxwidgets submodule with registry implementation

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:11:33 +01:00
Viktor Vaczi
9ccb07ad81 Use Firefox for KiCad headless tests on ARM Mac
Chrome headless crashes on ARM Mac due to a known Chromium bug where
SwiftShader WebGL is disabled on ARM architecture (issues #1416283,
#338414704). Firefox headless works reliably using native Metal.

Changes:
- Use Firefox as default for npm run test:kicad (headless)
- Use Chrome with --headed flag for npm run test:kicad:headed
- Add viewport size and increase timeout for KiCad WASM
- Simplify pcbnew.spec.ts test assertions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 10:51:03 +01:00
Viktor Vaczi
e7d6122a86 Fix wxImage::InitAlpha assertion in WASM bitmap conversion
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 20:43:18 +01:00
Viktor Vaczi
b5d379fe70 Add runtime resource loading and fix Docker incremental builds
- Build images.tar.gz bitmap archive for KiCad icons
- Fetch resources at runtime via HTTP instead of bundling in WASM
- Write to Emscripten virtual FS at compile-time KICAD_DATA path
- Fix rsync timestamp handling for correct make change detection
- Update kicad submodule with WASM settings manager fix

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 20:09:26 +01:00
Viktor Vaczi
c72ca06132 Fix wxImage::InitAlpha assertion in WASM bitmap conversion
- Check HasAlpha() before calling InitAlpha() to avoid assertion failure
- Skip useless test that only checked for no JS exceptions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:54:34 +01:00
Viktor Vaczi
a5fc0c4d3f Fix TypeScript errors in test files
Cast Element to HTMLElement for style property access.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:39:04 +01:00
Viktor Vaczi
eedfe22654 Organize test logs into separate directories by test suite and file
- wxWidgets logs: tests/logs/wxwidgets/<test-file>/
- KiCad logs: tests/logs/kicad/<test-file>/
- Global setup now cleans all log subdirectories recursively
- Added globalSetup to KiCad playwright config

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:35:40 +01:00
Viktor Vaczi
2ad6786198 Improve KiCad test workflow and separate from wxWidgets tests
- npm run test:kicad now auto-runs setup script first
- Create separate playwright-kicad.config.ts for KiCad tests
- Fix kicad spec to use web server instead of file:// paths
- Remove duplicate pcbnew.html/wasm from tests/kicad/
  (proper files are in tests/apps/kicad/)

Test separation:
- npm test: runs only wxWidgets tests (tests/e2e/)
- npm run test:kicad: runs only KiCad tests (tests/kicad/)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:01:35 +01:00
Viktor Vaczi
98b523c2bc Fix clean build issues
- Add autoreconf step for bundled PCRE in wxWidgets build script
  (fixes automake version mismatch between 1.16.1 and 1.16.5)
- Fix apply-finalize.sh to use get-wasm-opt.sh for consistent tool paths
  (tools moved to build-wasm/tools/ in previous commit)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 15:28:20 +01:00
Viktor Vaczi
9cd5965b2c Move tools/ to build-wasm/tools/
Groups cached build tools (binaryen) with other build artifacts.
The build-wasm/ directory is already gitignored via build-*/ pattern.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:08:47 +01:00
Viktor Vaczi
a26b40c063 Reorganize project structure for clarity
- Rename tests/wasm-app/ to tests/apps/ for brevity
- Move lib/gl_immediate_shim.js to wasm/shims/ (consolidates WASM files)
- Delete docs/ directory (outdated Nov 2024 research docs)
- Delete patches/ directory (already applied to fork submodules)
- Delete wasm/patches/ and wasm/config/ (empty/unused)
- Update all file references in scripts, configs, and documentation
- Update .gitignore for new tests/apps/ paths

Verified both build workflows pass:
- wxWidgets tests: 255 passed
- Docker KiCad build: completed successfully

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:06:23 +01:00
Viktor Vaczi
c4cd69f28d Make build scripts use incremental builds by default
- build-wxuniversal-wasm.sh: Default to incremental, add --clean flag
- build-wasm-test.sh: Remove automatic clean, add --clean flag

Performance:
- No changes: ~0.3s (was full rebuild)
- Single file change: ~5s (just that file)
- Clean rebuild: use --clean flag

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:26:25 +01:00
Viktor Vaczi
355115f30d Update documentation to reflect current project structure
- README.md: Complete rewrite with current directory structure and two
  build workflows (KiCad Docker, wxWidgets local)
- build.md: Fix script references (docker/build.sh as entry point),
  remove deleted cmake/ directory, fix test commands

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:13:17 +01:00
Viktor Vaczi
a88652279b Remove unused legacy build scripts and directories
Clean up obsolete files that are not part of the current build workflows:

Deleted:
- cmake/ - Old native build CMake modules
- core/ - Old core extraction from Nov 2024
- stubs/ - Old stubs for native build
- scripts/build.sh - Old native build script
- scripts/build-core-wasm.sh - Old core library build
- scripts/build-wxbase-wasm.sh - Old CMake-based wxBase
- scripts/build-kicad-wasm.sh - Old standalone kicad build
- scripts/build-wxwidgets-wasm-clean.sh - Patch testing script
- scripts/generate-wxwidgets-patches.sh - Patch generation
- scripts/prepare.sh - Old patch apply script
- scripts/update-kicad.sh - Old kicad update script
- CMakeLists.txt - Old native build root
- wxWidgets-wasm-reference submodule - Unused reference clone

Both workflows verified working after cleanup:
1. KiCad: docker/build.sh → tests/scripts/setup-kicad-wasm.sh → npm test
2. wxWidgets: scripts/build-wxuniversal-wasm.sh → scripts/build-wasm-test.sh → npm test

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:07:54 +01:00
Viktor Vaczi
768d33339a Remove .git from meson subprojects to keep IDE clean
Meson clones subprojects (like freetype) as full git repos and creates
.meson-subproject-wrap-hash.txt which shows as untracked. IDEs detect
these nested repos and show dirty status in commit sidebar.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:37:20 +01:00
Viktor Vaczi
23a23fd7a6 Add autom4te wrapper to keep submodules clean
Disable autom4te cache creation during autoconf runs by setting AUTOM4TE
to a wrapper that passes --no-cache. This prevents autom4te.cache directories
from appearing in submodules (pcre, etc.) and making them show as dirty.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:21:31 +01:00
Viktor Vaczi
dafef9c0a1 Fix Docker macOS timestamp issues and improve build reproducibility
- Add rsync-based source sync for Docker builds to fix macOS VirtioFS
  timestamp inconsistencies that caused autoconf sanity checks to fail
- Add config.sub wrapper (SHELL/CONFIG_SHELL) to support emscripten/wasm32
  targets without modifying submodule files
- Fix protobuf build to use native gcc/g++ for protoc instead of Emscripten
- Add python PATH fix for macOS (Homebrew's python3 symlink) in wxWidgets build

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 01:07:44 +01:00
Viktor Vaczi
5b919ef66f Add ccache and incremental build system for faster development
- Add ccache to Docker image for compiled object caching
- Change build defaults: incremental by default, skip deps by default
- Add new flags: --full, --clean-kicad, --build-deps
- Skip wxWidgets configure if already configured (check Makefile timestamps)
- Remove unused source hash stamp functions (make handles dependencies)
- Update build.md with new build system documentation

Performance improvements:
- Single file change: 7:35 → 1:34 (4.8x faster)
- No-change rebuild: 7:35 → 1:31 (5x faster)
- Asyncify post-processing (~1 min) is now the bottleneck

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 20:51:58 +01:00
Viktor Vaczi
9c271996c2 Fix KiCad WASM build and runtime errors
Build improvements:
- Change -O0 to -O1 to fix "local count too large" asyncify error
- Add wasm-emscripten-finalize to host (Docker OOMs on large WASM)
- Use -gseparate-dwarf for smaller main binary with debug info
- Build native protoc for code generation
- Add more functions to asyncify removelist

Runtime fixes:
- Add inject-dyncall-shims.sh to fix "dynCall_* is not defined" in Emscripten 4.x
- Update wxwidgets with browserInfo.name fix

New stubs and bindings:
- Add Embind bindings for JavaScript interop
- Add stubs for scripting, API plugin, PCB frame, navlib

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 16:30:53 +01:00
Viktor Vaczi
898e079ef2 Enable 3D viewer in KiCad WASM build
Build the 3D viewer code for WASM instead of stubbing it out.
This is simpler to maintain than complex header stubs.

Changes:
- Enable KICAD_BUILD_3D_VIEWER_WASM=ON in build script
- Remove -gsource-map to avoid OOM in wasm-emscripten-finalize
- Add OpenGL stubs for fixed-function pipeline (WebGL ES 2.0 only)
- Add GLU stub for gluErrorString
- Add NNG stub for IPC API (sockets don't work in WASM)
- Add PCBnew scripting stub
- Expand curl and libgit2 stubs

The 3D viewer code compiles but won't render at runtime since
OpenGL GAL is disabled and Cairo GAL is used instead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 14:21:29 +01:00
Viktor Vaczi
74a2dc2c0f Use all available cores for wxWidgets build by default
Change JOBS default from 1 to auto-detect using nproc/sysctl.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 15:59:23 +01:00