summaryrefslogtreecommitdiffstats
path: root/java/src/jni/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/jni/CMakeLists.txt')
-rw-r--r--java/src/jni/CMakeLists.txt84
1 files changed, 84 insertions, 0 deletions
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
new file mode 100644
index 0000000..6ee56c8
--- /dev/null
+++ b/java/src/jni/CMakeLists.txt
@@ -0,0 +1,84 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_JAVA_JNI C CXX)
+
+set (HDF5_JAVA_JNI_CSRCS
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5aImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Constants.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5dImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5eImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Imp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.c
+)
+
+set (HDF5_JAVA_JNI_CHDRS
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5aImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5dImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5eImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5jni.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h
+)
+
+INCLUDE_DIRECTORIES( ${HDF5_JAVA_JNI_SOURCE_DIR} )
+
+set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+
+########### JNI libraries always must be built shared ###############
+add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS})
+TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED " " " ")
+target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_LIB_TARGET})
+set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
+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 ${HDF5_JAVA_PACKAGE_SOVERSION})
+if (WIN32)
+ get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE)
+ # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}")
+ if (BUILD_TESTING)
+ add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
+ )
+ add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET})
+ endif (BUILD_TESTING)
+endif (WIN32)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+if (HDF5_EXPORTED_TARGETS)
+ install (
+ TARGETS
+ ${HDF5_JAVA_JNI_LIB_TARGET}
+ EXPORT
+ ${HDF5_JAVA_EXPORTED_TARGETS}
+ LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries
+ ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries
+ RUNTIME DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries
+ FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries
+ )
+endif (HDF5_EXPORTED_TARGETS)