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.ymlParses 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 bindingsRuns 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 pchBuilds 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.
link
./build-wasm.sh link build-configs/my-config.ymlCompiles 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/ onlyExit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | YAML validation failure |
| 2 | bindgen failure (libclang error) |
| 3 | Compile failure |
| 4 | Link failure (undefined symbol or unresolved reference) |
| 5 | Missing input file |
| 64 | Invalid usage (unknown subcommand or flag) |
Common flags
| Flag | Effect |
|---|---|
--config <name> | Override OCJS_CONFIG for this run — selects a named preset from build-configs/configurations.json. |
--force | Bypass cache; rebuild from scratch |
--verbose | Equivalent to OCJS_VERBOSE=1 |
--jobs N | Set 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.wasmRelated
- Bindgen pipeline — stage diagram and artifact layout.
- Environment variables — env var catalogue.
- YAML schema — the YAML the CLI consumes.