Skip to content

GordonSmith/component-model-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status Actions Status Actions Status codecov

Component Model C++

This repository contains a C++ ABI implementation of the WebAssembly Component Model.

Features

OS

  • Ubuntu 24.04
  • MacOS 13
  • MacOS 14 (Arm)
  • Windows 2019
  • Windows 2022

Host Data Types

  • 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

Host Functions

  • lower_flat_values
  • lift_flat_values

Tests / Samples

  • ABI
  • WasmTime
  • Wamr
  • WasmEdge

Build Instructions

Prerequisites

  • 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)

Platform-specific requirements

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

Rust tools (required for samples and tests)

cargo install wasm-tools wit-bindgen-cli

Basic Build (Header-only)

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 .

Build with Dependencies (Tests & Samples)

Using CMake presets with vcpkg:

Linux

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

Windows

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

macOS

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

Manual Build without Presets

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

Build Options

  • -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

Usage

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.

Related projects

Star History

Star History Chart

About

C++ ABI implementation of the WebAssembly Component Model

Topics

Resources

License

Apache-2.0, BSL-1.0 licenses found

Licenses found

Apache-2.0
LICENSE
BSL-1.0
LICENSE-BOOST-PFR

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •