Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .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
204 changes: 180 additions & 24 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 @@ -9,17 +9,11 @@ env:
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
build:
strategy:
matrix:
include:
- os: "ubuntu-24.04"
fail-fast: false

runs-on: ${{ matrix.os }}

build-linux:
runs-on: ubuntu-24.04
permissions:
contents: write

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

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

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

- name: Configure CMake
run: |
cmake --preset linux-ninja-Release

- name: Build
run: |
cmake --build --preset linux-ninja-Release

- name: Run Tests
working-directory: build
run: |
ctest -VV

- name: Create Packages
working-directory: build
run: |
# Create tar.gz package
cpack -G TGZ
# Create DEB package
cpack -G DEB
# Create RPM package
cpack -G RPM

- name: Upload Linux Packages
uses: softprops/action-gh-release@v2
with:
files: |
build/cmcpp-*.tar.gz
build/cmcpp_*.deb
build/cmcpp-*.rpm
fail_on_unmatched_files: false

- name: Upload error logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: linux-logs
path: ./**/*.log

build-windows:
runs-on: windows-2022
permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Cache vcpkg registry
uses: actions/cache@v4
with:
path: |
build/vcpkg_installed/
build/vcpkg_packages/
key: ${{ runner.os }}-vcpkg-${{ hashFiles('./vcpkg*.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-

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

- name: Configure CMake
run: |
cmake --preset vcpkg-VS-17

- name: Build
run: |
cmake --build --preset VS-17-Release

- name: Run Tests
working-directory: build
run: |
ctest -C Release -VV

- name: Install rust dependencies
- name: Create Packages
working-directory: build
run: |
# Create ZIP package
cpack -C Release -G ZIP

- name: Upload Windows Packages
uses: softprops/action-gh-release@v2
with:
files: |
build/cmcpp-*.zip
fail_on_unmatched_files: false

- name: Upload error logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: windows-logs
path: ./**/*.log

build-macos:
runs-on: macos-14
permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Cache vcpkg registry
if: always()
uses: actions/cache@v4
with:
path: |
build/vcpkg_installed/
build/vcpkg_packages/
key: ${{ runner.os }}-vcpkg-${{ hashFiles('./vcpkg*.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-

- name: Install dependencies
run: |
brew install \
pkg-config \
autoconf \
autoconf-archive \
automake \
coreutils \
libtool \
cmake \
ninja

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

- name: configure
- name: Configure CMake
run: |
cmake --preset linux-ninja-Release

- name: build
- name: Build
run: |
cmake --build --preset linux-ninja-Release

- name: test
- name: Run Tests
working-directory: build
run: |
ctest -VV

- name: Package
- name: Create Packages
working-directory: build
run: |
tar -czvf cmcpp-${GITHUB_REF_NAME}.tar.gz include LICENSE LICENSE-BOOST-PFR
# Create tar.gz package
cpack -G TGZ
# Create ZIP package
cpack -G ZIP

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

- name: Upload error logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-logs
name: macos-logs
path: ./**/*.log

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