Description
Add official support, CI verification, and documentation for compiling the C/C++ FFI bindings crate (tinyxml2-capi) to WebAssembly targets (wasm32-unknown-unknown and wasm32-wasip1). This allows C and C++ applications compiled to WebAssembly (via Emscripten or WASI SDK) to link with the generated static library (libtinyxml2_capi.a) as a drop-in replacement for TinyXML2.
Use Case
Developers writing C or C++ applications targeted for the web (via Emscripten/WebAssembly) or standalone WebAssembly runtimes (via WASI/Wasmtime) want to use tinyxml2-rs as a safe, drop-in replacement for the original C++ tinyxml2 library.
Currently, WebAssembly support is only validated and documented for Rust applications using tinyxml2. Enabling WASM target compilation in CI and documenting the compilation/linking commands (e.g., for emcc and clang with WASI SDK) allows C/C++ developers to easily adopt tinyxml2-rs in their WebAssembly build pipelines.
TinyXML2 C++ Equivalent
The original TinyXML2 C++ library is a header+source library that can be compiled to WebAssembly targets using Emscripten or `clang`. This feature ensures that our C FFI replacement (`tinyxml2-capi`) has parity in supporting WebAssembly target compilation and linking.
Additional Context
No Rust code changes are necessary in tinyxml2-capi since it is already target-agnostic and compiles to WASM out-of-the-box. The required changes include:
- Workspace Version Bump: Update workspace package version to
1.1.1 in the root Cargo.toml.
- CI Pipeline Integration: Add matrix targets
wasm32-unknown-unknown-capi and wasm32-wasip1-capi to .github/workflows/wasm-build.yml to compile tinyxml2-capi to WASM targets on every push/PR.
- Integration Guide: Update
docs/architecture/wasm.md with instructions on compiling tinyxml2-capi for WebAssembly and linking it in projects using Emscripten (emcc) and WASI SDK (clang).
- Roadmap & Changelog: Document the additions in
ROADMAP.md and CHANGELOG.md.
Description
Add official support, CI verification, and documentation for compiling the C/C++ FFI bindings crate (
tinyxml2-capi) to WebAssembly targets (wasm32-unknown-unknownandwasm32-wasip1). This allows C and C++ applications compiled to WebAssembly (via Emscripten or WASI SDK) to link with the generated static library (libtinyxml2_capi.a) as a drop-in replacement for TinyXML2.Use Case
Developers writing C or C++ applications targeted for the web (via Emscripten/WebAssembly) or standalone WebAssembly runtimes (via WASI/Wasmtime) want to use
tinyxml2-rsas a safe, drop-in replacement for the original C++tinyxml2library.Currently, WebAssembly support is only validated and documented for Rust applications using
tinyxml2. Enabling WASM target compilation in CI and documenting the compilation/linking commands (e.g., foremccandclangwith WASI SDK) allows C/C++ developers to easily adopttinyxml2-rsin their WebAssembly build pipelines.TinyXML2 C++ Equivalent
Additional Context
No Rust code changes are necessary in
tinyxml2-capisince it is already target-agnostic and compiles to WASM out-of-the-box. The required changes include:1.1.1in the rootCargo.toml.wasm32-unknown-unknown-capiandwasm32-wasip1-capito.github/workflows/wasm-build.ymlto compiletinyxml2-capito WASM targets on every push/PR.docs/architecture/wasm.mdwith instructions on compilingtinyxml2-capifor WebAssembly and linking it in projects using Emscripten (emcc) and WASI SDK (clang).ROADMAP.mdandCHANGELOG.md.