2018-03-10 02:31:58 +08:00
|
|
|
cmake_minimum_required (VERSION 3.10)
|
2018-04-20 23:11:55 +08:00
|
|
|
project (HDF5_JAVA C Java)
|
2016-02-29 10:43:00 +08:00
|
|
|
|
|
|
|
set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}")
|
|
|
|
find_package (Java)
|
2018-04-20 23:11:55 +08:00
|
|
|
|
2016-02-29 10:43:00 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Include some macros for reusable code
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
include (${HDF_RESOURCES_DIR}/UseJava.cmake)
|
|
|
|
|
|
|
|
message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}")
|
|
|
|
find_package (JNI)
|
2019-05-18 04:14:20 +08:00
|
|
|
message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
|
|
|
|
message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
|
2016-02-29 10:43:00 +08:00
|
|
|
|
|
|
|
|
2016-08-02 01:35:00 +08:00
|
|
|
if (WIN32)
|
|
|
|
set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8")
|
2017-01-11 07:09:53 +08:00
|
|
|
else ()
|
2016-08-02 01:35:00 +08:00
|
|
|
set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre")
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2016-08-02 01:35:00 +08:00
|
|
|
|
2016-02-29 10:43:00 +08:00
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Include the main src and config directories
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
set (HDF5_JAVA_INCLUDE_DIRECTORIES
|
2018-04-18 04:57:51 +08:00
|
|
|
${JNI_INCLUDE_DIRS}
|
2016-02-29 10:43:00 +08:00
|
|
|
${HDF5_JAVA_JNI_SRC_DIR}
|
|
|
|
${JAVA_INCLUDE_PATH}
|
|
|
|
${JAVA_INCLUDE_PATH2}
|
|
|
|
)
|
2018-04-18 04:57:51 +08:00
|
|
|
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_JAVA_INCLUDE_DIRECTORIES}")
|
2016-02-29 10:43:00 +08:00
|
|
|
|
2018-04-20 23:11:55 +08:00
|
|
|
set (CMAKE_JAVA_INCLUDE_PATH "")
|
2016-02-29 10:43:00 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Traverse source subdirectory
|
|
|
|
#-----------------------------------------------------------------------------
|
2018-01-31 02:21:01 +08:00
|
|
|
add_subdirectory (src)
|
2016-02-29 10:43:00 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Build the Java Examples
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
if (HDF5_BUILD_EXAMPLES)
|
2018-01-31 02:21:01 +08:00
|
|
|
add_subdirectory (examples)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2016-02-29 10:43:00 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Testing
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
if (BUILD_TESTING)
|
2018-01-31 02:21:01 +08:00
|
|
|
add_subdirectory (test)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|
2016-02-29 10:43:00 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add Required Jar(s)
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
install (
|
|
|
|
FILES
|
|
|
|
${HDF5_JAVA_LOGGING_JAR}
|
|
|
|
${HDF5_JAVA_LOGGING_NOP_JAR}
|
|
|
|
${HDF5_JAVA_LOGGING_SIMPLE_JAR}
|
|
|
|
DESTINATION ${HDF5_INSTALL_JAR_DIR}
|
|
|
|
COMPONENT libraries
|
|
|
|
)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Option to include jre
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
option (HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF)
|
|
|
|
if (HDF5_JAVA_PACK_JRE)
|
2016-08-02 01:35:00 +08:00
|
|
|
install (
|
|
|
|
DIRECTORY ${HDF_JRE_DIRECTORY}
|
|
|
|
DESTINATION ${HDF5_INSTALL_BIN_DIR}
|
|
|
|
USE_SOURCE_PERMISSIONS
|
|
|
|
)
|
2017-01-11 07:09:53 +08:00
|
|
|
endif ()
|