Building Open CASCADE (OCCT) for EzyCad
EzyCad does not vendor OCCT; builds live outside the tree. Point CMake at an install via OpenCASCADE_DIR (and on Windows desktop, OCCT_3RD_PARTY_DIR).
Official references
Upstream WebGL/wasm samples exist but are outdated; use the V8 script documented below for current EzyCad WASM support.
Version matrix (EzyCad)
Target |
Documented / tested |
CMake variables |
|---|---|---|
Windows desktop |
OCCT 8.0.0 prebuilt |
|
WebAssembly |
OCCT 8.0.0 via |
|
After upgrading OCCT, retest sketch dimensions, grid, fillet/chamfer/boolean, and STEP/STL export. OCCT 8.0 changes grid rendering and many modeling paths.
Windows desktop (easiest): prebuilt binaries
No OCCT compile. Use Release builds (EzyCad is tested with Release OCCT).
Download (8.0.0 — current README default)
# Combined (OCCT + 3rd-party, simplest layout for desktop):
https://github.com/Open-Cascade-SAS/OCCT/releases/download/V8_0_0/occt-combined-release-no-pch.zip
Note: The V8 combined release asset is a small wrapper zip containing opencascade-8.0.0-vc14-64-combined.zip. Extracting it yields:
opencascade-8.0.0-vc14-64/(containscmake/OpenCASCADEConfig.cmake→ use for-DOpenCASCADE_DIR=.../opencascade-8.0.0-vc14-64/cmake)3rdparty-vc14-64/
# Or separate (if you prefer):
https://github.com/Open-Cascade-SAS/OCCT/releases/download/V8_0_0/3rdparty-vc14-64.zip
# + the opencascade-*-vc14-64 combined from the V8_0_0 release page
Configure EzyCad
cmake C:\src\EzyCad -DOpenCASCADE_DIR=C:\bin\OCCT-install\cmake -DOCCT_3RD_PARTY_DIR=C:\bin\3rdparty-vc14-64
OpenCASCADE_DIR— directory containingOpenCASCADEConfig.cmake(often...\cmakeor...\lib\cmake\opencascadedepending on package layout; verify on disk).OCCT_3RD_PARTY_DIR— root of3rdparty-vc14-64(FreeType, TBB, FFmpeg DLLs copied next toEzyCad.exeperCMakeLists.txt).
Use Visual Studio generator, x64, Release for the app.
Windows desktop: build from source
Only when prebuilts are insufficient (custom flags, Debug OCCT, patches).
Install VS 2022 (C++), CMake 3.16+, Git.
Download 3rdparty-vc14-64.zip matching the OCCT tag.
Clone OCCT, configure with CMake GUI or CLI,
BUILD_LIBRARY_TYPE=SharedorStaticas needed, enableUSE_OPENGL,USE_FREETYPE, etc. per build guide.Build INSTALL target; set
OpenCASCADE_DIRto the install prefix’s cmake package path.
Prefer prebuilt packages unless you need a custom source build.
WebAssembly (Emscripten)
EzyCad’s wasm target links TKOpenGles (not TKOpenGl), static OCCT, and -fexceptions (see CMakeLists.txt Emscripten block).
Automated: scripts/build-occt-v8-wasm.ps1
Builds FreeType 2.13.3 + OCCT V8_0_0 static with GLES2 into a single install prefix.
Prerequisites: Git, CMake 3.16+, Emscripten emsdk 3.0+ with emsdk_env active (emcc, emcmake, emmake on PATH).
Layout created (default RootDir = %USERPROFILE%\occt-wasm-build):
occt-wasm-build/
src/OCCT/ git clone V8_0_0
src/freetype-2.13.3/ from .tar.gz (not .tar.xz on Windows)
build/freetype/
build/occt/
install/ CMAKE_INSTALL_PREFIX
lib/cmake/opencascade/ → OpenCASCADE_DIR
freetype/ FreeType install (used at OCCT configure time)
PowerShell (repo root, after emsdk_env):
.\scripts\build-occt-v8-wasm.ps1 -RootDir C:\bin\occt-wasm-build
Or use scripts\build-occt-v8-wasm.cmd if PowerShell script execution is restricted.
Script flags: -SkipDownload, -SkipFreeType, -SkipOcct, -ReconfigureOnly, -Jobs 8, -OcctTag V8_0_0, -BuildType Release.
Expect: 1–3+ hours compile, large disk use. Success prints OpenCASCADE_DIR=....
Configure EzyCad wasm (Ninja generator works well with OCCT V8):
mkdir build_em
cd build_em
emcmake cmake C:\src\EzyCad -Wno-dev -G Ninja -DOpenCASCADE_DIR=C:\src\occt-wasm-build\install\lib\cmake\opencascade -DCMAKE_BUILD_TYPE=Release
ninja
Serve: python -m http.server 8000 from the build output directory (the .html + .wasm + .data files).
OCCT wasm CMake flags (reference)
Used by build-occt-v8-wasm.ps1 — keep in sync if editing the script:
Variable |
Value |
Why |
|---|---|---|
|
|
|
|
|
No Tcl/Tk harness |
|
|
Desktop GL driver |
|
|
|
|
|
Default in 8.0; avoids GLES VTK issues |
|
|
Dimension / text rendering |
|
|
Reduce deps and build time |
|
|
Match EzyCad emscripten link flags |
FreeType wasm configure also disables optional zlib/png/harfbuzz finds to simplify the emscripten build.
Wasm troubleshooting
Symptom |
Fix |
|---|---|
|
|
|
Script uses |
|
Fixed: do not name a PowerShell function parameter |
|
Run |
EzyCad configure hangs on |
|
OCCT 8 + ghosted dimension labels |
Retest |
Note: Older OCCT builds (prior to 8.0) are no longer supported or documented. Use the V8 script above for WebAssembly.
Wrapper scripts and automation
When adding helper scripts under scripts/, follow existing repo conventions.
Windows .cmd (ExecutionPolicy bypass)
scripts/build-occt-v8-wasm.cmd wraps the PowerShell script (same pattern as check-nonascii-src.cmd):
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0build-occt-v8-wasm.ps1" %*
if errorlevel 1 exit /b 1
Batch + emsdk:
call C:\src\emsdk\emsdk_env.bat
cd /d C:\src\EzyCad
scripts\build-occt-v8-wasm.cmd -RootDir C:\src\occt-wasm-build
Unix .sh
No first-party wasm shell script yet; a scripts/build-occt-v8-wasm.sh may mirror the PowerShell logic:
set -euo pipefailRequire
emcc,git,cmakeROOT="${ROOT:-$HOME/occt-wasm-build}"Download
freetype-$VER.tar.gz(gzip portable; avoid.tar.xzifxzmissing)emcmake cmake -S ... -B ...with the same-Dflags as the.ps1emmake cmake --build ... --target install -j"$(nproc)"Print
OpenCASCADE_DIR=$ROOT/install/lib/cmake/opencascade
Use forward slashes in cmake paths on Unix.
PowerShell one-liner (no policy change)
powershell -NoProfile -ExecutionPolicy Bypass -File C:\src\EzyCad\scripts\build-occt-v8-wasm.ps1 -RootDir C:\src\occt-wasm-build
curl downloads (CI)
Windows desktop 8.0 combined:
curl -L -o occt-combined.zip https://github.com/Open-Cascade-SAS/OCCT/releases/download/V8_0_0/occt-combined-release-no-pch.zip
vcpkg (alternative desktop path)
OCCT 8 supports vcpkg (USE_VTK=ON only if needed). EzyCad’s CMakeLists.txt is written for find_package(OpenCASCADE) + manual OCCT_3RD_PARTY_DIR DLL copies — vcpkg integration is not wired in-tree.
Maintaining OCCT version pins
File |
What to update |
|---|---|
|
Pin version, download URLs, example |
|
|
|
Prebuilt download URL, cache key, |
|
|
|
This document |
|
Comments if triangulation API changes |
Quick reference: EzyCad CMake variables
Variable |
Platform |
Purpose |
|---|---|---|
|
All |
Path to |
|
Windows desktop |
Root of 3rdparty bundle for runtime DLLs |
|
Native / wasm |
|
EzyCad wasm also sets TKOpenGles in OpenCASCADE_LIBS when CMAKE_CXX_COMPILER_ID is Emscripten.