Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ combination in CI:

| Shim version | manifold | Clipper2 | Patches shipped |
|-----------------------|-----------------------------------------------|----------------------------------------------|-----------------------|
| v0.4.0 | `3ce9622b` (master, includes elalish/manifold#1690) | inherits manifold's pin (manifold owns the FetchContent_Declare) | 0 |
| v0.4.0-alpha.1 | `5f95a3ac` (master + vendored elalish/manifold#1690) | inherits manifold's pin (manifold owns the FetchContent_Declare) | 1 (verbatim diff of #1690) |
| v0.3.0 | `v3.4.1` | `46f639177fe418f9689e8ddb74f08a870c71f5b4` | 0001 + 0002 + 0003 |
| v0.2.0 | `v3.4.1` | `46f639177fe418f9689e8ddb74f08a870c71f5b4` | 0001 + 0002 + 0003 (carried in `test/manifold-link/patches/`; helper not yet present) |

Consumers calling `wasm_cxx_shim_add_manifold()` (introduced in v0.3.0)
with no arguments get the row matching their installed shim version.
Pinning to other refs is supported via `MANIFOLD_GIT_TAG` /
`CLIPPER2_GIT_TAG` / `EXTRA_*_PATCHES` parameters; see
`EXTRA_MANIFOLD_PATCHES` parameters; see
`cmake/WasmCxxShimManifold.cmake`.

When upstream PRs land for the carry-patches, the corresponding patch
Expand All @@ -33,7 +34,36 @@ version where the macro guard appears natively.

## Unreleased

(no changes since v0.4.0-alpha.1)
(no changes since v0.4.0)

## v0.4.0 — manifold #1690 merged upstream, carry-patch dropped (2026-05-04)

Manifold's `MANIFOLD_NO_IOSTREAM` build option is now upstream
(merged in [elalish/manifold#1690][pr1690]). The shim drops its
single carry-patch entirely and bumps the manifold pin to a master
commit past the merge. From here, the helper is just a thin wrapper
that sets `MANIFOLD_NO_IOSTREAM=ON` and lets manifold's own option
chain propagate the macros.

[pr1690]: https://github.com/elalish/manifold/pull/1690

### Removed

- `cmake/manifold-patches/0001-manifold-no-iostream.patch` and the
whole `cmake/manifold-patches/` directory. The vendored #1690 diff
is no longer needed; manifold owns the option upstream.
- `SKIP_BUILTIN_PATCHES` argument from
`wasm_cxx_shim_add_manifold()`. There are no builtin patches to
skip. Callers that were passing it can drop the argument; callers
using `EXTRA_MANIFOLD_PATCHES` continue to work unchanged.
- The `install(DIRECTORY .../manifold-patches ...)` rule (the
directory no longer exists).

### Changed

- Default `MANIFOLD_GIT_TAG` bumped to `3ce9622b` (upstream master
HEAD at release time, includes #1690 + one downstream commit).
- Helper smoke test updated for the new file layout.

## v0.4.0-alpha.1 — manifold pin bump + #1690 carry-patch (2026-05-03)

Expand Down
5 changes: 2 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,8 @@ them.
- **`CMAKE_CURRENT_LIST_DIR` inside a function body resolves to the
*caller's* location, not the module's.** When writing a CMake
helper module that needs to find files it ships alongside (e.g.,
`WasmCxxShimManifold.cmake` resolving its sibling
`manifold-patches/` directory), capture the path at module
load-time, OUTSIDE any function:
shipped data, vendored patches, generated configs), capture the
path at module load-time, OUTSIDE any function:
```cmake
# at module top-level
set(_helper_dir "${CMAKE_CURRENT_LIST_DIR}")
Expand Down
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ install(FILES
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/wasm-cxx-shim
)

# Integration-helper patches. Installed alongside the helper module
# so that wasm_cxx_shim_add_manifold()'s ${CMAKE_CURRENT_LIST_DIR}/
# manifold-patches/ resolution works uniformly in source + install
# trees.
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/manifold-patches
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/wasm-cxx-shim
)

# Install the toolchain file as a convenience for downstream consumers
# building C++ libraries against this shim. They pass it as
# `-DCMAKE_TOOLCHAIN_FILE=${prefix}/share/wasm-cxx-shim/toolchain-wasm32.cmake`.
Expand Down
52 changes: 16 additions & 36 deletions cmake/WasmCxxShimManifold.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Helper for consumers building manifold (elalish/manifold) on top of
# wasm-cxx-shim for the wasm32-unknown-unknown target. Captures the
# high-change-rate parts of the integration cocktail (FetchContent
# pin, the iostream-stripping carry-patch, manifold's CMake options)
# that drift fast across manifold versions. Lower-change-rate parts
# pin, manifold's CMake options) that drift fast across manifold
# versions. Lower-change-rate parts
# (the libc++ `__config_site` override, the `<mutex>` stub header,
# and `libcxx-extras.cpp`) stay scoped under the shim's
# `test/manifold-link/` for libc++-source-drift insulation reasons
Expand All @@ -24,8 +24,7 @@
#
# wasm_cxx_shim_add_manifold(
# MANIFOLD_GIT_TAG <ref> # tag or SHA; default = shim's tested pin
# EXTRA_MANIFOLD_PATCHES <p>... # additional patches to apply
# SKIP_BUILTIN_PATCHES # opt out of the shipped #1690 carry-patch
# EXTRA_MANIFOLD_PATCHES <p>... # caller-supplied patches to apply
# )
#
# After the call, the `manifold`, `manifoldc`, and `Clipper2` CMake
Expand All @@ -49,35 +48,26 @@
#
# ---
#
# The shipped carry-patch is the verbatim diff of elalish/manifold#1690
# (adds `MANIFOLD_NO_IOSTREAM` build option + Clipper2 tracking patch)
# against the upstream master commit pinned below. Once #1690 lands and
# the pin moves past it, the patch drops entirely. Until then, this
# helper bakes #1690's design into the shim — manifold's option chain
# does the work, the shim just sets the option ON and lets manifold
# propagate `MANIFOLD_NO_IOSTREAM` / `MANIFOLD_NO_FILESYSTEM` /
# `CLIPPER2_NO_IOSTREAM` as PUBLIC compile defs.
# Manifold's `MANIFOLD_NO_IOSTREAM` option (added upstream in #1690)
# does the work: defining it ON propagates `MANIFOLD_NO_IOSTREAM` /
# `MANIFOLD_NO_FILESYSTEM` / `CLIPPER2_NO_IOSTREAM` as PUBLIC compile
# defs through manifold's and Clipper2's targets. The shim just sets
# the option ON. No carry-patches are shipped for default-pin builds.

include_guard(GLOBAL)

# Resolve our own location so the helper finds its shipped patch
# regardless of whether it's loaded from the source tree or from an
# installed package config dir.
set(_wasm_cxx_shim_manifold_helper_dir "${CMAKE_CURRENT_LIST_DIR}")

# Tested-pin default. Bumped when the shim cuts a new release that
# verifies a new manifold combination. Source of truth: this file.
# Changes here must be paired with a CHANGELOG.md entry + a version
# bump (and re-rolling the carry-patch if upstream master moved
# beneath #1690's diff context).
# bump.
set(_wasm_cxx_shim_manifold_default_manifold_tag
"5f95a3ac0e906f596bb2d27a52d005ef60de58f3"
"3ce9622b"
CACHE STRING
"Default manifold pin used by wasm_cxx_shim_add_manifold()")

function(wasm_cxx_shim_add_manifold)
cmake_parse_arguments(_WCSAM
"SKIP_BUILTIN_PATCHES"
""
"MANIFOLD_GIT_TAG"
"EXTRA_MANIFOLD_PATCHES"
${ARGN})
Expand All @@ -91,31 +81,21 @@ function(wasm_cxx_shim_add_manifold)
set(_WCSAM_MANIFOLD_GIT_TAG "${_wasm_cxx_shim_manifold_default_manifold_tag}")
endif()

# Builtin patch (the vendored #1690 diff) plus user extras.
set(_manifold_patches "")
if(NOT _WCSAM_SKIP_BUILTIN_PATCHES)
list(APPEND _manifold_patches
"${_wasm_cxx_shim_manifold_helper_dir}/manifold-patches/0001-manifold-no-iostream.patch")
endif()
list(APPEND _manifold_patches ${_WCSAM_EXTRA_MANIFOLD_PATCHES})

include(FetchContent)

# Manifold owns its Clipper2 declaration (manifoldDeps.cmake).
# With the #1690 carry-patch applied, that declaration also
# carries a Clipper2 carry-patch tracking AngusJohnson/Clipper2#1094,
# and sets CLIPPER2_NO_IOSTREAM=ON when MANIFOLD_NO_IOSTREAM is on.
# We don't pre-declare Clipper2 here.
# Manifold owns its Clipper2 declaration (manifoldDeps.cmake) and
# propagates CLIPPER2_NO_IOSTREAM=ON to the bundled Clipper2 when
# MANIFOLD_NO_IOSTREAM is on. We don't pre-declare Clipper2 here.
set(_manifold_decl_args
GIT_REPOSITORY https://github.com/elalish/manifold.git
GIT_TAG ${_WCSAM_MANIFOLD_GIT_TAG}
UPDATE_DISCONNECTED TRUE)
if(_manifold_patches)
if(_WCSAM_EXTRA_MANIFOLD_PATCHES)
# `git apply` flag set matches manifold-csg's proven recipe:
# --ignore-whitespace + --whitespace=nowarn for cross-platform
# robustness (CRLF, mixed indentation).
list(APPEND _manifold_decl_args
PATCH_COMMAND git apply --ignore-whitespace --whitespace=nowarn ${_manifold_patches})
PATCH_COMMAND git apply --ignore-whitespace --whitespace=nowarn ${_WCSAM_EXTRA_MANIFOLD_PATCHES})
endif()
FetchContent_Declare(manifold ${_manifold_decl_args})

Expand Down
10 changes: 1 addition & 9 deletions cmake/check-manifold-helper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,5 @@ if(NOT _wasm_cxx_shim_manifold_default_manifold_tag)
message(FATAL_ERROR "default manifold tag is empty")
endif()

# Shipped carry-patch must resolve. Catches "file moved" / "captured
# the wrong CMAKE_CURRENT_LIST_DIR" / "install rule missed a file".
set(_p "${_wasm_cxx_shim_manifold_helper_dir}/manifold-patches/0001-manifold-no-iostream.patch")
if(NOT EXISTS "${_p}")
message(FATAL_ERROR "shipped patch missing: ${_p}")
endif()

message(STATUS
"helper API smoke OK: default manifold pin=${_wasm_cxx_shim_manifold_default_manifold_tag}, "
"carry-patch resolved")
"helper API smoke OK: default manifold pin=${_wasm_cxx_shim_manifold_default_manifold_tag}")
Loading
Loading