This repository contains a C++ ABI implementation of the WebAssembly Component Model.
- Ubuntu 24.04
- MacOS 13
- MacOS 14 (Arm)
- Windows 2019
- Windows 2022
- Bool
- S8
- U8
- S16
- U16
- S32
- U32
- S64
- U64
- F32
- F64
- Char
- String
- utf8 String
- utf16 String
- latin1+utf16 String
- List
- Record
- Tuple
- Variant
- Enum
- Option
- Result
- Flags
- Own
- Borrow
- lower_flat_values
- lift_flat_values
- ABI
- WasmTime
- Wamr
- WasmEdge
- CMake 3.5 or higher (3.22+ recommended for presets)
- C++20 compatible compiler
- vcpkg for dependency management
- Rust toolchain with
cargo
(for additional tools)
Ubuntu/Linux:
sudo apt-get install -y autoconf autoconf-archive automake build-essential ninja-build
macOS:
brew install pkg-config autoconf autoconf-archive automake coreutils libtool cmake ninja
Windows:
- Visual Studio 2019 or 2022 with C++ support
cargo install wasm-tools wit-bindgen-cli
For header-only usage without tests or samples:
git clone https://github.com/LexisNexis-GHCPE/component-model-cpp.git
cd component-model-cpp
git submodule update --init --recursive
mkdir build && cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_SAMPLES=OFF
cmake --build .
Using CMake presets with vcpkg:
git clone https://github.com/LexisNexis-GHCPE/component-model-cpp.git
cd component-model-cpp
git submodule update --init --recursive
# Configure and build
cmake --preset linux-ninja-Debug
cmake --build --preset linux-ninja-Debug
# Run tests
cd build && ctest -VV
git clone https://github.com/LexisNexis-GHCPE/component-model-cpp.git
cd component-model-cpp
git submodule update --init --recursive
# Configure and build
cmake --preset vcpkg-VS-17
cmake --build --preset VS-17-Debug
# Run tests
cd build && ctest -C Debug -VV
git clone https://github.com/LexisNexis-GHCPE/component-model-cpp.git
cd component-model-cpp
git submodule update --init --recursive
# Configure and build
cmake --preset linux-ninja-Debug
cmake --build --preset linux-ninja-Debug
# Run tests
cd build && ctest -VV
If you prefer not to use CMake presets:
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build .
ctest -VV # Run tests
-DBUILD_TESTING=ON/OFF
- Enable/disable building tests (requires doctest, ICU)-DBUILD_SAMPLES=ON/OFF
- Enable/disable building samples (requires wasi-sdk)-DCMAKE_BUILD_TYPE=Debug/Release/RelWithDebInfo/MinSizeRel
- Build configuration
This library is a header only library. To use it in your project, you can:
- Copy the contents of the
include
directory to your project. - Use
vcpkg
to install the library and its dependencies.
- Component Model design and specification: Official Component Model specification.
- wit-bindgen c++ host: C++ host support for the WebAssembly Interface Types (WIT) Bindgen tool.