Skip to content

Commit

Permalink
Adding instructions macos and getting tests to work on mac as well
Browse files Browse the repository at this point in the history
  • Loading branch information
robrohan committed Dec 31, 2024
1 parent e517bec commit 63c01aa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
23 changes: 20 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
#include "math.h"
#include "wefx.h"
#include "events.h"
#include <stdio.h>

int main()
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 63c01aa

Please sign in to comment.