From 5b3a1cba51ec28709b30c59e6cd2331b868373b9 Mon Sep 17 00:00:00 2001 From: stephengold Date: Fri, 28 Jun 2024 14:15:21 -0700 Subject: [PATCH] Jolt: add the buildType() method --- .../com/github/stephengold/joltjni/Jolt.java | 7 +++++++ .../glue/com_github_stephengold_joltjni_Jolt.cpp | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/com/github/stephengold/joltjni/Jolt.java b/src/main/java/com/github/stephengold/joltjni/Jolt.java index 811402cd..f184edaa 100644 --- a/src/main/java/com/github/stephengold/joltjni/Jolt.java +++ b/src/main/java/com/github/stephengold/joltjni/Jolt.java @@ -38,6 +38,13 @@ private Jolt() { // ************************************************************************* // new methods exposed + /** + * Return the jolt-jni build-type string. + * + * @return either "Debug" or "Release" + */ + final native public static String buildType(); + /** * Destroy the factory for deserialization of saved data. * diff --git a/src/main/native/glue/com_github_stephengold_joltjni_Jolt.cpp b/src/main/native/glue/com_github_stephengold_joltjni_Jolt.cpp index 20e77e7e..0d141ed0 100644 --- a/src/main/native/glue/com_github_stephengold_joltjni_Jolt.cpp +++ b/src/main/native/glue/com_github_stephengold_joltjni_Jolt.cpp @@ -33,6 +33,22 @@ SOFTWARE. using namespace JPH; +/* + * Class: com_github_stephengold_joltjni_Jolt + * Method: buildType + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_github_stephengold_joltjni_Jolt_buildType + (JNIEnv *pEnv, jclass) { + jstring result; +#ifdef JPH_ENABLE_ASSERTS + result = pEnv->NewStringUTF("Debug"); +#else + result = pEnv->NewStringUTF("Release"); +#endif // JPH_ENABLE_ASSERTS + return result; +} + /* * Class: com_github_stephengold_joltjni_Jolt * Method: destroyFactory