OpenCascade.js

Environment variables

Every OCJS_* env var the build system honours — exceptions, SIMD, BigInt, EVAL_CTORS, LTO, strict types.

The build system reads these env vars before compile and link. Set them on the command line, in CI, or in build-configs/configurations.json.

Compile-time flags

VariableDefaultEffect
OCJS_EXCEPTIONS1Compile every TU with -fwasm-exceptions. Mixed builds fail at link.
OCJS_SIMD1Compile every TU with -msimd128 (baseline SIMD).
OCJS_RELAXED_SIMD0Additionally emit -mrelaxed-simd. Chrome/Firefox-only — breaks Safari.
OCJS_BIGINT1Compile with -sWASM_BIGINT. Saves ~30 KB JS glue.
OCJS_EVAL_CTORS_LEVEL2-sEVAL_CTORS=N. Levels: 0 off, 1 safe-side-effect, 2 full.
OCJS_LTO0Enable LLVM LTO. Smaller binary, ~3× slower build.
OCJS_STRICT_TYPES0 (warn-only)When the link-time .d.ts post-processor rewrites method signatures to unknown (or codegen collects unbound-reference diagnostics), the build always prints a triage summary to stderr. Set =1 to escalate that condition to a build failure.

Build orchestration

VariableDefaultEffect
OCJS_CONFIGsingle-threadedNamed preset from configurations.json. Alternative to the --config <name> CLI flag — both end up at the same place.
OCJS_PARALLEL_JOBSCPU countMax parallel compile jobs.
OCJS_CACHE_DIR./cacheWhere to store cached .o files and bindgen output.
OCJS_BUILD_DIR./buildIntermediate build outputs.
OCJS_DIST_DIR./distFinal wasm + JS + .d.ts artifacts.

Docker-specific

VariableDefaultEffect
OCJS_DEPS_VERSIONfrom DEPS.jsonOverride the dep pinning (OCCT, freetype, rapidjson).
OCJS_EMSDK_DIR/deps/emsdkLocation of the emscripten SDK inside the image.
OCJS_PYTHONpython3Python interpreter for the bindgen.
OCJS_OUTPUT_DIR/src (in container) / ./dist (host)Where the link step writes the final .wasm, .js, .d.ts, and .build-manifest.json. In-container default is /src so the canonical single-mount Quickstart (docker run -v "$(pwd):/src" …) writes outputs next to the YAML automatically. Override to a separate path if you need outputs outside the bind-mount.

Diagnostics

VariableDefaultEffect
OCJS_VERBOSE0Print every compile / link command.
OCJS_DUMP_CACHE_KEYS0Print the cache-key contents on miss (debug spurious cache invalidation).

Worked example

# Custom-trimmed Os build for an embedded edge runtime.
# OCJS_STRICT_TYPES=1 escalates the missing-typedef warning to a build
# failure -- recommended in CI; omit it for local builds (warn-only is
# the default).
OCJS_CONFIG=single-threaded-smallest \
OCJS_STRICT_TYPES=1 \
OCJS_PARALLEL_JOBS=8 \
./build-wasm.sh link build-configs/edge-runtime.yml

On this page