-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (40 loc) · 1.12 KB
/
cmake.yml
File metadata and controls
51 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This workflow demonstrates how to use the `setup-wasi-sdk` action from CMake projects. The WASI
# SDK comes bundled with a `*.cmake` file that makes this relatively easy.
name: CMake-compatible
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
cmake:
name: Example
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./
- name: Create CMake project
run: |
mkdir cmake-test
cd cmake-test
cat > CMakeLists.txt << 'EOF'
cmake_minimum_required(VERSION 3.16)
project(HelloWasm C)
add_executable(hello hello.c)
EOF
cat > hello.c << 'EOF'
#include <stdio.h>
int main() {
printf("Hello from CMake + WASI!\n");
return 0;
}
EOF
- name: Build with CMake
run: |
cd cmake-test
cmake -B build -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake
cmake --build build
ls -la build/hello
file build/hello