Skip to content

Commit

Permalink
Remove imgui and use vybe_native + resources/vybe/native
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeodrippe committed Oct 22, 2024
1 parent ab5baab commit fad5739
Show file tree
Hide file tree
Showing 227 changed files with 187 additions and 192,680 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- '**/README.md'
- '**/CHANGELOG.md'

env:
VYBE_DEBUG: true

jobs:
build-windows:
runs-on: windows-latest
Expand All @@ -16,7 +19,6 @@ jobs:
fail-fast: true
env:
VYBE_VERSION_SUFFIX: win-x64
# VYBE_DEBUG: true

steps:
- uses: actions/checkout@v4
Expand All @@ -42,7 +44,7 @@ jobs:
working-directory: JoltPhysicsSharp
run: |
cmake --build build_win_64 --config Distribution
bash -c "cp build_win_64/bin/Distribution/joltc.dll ../native/joltc_zig.dll"
bash -c "cp build_win_64/bin/Distribution/joltc.dll ../resources/vybe/native/joltc_zig.dll"
- name: Prepare java
uses: actions/setup-java@v3
Expand Down Expand Up @@ -96,16 +98,16 @@ jobs:
run: |
bash -c "bin/ci_windows.sh"
clojure -T:build compile-app
dir native
dir resources/vybe/native
- name: run tests
run: |
clojure -M:dev:win -m vybe.native.loader && clojure -M:test:win
- name: build
run: |
bash -c "rm -rf native/macos"
bash -c "rm -rf native/windows"
bash -c "rm -rf resources/vybe/native/macos"
bash -c "rm -rf resources/vybe/native/windows"
clojure -T:build jar
bash -c "bin/ci_windows_build.sh"
Expand Down Expand Up @@ -162,7 +164,7 @@ jobs:
- name: compile and jextract native modules
run: |
bin/ci.sh
ls native
ls resources/vybe/native
- name: run tests
run: |
Expand All @@ -171,8 +173,8 @@ jobs:
- name: build
run: |
rm -rf native/macos
rm -rf native/windows
rm -rf resources/vybe/native/macos
rm -rf resources/vybe/native/windows
bin/ci_build.sh
ls -lh target
Expand Down Expand Up @@ -229,16 +231,16 @@ jobs:
- name: compile and jextract native modules
run: |
bin/ci.sh
ls native
ls resources/vybe/native
- name: run tests
run: |
bin/kaocha
- name: build
run: |
rm -rf native/macos
rm -rf native/windows
rm -rf resources/vybe/native/macos
rm -rf resources/vybe/native/windows
bin/ci_build.sh
ls -lh target
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ libsodium-1.0.20/
*zig-out*
.vscode

native/*.zip
native/macos
native/windows
vybe_native/*.zip
vybe_native/macos
vybe_native/windows

resources/vybe/native/*.zip
resources/vybe/native/macos
resources/vybe/native/windows
18 changes: 9 additions & 9 deletions bin/jextract-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ rm -rf src-java/org/vybe/netcode
cd zig_src && zig build run --summary all && zig build --summary all
cd -
if [[ $VYBE_EXTENSION == "dll" ]]; then
cp "zig_src/zig-out/bin/${VYBE_LIB_PREFIX}zig_vybe.dll" native/zig_vybe.dll
cp "zig_src/zig-out/bin/${VYBE_LIB_PREFIX}zig_vybe.dll" resources/vybe/native/zig_vybe.dll
else
cp "zig_src/zig-out/lib/${VYBE_LIB_PREFIX}zig_vybe.$VYBE_EXTENSION" native
cp "zig_src/zig-out/lib/${VYBE_LIB_PREFIX}zig_vybe.$VYBE_EXTENSION" resources/vybe/native
fi

# -- Netcode and Cute net
Expand All @@ -88,7 +88,7 @@ $VYBE_GCC \
-shared \
bin/vybe_cutenet.c \
-I cute_headers \
-o "native/${VYBE_LIB_PREFIX}vybe_cutenet.$VYBE_EXTENSION" $VYBE_GCC_END
-o "resources/vybe/native/${VYBE_LIB_PREFIX}vybe_cutenet.$VYBE_EXTENSION" $VYBE_GCC_END

# As the generated java code is huge by default because of some transitive libs,
# we have to filter it. So we do a jextract dump.
Expand Down Expand Up @@ -120,13 +120,13 @@ else
$VYBE_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"
cp "zig-gamedev/libs/zphysics/zig-out/lib/${VYBE_LIB_PREFIX}joltc.$VYBE_JOLT_EXTENSION" "resources/vybe/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
-o "resources/vybe/native/${VYBE_LIB_PREFIX}vybe_jolt.$VYBE_EXTENSION" $VYBE_GCC_JOLT

$VYBE_JEXTRACT \
--use-system-load-library \
Expand All @@ -144,14 +144,14 @@ cd raylib/src && \
make clean && \
RAYLIB_LIBTYPE=SHARED RAYMATH_IMPLEMENTATION=TRUE make PLATFORM=PLATFORM_DESKTOP RAYLIB_MODULE_RAYGUI=TRUE && \
cd - && \
cp "raylib/src/${VYBE_LIB_PREFIX}raylib.$VYBE_EXTENSION" native
cp "raylib/src/${VYBE_LIB_PREFIX}raylib.$VYBE_EXTENSION" resources/vybe/native

$VYBE_GCC \
-shared \
bin/vybe_raylib.c \
-I raylib/src \
-I raygui/src \
-o "native/${VYBE_LIB_PREFIX}vybe_raylib.$VYBE_EXTENSION" $VYBE_GCC_END $VYBE_GCC_RAYLIB
-o "resources/vybe/native/${VYBE_LIB_PREFIX}vybe_raylib.$VYBE_EXTENSION" $VYBE_GCC_END $VYBE_GCC_RAYLIB

if [[ $VYBE_EXTENSION == "dll" ]]; then
# As the generated java code is huge by default because of some transitive libs,
Expand Down Expand Up @@ -217,7 +217,7 @@ $VYBE_GCC \
bin/vybe_flecs.c \
bin/flecs.c \
-I raylib/src \
-o "native/${VYBE_LIB_PREFIX}vybe_flecs.$VYBE_EXTENSION" $VYBE_GCC_END
-o "resources/vybe/native/${VYBE_LIB_PREFIX}vybe_flecs.$VYBE_EXTENSION" $VYBE_GCC_END

$VYBE_JEXTRACT \
--use-system-load-library \
Expand All @@ -227,4 +227,4 @@ $VYBE_JEXTRACT \
--header-class-name flecs \
-t org.vybe.flecs bin/vybe_flecs.c

ls -lh native
ls -lh resources/vybe/native
3 changes: 3 additions & 0 deletions bin/vybe_flecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ ecs_entity_t vybe_pair_first(const ecs_world_t *world, ecs_entity_t pair);
ecs_entity_t vybe_pair_second(const ecs_world_t *world, ecs_entity_t pair);
void vybe_rest_enable(ecs_world_t *world);

// Zig.
void vybe_default_systems(ecs_world_t *world);
void vybe_setup_allocator(void);

// Tests.
int vybe__test__rest_issue(bool is_rest_enabled);

// -- Pair.
Expand Down
4 changes: 2 additions & 2 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@

;; Prebuilt native libs for SC from Sonic PI.
(b/zip {:src-dirs ["sonic-pi/prebuilt"]
:zip-file "native/vybe-sc-prebuilt.zip"})
:zip-file "resources/vybe/native/vybe-sc-prebuilt.zip"})

#_(b/unzip {:target-dir "test44"
:zip-file "a.zip"})

;; Clojure.
(b/copy-dir {:src-dirs ["src"
"resources"
"native"
#_"vybe_native"
;; `.sounds` contains the files that will be used
;; for the build.
;; curl https://keymusician01.s3.amazonaws.com/FluidR3_GM.zip --output FluidR3_GM.zip
Expand Down
8 changes: 4 additions & 4 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.3.4"}
nubank/matcher-combinators {:mvn/version "3.9.1"}}}

:win {:jvm-opts ["-Djava.library.path=native"
:win {:jvm-opts ["-Djava.library.path=vybe_native"
"-XX:+CreateCoredumpOnCrash"

;; For tracing panama calls.
Expand All @@ -65,7 +65,7 @@
com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.3.4"}
nubank/matcher-combinators {:mvn/version "3.9.1"}}}

:osx {:jvm-opts ["-Djava.library.path=native"
:osx {:jvm-opts ["-Djava.library.path=vybe_native"
"--enable-native-access=ALL-UNNAMED"
"-XX:+CreateCoredumpOnCrash"

Expand All @@ -79,7 +79,7 @@
com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.3.4"}
nubank/matcher-combinators {:mvn/version "3.9.1"}}}

:linux {:jvm-opts ["-Djava.library.path=native"
:linux {:jvm-opts ["-Djava.library.path=vybe_native"
"--enable-native-access=ALL-UNNAMED"
"-XX:+CreateCoredumpOnCrash"

Expand All @@ -91,4 +91,4 @@
com.clojure-goes-fast/clj-java-decompiler {:mvn/version "0.3.4"}
nubank/matcher-combinators {:mvn/version "3.9.1"}}}}

:paths ["src" "resources" "native" ".sounds" "target/classes"]}
:paths ["src" "resources" "vybe_native" "target/classes"]}
File renamed without changes.
13 changes: 11 additions & 2 deletions src-java/org/vybe/flecs/flecs.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ public class flecs extends flecs_1 {
flecs() {
// Should not be called directly
}
private static final int EcsTableHasChildOf = (int)16L;
/**
* {@snippet lang=c :
* #define EcsTableHasChildOf 16
* }
*/
public static int EcsTableHasChildOf() {
return EcsTableHasChildOf;
}
private static final int EcsTableHasName = (int)32L;
/**
* {@snippet lang=c :
Expand Down Expand Up @@ -346,13 +355,13 @@ public static long __DARWIN_C_LEVEL() {
}
/**
* {@snippet lang=c :
* #define __ASSERT_FILE_NAME "jextract$3959134394440914539.h"
* #define __ASSERT_FILE_NAME "jextract$1478227454700441721.h"
* }
*/
public static MemorySegment __ASSERT_FILE_NAME() {
class Holder {
static final MemorySegment __ASSERT_FILE_NAME
= flecs.LIBRARY_ARENA.allocateFrom("jextract$3959134394440914539.h");
= flecs.LIBRARY_ARENA.allocateFrom("jextract$1478227454700441721.h");
}
return Holder.__ASSERT_FILE_NAME;
}
Expand Down
64 changes: 55 additions & 9 deletions src-java/org/vybe/flecs/flecs_1.java
Original file line number Diff line number Diff line change
Expand Up @@ -44915,6 +44915,61 @@ public static void vybe_default_systems(MemorySegment world) {
}
}

private static class vybe_setup_allocator {
public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( );

public static final MemorySegment ADDR = flecs.findOrThrow("vybe_setup_allocator");

public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC);
}

/**
* Function descriptor for:
* {@snippet lang=c :
* void vybe_setup_allocator()
* }
*/
public static FunctionDescriptor vybe_setup_allocator$descriptor() {
return vybe_setup_allocator.DESC;
}

/**
* Downcall method handle for:
* {@snippet lang=c :
* void vybe_setup_allocator()
* }
*/
public static MethodHandle vybe_setup_allocator$handle() {
return vybe_setup_allocator.HANDLE;
}

/**
* Address for:
* {@snippet lang=c :
* void vybe_setup_allocator()
* }
*/
public static MemorySegment vybe_setup_allocator$address() {
return vybe_setup_allocator.ADDR;
}

/**
* {@snippet lang=c :
* void vybe_setup_allocator()
* }
*/
public static void vybe_setup_allocator() {
var mh$ = vybe_setup_allocator.HANDLE;
try {
if (TRACE_DOWNCALLS) {
traceDowncall("vybe_setup_allocator");
}
mh$.invokeExact();
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}

private static class vybe__test__rest_issue {
public static final FunctionDescriptor DESC = FunctionDescriptor.of(
flecs.C_INT,
Expand Down Expand Up @@ -46103,14 +46158,5 @@ public static int EcsTableIsPrefab() {
public static int EcsTableHasIsA() {
return EcsTableHasIsA;
}
private static final int EcsTableHasChildOf = (int)16L;
/**
* {@snippet lang=c :
* #define EcsTableHasChildOf 16
* }
*/
public static int EcsTableHasChildOf() {
return EcsTableHasChildOf;
}
}

26 changes: 0 additions & 26 deletions src-java/org/vybe/imgui/ImBitArrayForNamedKeys.java

This file was deleted.

Loading

0 comments on commit fad5739

Please sign in to comment.