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 010f44a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 43 deletions.
46 changes: 24 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ name: CI
on: [ push, pull_request ]

jobs:
build-linux:
runs-on: ubuntu-latest
build-windows:
runs-on: windows-latest
timeout-minutes: 30
strategy:
fail-fast: true

steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: mlugg/setup-zig@v1

- name: Prepare java
Expand All @@ -26,27 +27,28 @@ jobs:

- name: install tools
run: |
wget -O jextract.tar.gz https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_linux-x64_bin.tar.gz
curl -o jextract.tar.gz https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_windows-x64_bin.tar.gz
tar -xvzf jextract.tar.gz
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
- name: install bake
run: |
git clone https://github.com/SanderMertens/bake
make -C bake/build-$(uname)
bake/bake setup
cd bake\build-Windows
nmake
cd ..
./bake setup --local
- name: compile and jextract native modules
run: |
bin/ci.sh
bash -c "bin/ci_windows.sh"
clojure -T:build compile-app
- name: run test
run: |
bin/kaocha
bash -c "bin/kaocha"
build-macos:
runs-on: macOS-latest
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: true
Expand All @@ -68,9 +70,11 @@ jobs:

- name: install tools
run: |
wget -O jextract.tar.gz https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_macos-aarch64_bin.tar.gz
wget -O jextract.tar.gz https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_linux-x64_bin.tar.gz
tar -xvzf jextract.tar.gz
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev
- name: install bake
run: |
git clone https://github.com/SanderMertens/bake
Expand All @@ -85,15 +89,14 @@ jobs:
run: |
bin/kaocha
build-windows:
runs-on: windows-latest
build-macos:
runs-on: macOS-latest
timeout-minutes: 30
strategy:
fail-fast: true

steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- uses: mlugg/setup-zig@v1

- name: Prepare java
Expand All @@ -109,20 +112,19 @@ jobs:

- name: install tools
run: |
curl -o jextract.tar.gz https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_windows-x64_bin.tar.gz
wget -O jextract.tar.gz https://download.java.net/java/early_access/jextract/22/5/openjdk-22-jextract+5-33_macos-aarch64_bin.tar.gz
tar -xvzf jextract.tar.gz
- name: install bake
run: |
git clone https://github.com/SanderMertens/bake
cd bake\build-Windows
nmake
cd ..
./bake setup --local
make -C bake/build-$(uname)
bake/bake setup
- name: compile and jextract native modules
run: bash -c "bin/ci.sh"
run: |
bin/ci.sh
- name: run test
run: |
bash -c "bin/kaocha"
bin/kaocha
8 changes: 8 additions & 0 deletions bin/ci_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -ex

git submodule update --init --recursive

export VYBE_JEXTRACT=jextract-22/bin/jextract
bin/jextract-libs.sh
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 010f44a

Please sign in to comment.