From df086044281cd5fabba5b3400d13ab2342773e46 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 11 Nov 2023 15:16:57 +0000 Subject: Build wasm runtime using meson --- runtime/makefile | 15 ++++++--------- runtime/wasm.meson | 9 +++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 runtime/wasm.meson (limited to 'runtime') 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' ] + -- cgit v1.2.3