Skip to content

Commit 7027d37

Browse files
authored
Merge pull request odin-lang#5103 from jasonKercher/better-box2d-build
Make build_box2d.sh more flexible
2 parents 777c33a + 87f5b96 commit 7027d37

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

vendor/box2d/build_box2d.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu
44
VERSION="3.1.0"
55
RELEASE="https://github.com/erincatto/box2d/archive/refs/tags/v$VERSION.tar.gz"
66

7-
cd "$(odin root)"/vendor/box2d
7+
cd "$(dirname "$0")"
88

99
curl -O -L "$RELEASE"
1010
tar -xzvf "v$VERSION.tar.gz"
@@ -58,7 +58,7 @@ Darwin)
5858
*)
5959
rm -rf build
6060
mkdir build
61-
cmake $FLAGS -DCMAKE_OSX_ARCHITECTURES=arm64 -S . -B build
61+
cmake $FLAGS -S . -B build
6262
cmake --build build
6363
cp build/src/libbox2d.a ../lib/box2d_other.a
6464
;;
@@ -73,6 +73,7 @@ make -f wasm.Makefile
7373
if [[ $? -ne 0 ]]; then
7474
printf "\e[30;43mwarning:\e[0m Native Box2D libraries were built successfully, the WASM build failed, likely because your default C compiler and/or linker doesn't support WASM, you can set the CC and LD environment variables to point to a compiler and linker that support it\n"
7575
fi
76+
make -f wasm.Makefile clean
7677
set -e
7778

7879
rm -rf "v$VERSION.tar.gz"

vendor/box2d/wasm.Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ OBJS = $(SRCS:.c=.o)
1414
SYSROOT = $(shell odin root)/vendor/libc
1515
CFLAGS = -Ibox2d-$(VERSION)/include --target=wasm32 -D__EMSCRIPTEN__ -DNDEBUG -O3 --sysroot=$(SYSROOT)
1616

17-
all: lib/box2d_wasm.o lib/box2d_wasm_simd.o clean
17+
all: lib/box2d_wasm.o lib/box2d_wasm_simd.o
1818

1919
%.o: %.c
2020
$(CC) -c $(CFLAGS) -DBOX2D_DISABLE_SIMD $< -o $@

0 commit comments

Comments
 (0)