2025-11-26 10:46:44 +01:00
|
|
|
# KiCad WebAssembly Port
|
|
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
Run KiCad PCBnew in the browser using WebAssembly.
|
2025-11-26 10:46:44 +01:00
|
|
|
|
|
|
|
|
## Project Structure
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
kicad-wasm/
|
2025-12-27 11:13:17 +01:00
|
|
|
├── kicad/ # KiCad source (git submodule)
|
|
|
|
|
├── wxwidgets/ # wxWidgets source (git submodule)
|
|
|
|
|
├── wasm/ # WASM compatibility layer
|
|
|
|
|
│ ├── kiplatform/ # Platform abstraction (app, UI, printing)
|
|
|
|
|
│ ├── libcontext/ # Coroutine/fiber implementation
|
|
|
|
|
│ ├── stubs/ # Stub implementations (libgit2, curl)
|
|
|
|
|
│ └── config/ # Build configuration headers
|
|
|
|
|
├── patches/ # KiCad source patches
|
|
|
|
|
├── scripts/ # Build scripts
|
|
|
|
|
│ ├── build-wxuniversal-wasm.sh # Build wxWidgets for WASM
|
|
|
|
|
│ ├── build-wasm-test.sh # Build wxWidgets test apps
|
|
|
|
|
│ ├── deps/ # Dependency build scripts
|
|
|
|
|
│ ├── kicad/ # KiCad build scripts
|
|
|
|
|
│ ├── common/ # Shared utilities and config
|
|
|
|
|
│ └── config/ # Build configuration
|
|
|
|
|
├── docker/ # Docker build environment
|
|
|
|
|
├── tests/ # Playwright E2E tests
|
|
|
|
|
├── output/ # Build output (pcbnew.js, pcbnew.wasm)
|
|
|
|
|
└── docs/ # Research documentation
|
2025-11-26 10:46:44 +01:00
|
|
|
```
|
|
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
## Two Build Workflows
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
### 1. KiCad Build (Docker)
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
Full KiCad PCBnew build using Docker:
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
```bash
|
|
|
|
|
# Build KiCad WASM
|
|
|
|
|
./docker/build.sh
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Copy output to test directory
|
|
|
|
|
./tests/scripts/setup-kicad-wasm.sh
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Run KiCad tests
|
|
|
|
|
cd tests && npm install && npm run test:kicad
|
|
|
|
|
```
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
Output: `output/pcbnew.js`, `output/pcbnew.wasm`
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
See [build.md](build.md) for detailed build documentation.
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
### 2. wxWidgets Test Apps (Local)
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
Build standalone wxWidgets test apps for feature testing:
|
2025-11-26 16:33:48 +01:00
|
|
|
|
|
|
|
|
```bash
|
2025-12-27 11:13:17 +01:00
|
|
|
# Build wxWidgets for WASM
|
|
|
|
|
./scripts/build-wxuniversal-wasm.sh
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Build test apps
|
|
|
|
|
./scripts/build-wasm-test.sh
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Run wxWidgets tests
|
|
|
|
|
cd tests && npm install && npm test
|
2025-11-26 16:33:48 +01:00
|
|
|
```
|
|
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
Output: `tests/wasm-app/standalone/`
|
2025-11-26 10:46:44 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
## Prerequisites
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
### For KiCad Build (Docker)
|
|
|
|
|
- Docker Desktop with 16GB+ RAM allocated
|
|
|
|
|
- 10+ GB disk space for build cache
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
### For wxWidgets Build (Local)
|
|
|
|
|
- Emscripten SDK 4.0+
|
|
|
|
|
- Node.js 18+ (for tests)
|
2025-11-26 16:33:48 +01:00
|
|
|
|
|
|
|
|
```bash
|
2025-12-27 11:13:17 +01:00
|
|
|
# macOS
|
|
|
|
|
brew install emscripten node
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Initialize submodules
|
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
```
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
## Testing
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
```bash
|
|
|
|
|
cd tests
|
|
|
|
|
npm install
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Run all tests
|
|
|
|
|
npm test
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
# Run specific tests
|
|
|
|
|
npm run test:kicad # KiCad tests only
|
|
|
|
|
npx playwright test menu # Menu tests only
|
2025-11-26 16:33:48 +01:00
|
|
|
```
|
|
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
See [tests/README.md](tests/README.md) for test documentation.
|
|
|
|
|
|
2025-11-26 16:33:48 +01:00
|
|
|
## Current Status
|
|
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
- **wxWidgets WASM**: Core widgets working (menus, dialogs, grids, trees, OpenGL)
|
|
|
|
|
- **KiCad PCBnew**: Builds and loads in browser, canvas rendering working
|
|
|
|
|
- **In Progress**: Testing wxWidgets features used by KiCad
|
|
|
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
|
|
|
|
|
- [Build System](build.md) - Docker build details
|
|
|
|
|
- [Docker README](docker/README.md) - Container setup
|
|
|
|
|
- [Tests README](tests/README.md) - Test infrastructure
|
|
|
|
|
- [Research Docs](docs/) - Original research notes
|
2025-11-26 16:33:48 +01:00
|
|
|
|
2025-11-26 10:46:44 +01:00
|
|
|
## License
|
|
|
|
|
|
2025-12-27 11:13:17 +01:00
|
|
|
KiCad is GPL-3.0. This project follows the same license.
|