Skip to content

Commit

Permalink
wip8
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Jul 23, 2024
1 parent 9f3e551 commit 89e52f5
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions bin/jextract-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -ex

VYBE_GCC_RAYLIB="raylib/src/rcore.o raylib/src/rshapes.o raylib/src/rtextures.o raylib/src/rtext.o raylib/src/utils.o raylib/src/rglfw.o raylib/src/rmodels.o raylib/src/raudio.o raylib/src/raylib.dll.rc.data -Lraylib/src raylib/src/libraylibdll.a -static-libgcc -lopengl32 -lgdi32 -lwinmm"

VYBE_GCC_JOLT="-Wl,--out-implib,zig-gamedev/libs/zphysics/zig-out/lib/joltc.lib"
VYBE_JOLT_EXTENSION="lib"

unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
Expand All @@ -12,13 +15,17 @@ case "${unameOut}" in
VYBE_GCC_FLECS_OPTS="-std=gnu99 -fPIC";
VYBE_GCC_END="";
VYBE_GCC_RAYLIB="";
VYBE_GCC_JOLT="";
VYBE_JOLT_EXTENSION="so";
VYBE_LIB_PREFIX="lib";;
Darwin*)
VYBE_EXTENSION=dylib;
__VYBE_DEFAULT_GCC_ARGS="gcc -undefined dynamic_lookup";
VYBE_GCC_FLECS_OPTS="-std=gnu99";
VYBE_GCC_END="";
VYBE_GCC_RAYLIB="";
VYBE_GCC_JOLT="";
VYBE_JOLT_EXTENSION="dylib";
VYBE_LIB_PREFIX="lib";;
CYGWIN*)
VYBE_EXTENSION=dll;
Expand Down Expand Up @@ -53,6 +60,28 @@ rm -rf src-java/org/vybe/raylib
rm native/*
touch native/keep

# -- Jolt Physics
echo "Extracting Jolt Physics"

cd zig-gamedev/libs/zphysics && \
zig build && \
cd - && \
ls zig-gamedev/libs/zphysics/zig-out/lib && \
cp "zig-gamedev/libs/zphysics/zig-out/lib/${VYBE_LIB_PREFIX}joltc.$VYBE_JOLT_EXTENSION" "native/${VYBE_LIB_PREFIX}joltc_zig.$VYBE_JOLT_EXTENSION"

$VYBE_GCC \
-shared \
bin/vybe_jolt.c \
-I zig-gamedev/libs/zphysics/libs/JoltC \
-o "native/${VYBE_LIB_PREFIX}vybe_jolt.$VYBE_EXTENSION" $VYBE_GCC_JOLT

$VYBE_JEXTRACT \
-l ":/tmp/pfeodrippe_vybe_native/${VYBE_LIB_PREFIX}joltc_zig.$VYBE_EXTENSION" \
-l ":/tmp/pfeodrippe_vybe_native/${VYBE_LIB_PREFIX}vybe_jolt.$VYBE_EXTENSION" \
--output src-java \
--header-class-name jolt \
-t org.vybe.jolt bin/vybe_jolt.c

# -- Flecs
echo "Extracting Flecs"

Expand Down Expand Up @@ -95,24 +124,3 @@ $VYBE_JEXTRACT \
--output src-java \
--header-class-name raylib \
-t org.vybe.raylib bin/vybe_raylib.c

# -- Jolt Physics
echo "Extracting Jolt Physics"

cd zig-gamedev/libs/zphysics && \
zig build && \
cd - && \
cp "zig-gamedev/libs/zphysics/zig-out/lib/${VYBE_LIB_PREFIX}joltc.$VYBE_EXTENSION" "native/${VYBE_LIB_PREFIX}joltc_zig.$VYBE_EXTENSION"

$VYBE_GCC \
-shared \
bin/vybe_jolt.c \
-I zig-gamedev/libs/zphysics/libs/JoltC \
-o "native/${VYBE_LIB_PREFIX}vybe_jolt.$VYBE_EXTENSION"

$VYBE_JEXTRACT \
-l ":/tmp/pfeodrippe_vybe_native/${VYBE_LIB_PREFIX}joltc_zig.$VYBE_EXTENSION" \
-l ":/tmp/pfeodrippe_vybe_native/${VYBE_LIB_PREFIX}vybe_jolt.$VYBE_EXTENSION" \
--output src-java \
--header-class-name jolt \
-t org.vybe.jolt bin/vybe_jolt.c

0 comments on commit 89e52f5

Please sign in to comment.