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
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,14 @@ jobs:
### Components Included

**C Components:**
- `hello_c_debug.wasm` - Debug build
- `hello_c_release.wasm` - Release build (optimized)
- `hello_c_cli.wasm` - CLI executable (runs with wasmtime)
- `hello_c_debug.wasm` - Library component (debug)
- `hello_c_release.wasm` - Library component (release)

**C++ Components:**
- `hello_cpp_debug.wasm` - Debug build
- `hello_cpp_release.wasm` - Release build (optimized)
- `hello_cpp_cli.wasm` - CLI executable (runs with wasmtime)
- `hello_cpp_debug.wasm` - Library component (debug)
- `hello_cpp_release.wasm` - Library component (release)

**Rust Components:**
- `hello_rust.wasm` - Hello World CLI
Expand All @@ -220,6 +222,10 @@ jobs:
# Install wasmtime
curl https://wasmtime.dev/install.sh -sSf | bash

# Run C/C++ CLI examples
wasmtime run hello_c_cli.wasm
wasmtime run hello_cpp_cli.wasm

# Run Rust CLI examples
wasmtime run hello_rust.wasm
wasmtime run calculator.wasm 8 + 8
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pulseengine/rules_wasm_component.

module(
name = "hello_wasm_components",
version = "0.1.0",
version = "0.2.0",
)

# Core dependency - WebAssembly Component Model rules
Expand Down
10 changes: 9 additions & 1 deletion c/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Demonstrates building a C WASI component with debug and release variants.
"""

load("@rules_wasm_component//cpp:defs.bzl", "cpp_component")
load("@rules_wasm_component//cpp:defs.bzl", "cpp_component", "cpp_wasm_binary")
load("@rules_wasm_component//wit:defs.bzl", "wit_library")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -44,10 +44,18 @@ alias(
actual = ":hello_c_release",
)

# CLI binary (runs directly with wasmtime)
cpp_wasm_binary(
name = "hello_c_cli",
srcs = ["src/main.c"],
language = "c",
)

# All variants
filegroup(
name = "all",
srcs = [
":hello_c_cli",
":hello_c_debug",
":hello_c_release",
],
Expand Down
12 changes: 12 additions & 0 deletions c/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Hello World WASI CLI in C
*
* Simple main() that prints to stdout - runs directly with wasmtime.
*/

#include <stdio.h>

int main(void) {
printf("Hello wasm component world from C!\n");
return 0;
}
10 changes: 9 additions & 1 deletion cpp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Demonstrates building a C++ WASI component with debug and release variants.
"""

load("@rules_wasm_component//cpp:defs.bzl", "cpp_component")
load("@rules_wasm_component//cpp:defs.bzl", "cpp_component", "cpp_wasm_binary")
load("@rules_wasm_component//wit:defs.bzl", "wit_library")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -50,10 +50,18 @@ alias(
actual = ":hello_cpp_release",
)

# CLI binary (runs directly with wasmtime)
cpp_wasm_binary(
name = "hello_cpp_cli",
srcs = ["src/main.cpp"],
language = "cpp",
)

# All variants
filegroup(
name = "all",
srcs = [
":hello_cpp_cli",
":hello_cpp_debug",
":hello_cpp_release",
],
Expand Down
12 changes: 12 additions & 0 deletions cpp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Hello World WASI CLI in C++
*
* Simple main() that prints to stdout - runs directly with wasmtime.
*/

#include <cstdio>

int main() {
printf("Hello wasm component world from C++!\n");
return 0;
}
Loading