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
5 changes: 4 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- **Implementation mirrors the official Python reference**: The C++ code structure, type names, and semantics directly correspond to the Python implementation in `ref/component-model/design/mvp/canonical-abi/definitions.py` and the specification in `ref/component-model/design/mvp/CanonicalABI.md`. When making changes, cross-reference these files to ensure alignment.
- Supports async runtime primitives (`Store`, `Thread`, `Task`), resource management (`own`, `borrow`), streams/futures, waitables, and error contexts.

## Working style
- **Do not create summary documents**: Avoid creating markdown files in `docs/` to summarize work sessions, changes, or fixes unless explicitly requested. The git commit history and code comments are sufficient documentation.
- Focus on making changes directly to code, updating existing documentation only when functionality changes, and providing concise summaries in responses rather than generating files.

## Core headers
- `include/cmcpp/traits.hpp` defines `ValTrait`, type aliases (e.g., `bool_t`, `string_t`), and concept shortcuts that every new type must implement.
- `include/cmcpp/context.hpp` encapsulates `LiftLowerContext`, `ComponentInstance`, `Task`, resource tables (`HandleTable`, `InstanceTable`), and canonical operations like `canon_waitable_*`, `canon_stream_*`, `canon_future_*`.
Expand Down Expand Up @@ -37,5 +41,4 @@
## Tooling notes
- Dependencies are managed through `vcpkg.json` with overlays in `vcpkg_overlays/` (notably for WAMR); stick with preset builds so CMake wires in the correct toolchain file automatically.
- Cargo manifest (`Cargo.toml`) is only for fetching `wasm-tools` and `wit-bindgen-cli`; if you touch wasm generation logic, update both the manifest and any scripts referencing those versions.
- Release management uses Release Please with conventional commits (`feat:`, `fix:`, etc.) to automate changelog and version bumps.
- Keep documentation alongside code: update `README.md` when introducing new host types or workflows so downstream integrators stay aligned with the canonical ABI behavior.
3 changes: 1 addition & 2 deletions .github/instructions/general.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ This repository is a modern C++20 header-only library implementing WebAssembly C
- **Function Templates**: Use function templates for type-generic operations
- **SFINAE/Concepts**: Use concepts or SFINAE for template constraints
- **Const Correctness**: Maintain const correctness throughout
- **Naming**: Use snake_case for variables, PascalCase for types
- **Commit Messages**: Use conventional commits (`feat:`, `fix:`, etc.) for Release Please automation
- **Naming**: Use snake_case for variables, PascalCase for types
100 changes: 71 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C++ Release CI
name: Release

on:
push:
Expand All @@ -11,15 +11,59 @@ env:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: "ubuntu-24.04"
fail-fast: false
- os: ubuntu-24.04
preset: linux-ninja-Release
build-preset: linux-ninja-Release
cpack-generators: "TGZ;DEB;RPM"
package-patterns: |
build/cmcpp-*.tar.gz
build/cmcpp_*.deb
build/cmcpp-*.rpm
extra-deps: |
sudo apt-get update
sudo apt-get install -y \
autoconf \
autoconf-archive \
automake \
build-essential \
ninja-build \
rpm

runs-on: ${{ matrix.os }}
- os: windows-2022
preset: vcpkg-VS-17
build-preset: VS-17-Release
cpack-generators: "ZIP;NSIS"
cpack-config: "-C Release"
package-patterns: |
build/cmcpp-*.zip
build/cmcpp-*.exe
extra-deps: ""

- os: macos-14
preset: linux-ninja-Release
build-preset: linux-ninja-Release
cpack-generators: "TGZ;ZIP"
package-patterns: |
build/cmcpp-*.tar.gz
build/cmcpp-*.zip
extra-deps: |
brew install \
pkg-config \
autoconf \
autoconf-archive \
automake \
coreutils \
libtool \
cmake \
ninja

runs-on: ${{ matrix.os }}
permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -47,47 +91,45 @@ jobs:
restore-keys: |
${{ runner.os }}-vcpkg-

- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
autoconf \
autoconf-archive \
automake \
build-essential \
ninja-build

- name: Install rust dependencies
- name: Install dependencies
if: matrix.extra-deps != ''
run: ${{ matrix.extra-deps }}

- name: Install Rust dependencies
run: |
cargo install wasm-tools wit-bindgen-cli || true

- name: configure
- name: Configure CMake
run: |
cmake --preset linux-ninja-Release
cmake --preset ${{ matrix.preset }}

- name: build
- name: Build
run: |
cmake --build --preset linux-ninja-Release
cmake --build --preset ${{ matrix.build-preset }}

- name: test
- name: Run Tests
working-directory: build
run: |
ctest -VV
ctest ${{ matrix.cpack-config || '' }} -VV

- name: Package
- name: Create Packages
working-directory: build
run: |
tar -czvf cmcpp-${GITHUB_REF_NAME}.tar.gz include LICENSE LICENSE-BOOST-PFR
IFS=';' read -ra GENS <<< "${{ matrix.cpack-generators }}"
for gen in "${GENS[@]}"; do
cpack ${{ matrix.cpack-config || '' }} -G "$gen"
done
shell: bash

- name: Create Release
uses: ncipollo/release-action@v1
- name: Upload Packages
uses: softprops/action-gh-release@v2
with:
generateReleaseNotes: true
tag: ${{ github.ref_name }}
artifacts: cmcpp-${{ github.ref_name }}.tar.gz
files: ${{ matrix.package-patterns }}
fail_on_unmatched_files: false

- name: Upload error logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-logs
name: ${{ runner.os }}-logs
path: ./**/*.log
6 changes: 6 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:
restore-keys: |
${{ runner.os }}-vcpkg-

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: "17"
distribution: "temurin"

- name: Install rust dependencies
run: |
cargo install wasm-tools wit-bindgen-cli || true
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/build*
/build
/.vscode/settings.json
/cpm_modules
/vcpkg_installed
/test/wasm/build*
.DS_Store

# ANTLR jar files
antlr-*.jar
*.jar

# Added by cargo

Expand Down
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
url = https://github.com/WebAssembly/component-model.git
[submodule "ref/wasm-micro-runtime"]
path = ref/wasm-micro-runtime
url = git@github.com:bytecodealliance/wasm-micro-runtime.git
url = https://github.com/bytecodealliance/wasm-micro-runtime.git
[submodule "ref/wit-bindgen"]
path = ref/wit-bindgen
url = https://github.com/bytecodealliance/wit-bindgen.git
50 changes: 50 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,56 @@
"environment": [],
"externalConsole": false,
"preLaunchTask": "CMake: build"
},
{
"name": "(gdb) test-wit-grammar",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/test-wit-grammar",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "CMake: build"
},
{
"name": "(gdb) test-wit-grammar (verbose)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/test-wit-grammar",
"args": [
"--verbose"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "CMake: build"
},
{
"name": "(win) test-wit-grammar",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/Debug/test-wit-grammar.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"preLaunchTask": "CMake: build"
},
{
"name": "(win) test-wit-grammar (verbose)",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test/Debug/test-wit-grammar.exe",
"args": [
"--verbose"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"preLaunchTask": "CMake: build"
}
]
}
Loading
Loading