OpenCascade.js

build-wasm.sh CLI

Every subcommand of build-wasm.sh — validate, bindings, link, pch, clean, plus exit codes and tips.

build-wasm.sh is the orchestration entry point for the OCJS build pipeline. Each subcommand maps to a stage of the bindgen → compile → link sequence.

Synopsis

./build-wasm.sh <subcommand> [options] [<config-yaml>]

Subcommands

validate

./build-wasm.sh validate build-configs/my-config.yml

Parses the YAML against src/customBuildSchema.py and fails non-zero on any malformed entry, unknown key, duplicated symbol, or missing additionalCppFiles path. Does not run the C++ pipeline.

bindings

./build-wasm.sh bindings

Runs the libclang-driven bindgen against the OCCT headers, emitting one .hxx per class under build/bindings/<Module>/<Toolkit>/<Package>/ plus sidecar .d.ts.json shards.

Cache: re-uses prior output when header contents and bindgen-filter fingerprint match. Force regeneration with --force.

pch

./build-wasm.sh pch

Builds the precompiled header used by every bindings TU. Always passes -Xclang -fno-pch-timestamp so Nx/Docker cache restores don't invalidate the PCH on disk-mtime drift.

./build-wasm.sh link build-configs/my-config.yml

Compiles every .hxx referenced by the YAML's bindings: list (cached .o files reused), links them against the precompiled OCCT objects under dist/libs/, and emits the final wasm + JS + .d.ts + manifest sibling to the YAML.

clean

./build-wasm.sh clean           # rm build/, cache/, dist/
./build-wasm.sh clean --cache   # rm cache/ only
./build-wasm.sh clean --dist    # rm dist/ only

Exit codes

CodeMeaning
0Success
1YAML validation failure
2bindgen failure (libclang error)
3Compile failure
4Link failure (undefined symbol or unresolved reference)
5Missing input file
64Invalid usage (unknown subcommand or flag)

Common flags

FlagEffect
--config <name>Override OCJS_CONFIG for this run — selects a named preset from build-configs/configurations.json.
--forceBypass cache; rebuild from scratch
--verboseEquivalent to OCJS_VERBOSE=1
--jobs NSet OCJS_PARALLEL_JOBS=N

Typical CI invocation

./build-wasm.sh validate build-configs/my-config.yml
./build-wasm.sh link --jobs 8 build-configs/my-config.yml
sha256sum dist/my-config.wasm

On this page