From 63c01aadf6626ea090794ce31ff94c1992a000e4 Mon Sep 17 00:00:00 2001 From: Rob Rohan Date: Wed, 1 Jan 2025 11:08:59 +1300 Subject: [PATCH] Adding instructions macos and getting tests to work on mac as well --- Makefile | 23 ++++++++++++++++++++--- src/test.c | 3 ++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7d0103a..4fd87b0 100644 --- a/Makefile +++ b/Makefile @@ -30,12 +30,28 @@ about: @echo " MAIN=examples/xxxx.c to override entry file" @echo "make test - run some basic tests." @echo "" + @echo "make init_linux - install needed libs on linux" + @echo "make init_mac - install needed libs on macos" -init: +# Install libraries needed on linux +init_linux: sudo apt install clang-14 sudo apt install lld-14 sudo apt-get install gcc-multilib +# Install libraries needed on MacOS +init_mac: +# You'll need homebrew installed: https://brew.sh/ +# also be careful if you already have xcode installed +# as this will give you two versions of clang which can be +# confusing + brew install llvm + brew install lld + clang --version + wasm-ld --version + @echo "if the above command isn't found" + @echo "try to run: 'brew reinstall llvm' and/or 'brew reinstall lld'" + clean: rm -rf build @@ -87,9 +103,10 @@ test: clean_test mkdir -p build # add -lm if you want to test against built in math.h - $(CC) $(C_ERRS) -std=c11 -m32 -g \ +# and -m32 for non-mac systems (mac wont do 32 bits anymore) + $(CC) $(C_ERRS) -std=c11 -g \ $(NO_BUILT_INS) \ - src/math.c src/wefx.c src/test.c \ + src/math.c src/wefx.c src/events.c src/test.c \ -o build/test ./build/test diff --git a/src/test.c b/src/test.c index c127687..b7f163f 100644 --- a/src/test.c +++ b/src/test.c @@ -4,6 +4,7 @@ */ #include "math.h" #include "wefx.h" +#include "events.h" #include int main() @@ -111,4 +112,4 @@ int main() printf("h: %d; t: %d (should be the same now)\n", q.head->event->type, q.tail->event->type); printf("dequeued: %d\n", e9->type); } -} \ No newline at end of file +}