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>
This commit is contained in:
parent
a88652279b
commit
355115f30d
2 changed files with 84 additions and 121 deletions
196
README.md
196
README.md
|
|
@ -1,157 +1,117 @@
|
||||||
# KiCad WebAssembly Port
|
# KiCad WebAssembly Port
|
||||||
|
|
||||||
Experimental project to run KiCad's core logic in WebAssembly.
|
Run KiCad PCBnew in the browser using WebAssembly.
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
kicad-wasm/
|
kicad-wasm/
|
||||||
├── kicad/ # KiCad source (git submodule)
|
├── kicad/ # KiCad source (git submodule)
|
||||||
├── patches/ # Patches for KiCad source
|
├── wxwidgets/ # wxWidgets source (git submodule)
|
||||||
│ └── 0001-wasm-optional-deps.patch
|
├── wasm/ # WASM compatibility layer
|
||||||
├── stubs/ # Stub implementations for disabled deps
|
│ ├── kiplatform/ # Platform abstraction (app, UI, printing)
|
||||||
│ ├── include/ # Stub headers
|
│ ├── libcontext/ # Coroutine/fiber implementation
|
||||||
│ │ ├── curl/ # CURL stub headers
|
│ ├── stubs/ # Stub implementations (libgit2, curl)
|
||||||
│ │ ├── git2.h # libgit2 stub header
|
│ └── config/ # Build configuration headers
|
||||||
│ │ ├── ngspice/ # ngspice stub headers
|
├── patches/ # KiCad source patches
|
||||||
│ │ └── Standard_Version.hxx # OCC stub header
|
|
||||||
│ └── src/ # Stub source files
|
|
||||||
│ ├── disabled_features_stubs.cpp
|
|
||||||
│ ├── occ_stubs.cpp
|
|
||||||
│ ├── panel_git_repos_stub.cpp
|
|
||||||
│ └── kicad_git_all_stubs.cpp
|
|
||||||
├── cmake/ # CMake override modules
|
|
||||||
│ ├── FindCURL.cmake
|
|
||||||
│ ├── Findlibgit2.cmake
|
|
||||||
│ ├── Findngspice.cmake
|
|
||||||
│ └── FindOCC.cmake
|
|
||||||
├── scripts/ # Build scripts
|
├── scripts/ # Build scripts
|
||||||
└── docs/ # Documentation
|
│ ├── 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
|
||||||
```
|
```
|
||||||
|
|
||||||
## Goals
|
## Two Build Workflows
|
||||||
|
|
||||||
1. **Phase 1**: Build KiCad with optional deps disabled (curl, git, OCC, ngspice) ✅ **Complete**
|
### 1. KiCad Build (Docker)
|
||||||
2. **Phase 2**: Extract core computation code as standalone library
|
|
||||||
3. **Phase 3**: Compile core to WebAssembly
|
|
||||||
4. **Phase 4**: Run native GUI with Wasm worker backend
|
|
||||||
5. **Phase 5**: Browser-based UI
|
|
||||||
|
|
||||||
## Documentation
|
Full KiCad PCBnew build using Docker:
|
||||||
|
|
||||||
- [Implementation Plan](docs/IMPLEMENTATION_PLAN.md)
|
|
||||||
- [Knowledge Base (Summary)](docs/KNOWLEDGE_BASE.md)
|
|
||||||
- [Knowledge Base (Full)](docs/KNOWLEDGE_BASE_FULL.md)
|
|
||||||
|
|
||||||
## Design Decisions
|
|
||||||
|
|
||||||
- **Memory**: Serialize/deserialize on every operation (proof of concept)
|
|
||||||
- **Threading**: Web Workers (browser-first design)
|
|
||||||
- **Updates**: Full board re-serialization
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
- CMake 3.22+
|
|
||||||
- C++20 compiler (GCC 10+, Clang 12+, or MSVC 2019+)
|
|
||||||
- wxWidgets 3.2+
|
|
||||||
- Required libraries
|
|
||||||
|
|
||||||
#### macOS (Homebrew)
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install cmake wxwidgets boost cairo pixman freetype harfbuzz fontconfig \
|
# Build KiCad WASM
|
||||||
glm glew swig protobuf pkg-config nng python@3.14 zstd unixodbc
|
./docker/build.sh
|
||||||
|
|
||||||
|
# Copy output to test directory
|
||||||
|
./tests/scripts/setup-kicad-wasm.sh
|
||||||
|
|
||||||
|
# Run KiCad tests
|
||||||
|
cd tests && npm install && npm run test:kicad
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Ubuntu/Debian
|
Output: `output/pcbnew.js`, `output/pcbnew.wasm`
|
||||||
|
|
||||||
|
See [build.md](build.md) for detailed build documentation.
|
||||||
|
|
||||||
|
### 2. wxWidgets Test Apps (Local)
|
||||||
|
|
||||||
|
Build standalone wxWidgets test apps for feature testing:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install cmake build-essential libwxgtk3.2-dev libboost-all-dev \
|
# Build wxWidgets for WASM
|
||||||
libcairo2-dev libpixman-1-dev libfreetype-dev libharfbuzz-dev \
|
./scripts/build-wxuniversal-wasm.sh
|
||||||
libfontconfig-dev libglm-dev libglew-dev swig libprotobuf-dev \
|
|
||||||
protobuf-compiler libnng-dev python3-dev libzstd-dev
|
# Build test apps
|
||||||
|
./scripts/build-wasm-test.sh
|
||||||
|
|
||||||
|
# Run wxWidgets tests
|
||||||
|
cd tests && npm install && npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
### Quick Start (with dependencies disabled)
|
Output: `tests/wasm-app/standalone/`
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
### For KiCad Build (Docker)
|
||||||
|
- Docker Desktop with 16GB+ RAM allocated
|
||||||
|
- 10+ GB disk space for build cache
|
||||||
|
|
||||||
|
### For wxWidgets Build (Local)
|
||||||
|
- Emscripten SDK 4.0+
|
||||||
|
- Node.js 18+ (for tests)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone with submodules
|
# macOS
|
||||||
git clone --recursive <repo-url>
|
brew install emscripten node
|
||||||
cd kicad-wasm
|
|
||||||
|
|
||||||
# Apply patches to KiCad source
|
# Initialize submodules
|
||||||
cd kicad
|
git submodule update --init --recursive
|
||||||
git apply ../patches/0001-wasm-optional-deps.patch
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# Build
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake ../kicad \
|
|
||||||
-DCMAKE_MODULE_PATH="$(pwd)/../cmake" \
|
|
||||||
-DKICAD_USE_CURL=OFF \
|
|
||||||
-DKICAD_USE_GIT=OFF \
|
|
||||||
-DKICAD_USE_OCC=OFF \
|
|
||||||
-DKICAD_USE_NGSPICE=OFF \
|
|
||||||
-DKICAD_SCRIPTING_WXPYTHON=OFF
|
|
||||||
make -j$(nproc)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build Options
|
## Testing
|
||||||
|
|
||||||
| Option | Default | Description |
|
|
||||||
|--------|---------|-------------|
|
|
||||||
| `KICAD_USE_CURL` | ON | Enable network features (PCM, update check) |
|
|
||||||
| `KICAD_USE_GIT` | ON | Enable git integration |
|
|
||||||
| `KICAD_USE_OCC` | ON | Enable OpenCASCADE (STEP import/export) |
|
|
||||||
| `KICAD_USE_NGSPICE` | ON | Enable SPICE simulation |
|
|
||||||
| `KICAD_USE_DATABASE` | ON | Enable database libraries (ODBC) |
|
|
||||||
|
|
||||||
### Using the Build Script
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build with all optional deps disabled (default)
|
cd tests
|
||||||
./scripts/build.sh
|
npm install
|
||||||
|
|
||||||
# Build with specific features enabled
|
# Run all tests
|
||||||
./scripts/build.sh --with-curl --with-git
|
npm test
|
||||||
|
|
||||||
# Clean build
|
# Run specific tests
|
||||||
./scripts/build.sh --clean
|
npm run test:kicad # KiCad tests only
|
||||||
|
npx playwright test menu # Menu tests only
|
||||||
# Debug build
|
|
||||||
./scripts/build.sh --debug
|
|
||||||
|
|
||||||
# Just configure, don't build
|
|
||||||
./scripts/build.sh --configure-only
|
|
||||||
|
|
||||||
# See all options
|
|
||||||
./scripts/build.sh --help
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
See [tests/README.md](tests/README.md) for test documentation.
|
||||||
|
|
||||||
## Current Status
|
## Current Status
|
||||||
|
|
||||||
### Phase 1 Complete
|
- **wxWidgets WASM**: Core widgets working (menus, dialogs, grids, trees, OpenGL)
|
||||||
- CMake override modules for optional dependencies (FindOCC, Findngspice, FindCURL, Findlibgit2)
|
- **KiCad PCBnew**: Builds and loads in browser, canvas rendering working
|
||||||
- Stub headers and implementations for disabled features
|
- **In Progress**: Testing wxWidgets features used by KiCad
|
||||||
- KiCad source patches (`patches/0001-wasm-optional-deps.patch`)
|
|
||||||
- Full native build verified on macOS with all optional deps disabled
|
|
||||||
|
|
||||||
### Built Components
|
## Documentation
|
||||||
- `kicad` - Main application
|
|
||||||
- `kicad-cli` - Command line interface
|
|
||||||
- `_pcbnew.kiface` - PCB editor
|
|
||||||
- `_eeschema.kiface` - Schematic editor
|
|
||||||
- `_cvpcb.kiface` - Component to footprint association
|
|
||||||
- `_gerbview.kiface` - Gerber viewer
|
|
||||||
- `_pl_editor.kiface` - Page layout editor
|
|
||||||
- `_pcb_calculator.kiface` - PCB calculator
|
|
||||||
|
|
||||||
### Next Steps
|
- [Build System](build.md) - Docker build details
|
||||||
- Verify build on Linux/Windows
|
- [Docker README](docker/README.md) - Container setup
|
||||||
- Begin Phase 2 (core library extraction)
|
- [Tests README](tests/README.md) - Test infrastructure
|
||||||
|
- [Research Docs](docs/) - Original research notes
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
KiCad is GPL-3.0. This wrapper/tooling follows the same license.
|
KiCad is GPL-3.0. This project follows the same license.
|
||||||
|
|
|
||||||
13
build.md
13
build.md
|
|
@ -206,9 +206,10 @@ After changing build flags (debug/release), use `--full` to force a complete reb
|
||||||
|
|
||||||
| Script | Purpose |
|
| Script | Purpose |
|
||||||
|--------|---------|
|
|--------|---------|
|
||||||
| `scripts/build-kicad-wasm.sh` | Master build orchestrator |
|
| `docker/build.sh` | Host entry point (starts Docker, runs build) |
|
||||||
| `scripts/kicad/build-pcbnew.sh` | KiCad PCBnew build |
|
| `scripts/kicad/build-pcbnew.sh` | KiCad PCBnew build (runs inside Docker) |
|
||||||
| `scripts/build-wxuniversal-wasm.sh` | wxWidgets GUI build |
|
| `scripts/build-wxuniversal-wasm.sh` | wxWidgets build |
|
||||||
|
| `scripts/build-wasm-test.sh` | Build wxWidgets test apps |
|
||||||
| `scripts/deps/build-all-deps.sh` | All dependencies |
|
| `scripts/deps/build-all-deps.sh` | All dependencies |
|
||||||
| `scripts/deps/build-*.sh` | Individual dependency builds |
|
| `scripts/deps/build-*.sh` | Individual dependency builds |
|
||||||
| `scripts/common/env.sh` | Environment setup |
|
| `scripts/common/env.sh` | Environment setup |
|
||||||
|
|
@ -261,7 +262,6 @@ The WASM port requires compatibility layers for browser execution:
|
||||||
| `wasm/libcontext/` | Coroutine/fiber implementation for Asyncify |
|
| `wasm/libcontext/` | Coroutine/fiber implementation for Asyncify |
|
||||||
| `wasm/stubs/` | Stub implementations (libgit2, curl) |
|
| `wasm/stubs/` | Stub implementations (libgit2, curl) |
|
||||||
| `wasm/config/` | Build configuration headers |
|
| `wasm/config/` | Build configuration headers |
|
||||||
| `cmake/` | CMake find modules for dependencies |
|
|
||||||
|
|
||||||
## Emscripten Flags
|
## Emscripten Flags
|
||||||
|
|
||||||
|
|
@ -282,8 +282,11 @@ Key flags used in the build:
|
||||||
After building, run the test suite:
|
After building, run the test suite:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Copy WASM output to test directory
|
||||||
|
./tests/scripts/setup-kicad-wasm.sh
|
||||||
|
|
||||||
|
# Run KiCad tests
|
||||||
cd tests
|
cd tests
|
||||||
npm install
|
npm install
|
||||||
npm run setup:kicad # Copy WASM from build
|
|
||||||
npm run test:kicad # Run Playwright tests
|
npm run test:kicad # Run Playwright tests
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue