Skip to content

feat: Add emscripten_wasm32 (WebAssembly) target for tket-c-api#15

Open
aborgna-q wants to merge 4 commits into
mainfrom
agents/implement-wasm-wheels-for-tket2
Open

feat: Add emscripten_wasm32 (WebAssembly) target for tket-c-api#15
aborgna-q wants to merge 4 commits into
mainfrom
agents/implement-wasm-wheels-for-tket2

Conversation

@aborgna-q

@aborgna-q aborgna-q commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Adds a wasm32-unknown-emscripten build target for the tket C API we can produce pyodide-compatible WebAssembly wheels downstream. See Quantinuum/tket2#1415.

Targets Emscripten 5.0.3, matching the pyodide pyemscripten_2026_0 ABI (Python 3.14).

I checked the artifacts generated here in a local build and test of tket-py, and everything seemed correct.

Warning

This PR was mostly LLM-generated. I am not fluent in cmake bash scripts, but did a layman check of the file.

Build the tket C API and its C++ dependencies for the
`wasm32-unknown-emscripten` target so downstream projects (tket2, hugr)
can produce pyodide-compatible WebAssembly wheels.

- deps/tket/emscripten_wasm32.sh: full source build via emsdk 5.0.3
  (matching the pyodide `pyemscripten_2026_0` ABI). Boost is installed
  headers-only, symengine/eigen/json and the tk* libraries are compiled
  to wasm, and all static archives are merged into a single
  self-contained libtket-c-api.a.
- build.yml: map the emscripten_wasm32 platform to an ubuntu-latest
  runner (auto-discovered from the deps script).
- release.yml: accept the `wasm32` arch in the release asset regex.
- install-hugrenv-action: add a `target` input so consumers can fetch
  the emscripten build on a Linux runner, and skip dynamic-library path
  setup for the static-only emscripten target.
- README: document the emscripten_wasm32 target and the `target` input.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aborgna-q and others added 2 commits July 3, 2026 12:11
Eigen 5.0.1 defaults `EIGEN_BUILD_BLAS`/`EIGEN_BUILD_LAPACK` to ON for a
top-level build, which compiles the reference Fortran BLAS/LAPACK and
requires a Fortran compiler. The Emscripten CI runner has none, so
configure failed. tket only consumes Eigen header-only, so disable the
BLAS/LAPACK (and testing/demos/doc) builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aborgna-q aborgna-q requested a review from jake-arkinstall July 3, 2026 13:18
@aborgna-q aborgna-q marked this pull request as ready for review July 3, 2026 13:18
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