summaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2021-07-01 23:52:04 (GMT)
committerQuincey Koziol <koziol@lbl.gov>2021-07-01 23:52:04 (GMT)
commit682fc6ba3af245cc44de9ca5e9b35527460c512a (patch)
tree1f44496a052568150f338404b34db1fdd8964a3f /java/src
parent8c4af2a23ef3e512507e1fdef7624f7a1fb2ab25 (diff)
downloadhdf5-682fc6ba3af245cc44de9ca5e9b35527460c512a.zip
hdf5-682fc6ba3af245cc44de9ca5e9b35527460c512a.tar.gz
hdf5-682fc6ba3af245cc44de9ca5e9b35527460c512a.tar.bz2
Jordan's patch to add test library to java builds
Diffstat (limited to 'java/src')
-rw-r--r--java/src/jni/CMakeLists.txt20
-rw-r--r--java/src/jni/Makefile.am13
-rw-r--r--java/src/jni/h5jni_test.c54
-rw-r--r--java/src/jni/h5jni_test.h34
4 files changed, 119 insertions, 2 deletions
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index ab306ef..dff0a88 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -73,6 +73,14 @@ set (HDF5_JAVA_JNI_CHDRS
${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h
)
+set (HDF5_JAVA_TEST_CSRCS
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5jni_test.c
+)
+
+set (HDF5_JAVA_TEST_CHDRS
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5jni_test.h
+)
+
set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
########### JNI libraries always must be built shared ###############
@@ -87,6 +95,18 @@ set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/j
SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA")
+# Build Testing library
+add_library (${HDF5_JAVA_JNI_TEST_LIB_TARGET} SHARED ${HDF5_JAVA_TEST_CSRCS} ${HDF5_JAVA_TEST_CHDRS})
+target_include_directories (${HDF5_JAVA_JNI_TEST_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+)
+target_compile_options(${HDF5_JAVA_JNI_TEST_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_TEST_LIB_TARGET} SHARED)
+target_link_libraries (${HDF5_JAVA_JNI_TEST_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET} ${HDF5_JAVA_JNI_LIB_TARGET})
+set_target_properties (${HDF5_JAVA_JNI_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
+#SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_TEST_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_TEST_LIB_TARGET} ${HDF5_JAVA_JNI_TEST_LIB_NAME} SHARED "JAVA")
+
#-----------------------------------------------------------------------------
# Add Target to clang-format
#-----------------------------------------------------------------------------
diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am
index bf086d2..d17d3d1 100644
--- a/java/src/jni/Makefile.am
+++ b/java/src/jni/Makefile.am
@@ -25,12 +25,15 @@ JAVA_API=yes
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/java/src/jni $(JNIFLAGS)
# This is our main target
-lib_LTLIBRARIES=libhdf5_java.la
+lib_LTLIBRARIES=libhdf5_java.la libhdf5_java_test.la
# Add libtool numbers to the HDF5 Java (JNI) library (from config/lt_vers.am)
libhdf5_java_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $(LT_JAVA_VERS_INTERFACE):$(LT_JAVA_VERS_REVISION):$(LT_JAVA_VERS_AGE) $(AM_LDFLAGS)
-# Source files for the library
+# Add libtool numbers to the HDF5 Java (JNI) library (from config/lt_vers.am)
+libhdf5_java_test_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $(LT_JAVA_VERS_INTERFACE):$(LT_JAVA_VERS_REVISION):$(LT_JAVA_VERS_AGE) $(AM_LDFLAGS)
+
+# Source files for the main Java library
libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \
h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \
h5pImp.c h5pACPLImp.c h5pDAPLImp.c h5pDCPLImp.c h5pDXPLImp.c \
@@ -38,7 +41,13 @@ libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp
h5pOCPLImp.c h5pOCpyPLImp.c h5pStrCPLImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c \
h5vlImp.c h5zImp.c
+# Source files for the Java testing library
+libhdf5_java_test_la_SOURCES=h5jni_test.c
+
# HDF5 Java (JNI) library depends on HDF5 Library.
libhdf5_java_la_LIBADD=$(LIBHDF5)
+# HDF5 Java (JNI) Testing library depends on HDF5 Library and Java Library.
+libhdf5_java_test_la_LIBADD=$(LIBHDF5) libhdf5_java.la
+
include $(top_srcdir)/config/conclude.am
diff --git a/java/src/jni/h5jni_test.c b/java/src/jni/h5jni_test.c
new file mode 100644
index 0000000..9929148
--- /dev/null
+++ b/java/src/jni/h5jni_test.c
@@ -0,0 +1,54 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <jni.h>
+#include <stdlib.h>
+#include "hdf5.h"
+#include "H5VLprivate.h"
+#include "h5jni.h"
+#include "h5jni_test.h"
+
+/*
+ * Class: test_H5TestUtils
+ * Method: H5VLfapl_is_native
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_test_H5TestUtils_H5VLfapl_1is_1native(JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hbool_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5VL_fapl_is_native((hid_t)fapl_id, &bval) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return (jboolean)bval;
+}
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
diff --git a/java/src/jni/h5jni_test.h b/java/src/jni/h5jni_test.h
new file mode 100644
index 0000000..9f1968b
--- /dev/null
+++ b/java/src/jni/h5jni_test.h
@@ -0,0 +1,34 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <jni.h>
+/* Header for HDF5 JNI test routines */
+
+#ifndef Included_h5jni_test
+#define Included_h5jni_test
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: test_H5TestUtils
+ * Method: H5VLfapl_is_native
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_test_H5TestUtils_H5VLfapl_1is_1native(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* Included_h5jni_test */