diff --git a/README.md b/README.md index 4347bf3..ce9ddb0 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,38 @@ Run KiCad PCBnew in the browser using WebAssembly. +## Quick Start + +### Full Build (KiCad + All Tests) + +```bash +# 1. Initialize submodules +git submodule update --init --recursive + +# 2. Build KiCad WASM (Docker, ~10 min incremental, ~1-2 hours full) +./docker/build.sh + +# 3. Build wxWidgets for local testing +./scripts/build-wxuniversal-wasm.sh + +# 4. Build wxWidgets test apps +./scripts/build-wasm-test.sh + +# 5. Run all tests +cd tests && npm install +npm test # wxWidgets tests (256 tests) +npm run test:kicad # KiCad tests (2 tests) +``` + +### wxWidgets Only (No Docker) + +```bash +# Requires: Emscripten SDK 4.0+, Node.js 18+ +./scripts/build-wxuniversal-wasm.sh +./scripts/build-wasm-test.sh +cd tests && npm install && npm test +``` + ## Project Structure ``` diff --git a/docker/README.md b/docker/README.md index c4e21fe..706ddf6 100644 --- a/docker/README.md +++ b/docker/README.md @@ -21,6 +21,33 @@ This directory contains Docker configuration for building KiCad for WebAssembly ./docker/shell.sh ``` +## Branch-Specific Builds + +Each git branch gets isolated Docker containers and volumes, enabling parallel development: + +```bash +# On branch 'main' → containers/volumes prefixed with 'kicad-wasm-main' +# On branch 'feature-x' → containers/volumes prefixed with 'kicad-wasm-feature-x' +``` + +This allows you to: +- Work on multiple branches simultaneously using git worktrees +- Each worktree has its own build cache (no conflicts) +- Switch branches without rebuilding from scratch + +**Using git worktrees for parallel development:** +```bash +# Create a worktree for a new branch +git worktree add ../kicad-wasm-feature path/to/branch + +# Build in the worktree (uses isolated Docker volumes) +cd ../kicad-wasm-feature +./docker/build.sh + +# List all worktrees +git worktree list +``` + ## What Gets Built The build process includes: diff --git a/docker/build.sh b/docker/build.sh index fe6464a..30faf1d 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -11,6 +11,11 @@ set -e cd "$(dirname "$0")/.." +# Use branch name as Docker Compose project name for isolated containers/volumes +BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD | tr '/' '-' | tr '[:upper:]' '[:lower:]') +export COMPOSE_PROJECT_NAME="kicad-wasm-${BRANCH_NAME}" +echo "Using Docker project: ${COMPOSE_PROJECT_NAME}" + # Add -j 10 by default if no -j flag is given ARGS=("$@") if [[ ! " ${ARGS[*]} " =~ " -j " ]]; then diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 987afe8..a853141 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,7 +3,7 @@ services: build: context: .. dockerfile: docker/Dockerfile - container_name: kicad-wasm-builder + # Container name is auto-generated with project prefix (set in build.sh) # Resource limits (adjust based on your machine) deploy: