Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Build OpenCASCADE Technology (OCCT) for WebAssembly
|
|
|
|
|
# OCCT provides 3D geometry kernel for STEP file import/export
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
source "${SCRIPT_DIR}/../common/env.sh"
|
|
|
|
|
source "${SCRIPT_DIR}/../common/versions.sh"
|
|
|
|
|
source "${SCRIPT_DIR}/../common/functions.sh"
|
|
|
|
|
|
|
|
|
|
OCC_DIR="${DEPS_ROOT}/opencascade-${OCC_VERSION}"
|
|
|
|
|
OCC_BUILD="${BUILD_ROOT}/deps/opencascade"
|
|
|
|
|
OCC_STAMP="${BUILD_ROOT}/stamps/opencascade.stamp"
|
|
|
|
|
|
|
|
|
|
# Parse arguments
|
|
|
|
|
CLEAN=0
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
|
case $arg in
|
|
|
|
|
--clean)
|
|
|
|
|
CLEAN=1
|
|
|
|
|
shift
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ $CLEAN -eq 1 ]; then
|
|
|
|
|
log_info "Cleaning OpenCASCADE build..."
|
|
|
|
|
rm -rf "${OCC_BUILD}" "${OCC_STAMP}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if already built
|
|
|
|
|
if check_stamp "${OCC_STAMP}"; then
|
|
|
|
|
log_info "OpenCASCADE already built, skipping..."
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Download if needed
|
|
|
|
|
if [ ! -d "${OCC_DIR}" ]; then
|
|
|
|
|
log_info "Downloading OpenCASCADE ${OCC_VERSION}..."
|
|
|
|
|
mkdir -p "${DEPS_ROOT}"
|
|
|
|
|
cd "${DEPS_ROOT}"
|
|
|
|
|
|
|
|
|
|
# OpenCASCADE releases are on GitHub
|
|
|
|
|
OCC_URL="https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V${OCC_VERSION//./_}.tar.gz"
|
|
|
|
|
download_file "${OCC_URL}" "opencascade-${OCC_VERSION}.tar.gz"
|
|
|
|
|
tar -xzf "opencascade-${OCC_VERSION}.tar.gz"
|
2025-12-08 11:37:14 +01:00
|
|
|
# Directory name in tarball is OCCT-7_8_0 (without V prefix)
|
|
|
|
|
mv "OCCT-${OCC_VERSION//./_}" "opencascade-${OCC_VERSION}"
|
Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
rm "opencascade-${OCC_VERSION}.tar.gz"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
log_info "Building OpenCASCADE ${OCC_VERSION} for WASM..."
|
|
|
|
|
log_warn "This is a large library and may take a while..."
|
|
|
|
|
|
|
|
|
|
mkdir -p "${OCC_BUILD}"
|
|
|
|
|
cd "${OCC_BUILD}"
|
|
|
|
|
|
|
|
|
|
# OpenCASCADE build configuration for WASM
|
|
|
|
|
# Disable GUI, visualization that needs X11/OpenGL native
|
|
|
|
|
# Enable core geometry and data exchange modules only
|
|
|
|
|
emcmake cmake "${OCC_DIR}" \
|
2025-12-08 11:37:14 +01:00
|
|
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
2025-12-12 14:51:38 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
|
Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
-DCMAKE_INSTALL_PREFIX="${SYSROOT}" \
|
2025-12-13 11:29:45 +01:00
|
|
|
-DCMAKE_CXX_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory" \
|
|
|
|
|
-DCMAKE_C_FLAGS="${DEBUG_CFLAGS:--g -O0} -pthread -matomics -mbulk-memory" \
|
Add KiCad WASM build infrastructure and dependency scripts
- Add build environment setup (scripts/common/env.sh, versions.sh, functions.sh)
- Add dependency build scripts for Zstd, GLM, FreeType, HarfBuzz, Pixman, Cairo
- Add placeholder scripts for OpenCASCADE, ngspice, protobuf
- Add WASM compatibility layer (wasm/kiplatform/, wasm/libcontext/)
- Add CMake modules for KiCad WASM cross-compilation
- Add PCBnew test infrastructure (tests/kicad/)
- Add build plan documentation
Successfully tested builds: Zstd 1.5.5, GLM 0.9.9.8, FreeType 2.13.2,
HarfBuzz 8.3.0, Pixman 0.42.2, Cairo 1.18.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 13:15:04 +01:00
|
|
|
-DBUILD_LIBRARY_TYPE=Static \
|
|
|
|
|
-DBUILD_MODULE_ApplicationFramework=OFF \
|
|
|
|
|
-DBUILD_MODULE_Draw=OFF \
|
|
|
|
|
-DBUILD_MODULE_Visualization=OFF \
|
|
|
|
|
-DBUILD_MODULE_DETools=OFF \
|
|
|
|
|
-DBUILD_MODULE_FoundationClasses=ON \
|
|
|
|
|
-DBUILD_MODULE_ModelingData=ON \
|
|
|
|
|
-DBUILD_MODULE_ModelingAlgorithms=ON \
|
|
|
|
|
-DBUILD_MODULE_DataExchange=ON \
|
|
|
|
|
-DUSE_FREETYPE=OFF \
|
|
|
|
|
-DUSE_FREEIMAGE=OFF \
|
|
|
|
|
-DUSE_OPENVR=OFF \
|
|
|
|
|
-DUSE_FFMPEG=OFF \
|
|
|
|
|
-DUSE_TBB=OFF \
|
|
|
|
|
-DUSE_VTK=OFF \
|
|
|
|
|
-DUSE_TCL=OFF \
|
|
|
|
|
-DUSE_TK=OFF \
|
|
|
|
|
-DUSE_GLES2=OFF \
|
|
|
|
|
-DUSE_OPENGL=OFF \
|
|
|
|
|
-DUSE_D3D=OFF \
|
|
|
|
|
-DUSE_RAPIDJSON=OFF \
|
|
|
|
|
-DUSE_DRACO=OFF \
|
|
|
|
|
-DBUILD_DOC_Overview=OFF \
|
|
|
|
|
-DINSTALL_SAMPLES=OFF \
|
|
|
|
|
-DINSTALL_TEST_CASES=OFF
|
|
|
|
|
|
|
|
|
|
emmake make -j${JOBS}
|
|
|
|
|
emmake make install
|
|
|
|
|
|
|
|
|
|
create_stamp "${OCC_STAMP}"
|
|
|
|
|
log_info "OpenCASCADE build complete!"
|