Skip to content

wasm: make the MAS/MKF fetch source and ref overridable - #1

Open
gpitel wants to merge 1 commit into
OpenMagnetics:mainfrom
gpitel:feature/overridable-mas-mkf-source
Open

wasm: make the MAS/MKF fetch source and ref overridable#1
gpitel wants to merge 1 commit into
OpenMagnetics:mainfrom
gpitel:feature/overridable-mas-mkf-source

Conversation

@gpitel

@gpitel gpitel commented Jul 31, 2026

Copy link
Copy Markdown

Building the wasm module against a fork or a local clone currently means editing bindings/wasm/CMakeLists.txt, because _MAS_LOCAL/_MKF_LOCAL are plain set() calls that shadow any -D on the command line.

That comes up as soon as you are adding something to MKF — a new shape family, say — and want the 3D module to pick it up.

Change

Four cache variables, defaults unchanged (upstream MAS/MKF main):

  • MVBPP_MAS_REPOSITORY / MVBPP_MAS_TAG
  • MVBPP_MKF_REPOSITORY / MVBPP_MKF_TAG

A fork build becomes:

emcmake cmake -S bindings/wasm -B build-wasm -G Ninja \
    -DMVBPP_MKF_REPOSITORY=file:///path/to/MKF \
    -DMVBPP_MKF_TAG=my-branch

Verified

Configure succeeds and _deps/mkf-src ends up on the requested branch rather than upstream main.

Why not FETCHCONTENT_SOURCE_DIR

FETCHCONTENT_SOURCE_DIR_MAS / _MKF looks like it should cover this, but it does not, and the comment now records why: the steps after the fetch — the MAS symlink, the submodule init, and the SHARED->STATIC patch — all address ${CMAKE_BINARY_DIR}/_deps/{mas,mkf}-src by name. Redirecting the source elsewhere leaves those pointing at a directory that is never created, and configure fails on the symlink step.

Only bindings/wasm/CMakeLists.txt is touched; the root CMakeLists is left alone since its file:///home/alf/... defaults are documented as intentional pending the MAS push.

Building the wasm module against a fork or a local clone currently means editing
CMakeLists.txt, because _MAS_LOCAL/_MKF_LOCAL are plain set() calls that shadow
any -D on the command line. That comes up as soon as you are adding something to
MKF -- a new shape family, say -- and want the 3D module to pick it up.

Adds four cache variables, defaults unchanged (upstream MAS/MKF main):

    MVBPP_MAS_REPOSITORY / MVBPP_MAS_TAG
    MVBPP_MKF_REPOSITORY / MVBPP_MKF_TAG

so a fork build is now just:

    emcmake cmake -S bindings/wasm -B build-wasm -G Ninja         -DMVBPP_MKF_REPOSITORY=file:///path/to/MKF         -DMVBPP_MKF_TAG=my-branch

Verified: configure succeeds and _deps/mkf-src is the requested branch rather
than upstream main.

FETCHCONTENT_SOURCE_DIR_MAS/_MKF is not a usable substitute, which the comment
now records: the steps after the fetch (the MAS symlink, submodule init, the
SHARED->STATIC patch) all address _deps/{mas,mkf}-src by name, so redirecting
the source elsewhere leaves them pointing at a directory that is never created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant