aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-11-11 15:16:57 +0000
committerMichael Williamson <mike@zwobble.org>2023-11-11 15:16:57 +0000
commitdf086044281cd5fabba5b3400d13ab2342773e46 (patch)
tree4b2e5fe33a27411f86333d67e5f75896f1cbf7f3 /runtime
parent02c208014ca1d3770db2f7a33f3c196c05b32eef (diff)
Build wasm runtime using meson
Diffstat (limited to 'runtime')
-rw-r--r--runtime/makefile15
-rw-r--r--runtime/wasm.meson9
2 files changed, 15 insertions, 9 deletions
diff --git a/runtime/makefile b/runtime/makefile
index 88467074..25f7b7ee 100644
--- a/runtime/makefile
+++ b/runtime/makefile
@@ -1,18 +1,15 @@
-CFLAGS = -Wall -Werror
-CFLAGS_WASM = --target=wasm32 -c -I src -Wall -Werror -D__WASM__ -O2
-
.PHONY: all
-all: build-amd64/libshed.a build-wasm/libshed.o
+all: build-amd64/libshed.a build-wasm/libshed.a
.PHONY: build-amd64/libshed.a
build-amd64/libshed.a:
meson setup build-amd64 --werror
- cd build-amd64 && meson compile
+ cd build-amd64 && meson compile --verbose
-.PHONY: build-wasm/libshed.o
+.PHONY: build-wasm/libshed.a
-build-wasm/libshed.o:
- mkdir -p build-wasm
- clang $(CFLAGS_WASM) src/shed.c -o build-wasm/libshed.o
+build-wasm/libshed.a:
+ meson setup build-wasm --cross-file wasm.meson --werror
+ cd build-wasm && meson compile --verbose
diff --git a/runtime/wasm.meson b/runtime/wasm.meson
new file mode 100644
index 00000000..6adb248b
--- /dev/null
+++ b/runtime/wasm.meson
@@ -0,0 +1,9 @@
+[binaries]
+c = 'clang-16'
+ld = 'wasm-ld'
+ar = 'llvm-ar-16'
+
+[properties]
+c_args = [ '--target=wasm32', '-D__WASM__' ]
+c_link_args = [ '--target=wasm32' ]
+