mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-12-27 08:01:04 +08:00
fc88fcde10
* Merge examples repo into library * Change grepTest to be more fault-tolerant * Update examples macro file * Exclude all Fortran examples from doxygen
72 lines
2.4 KiB
CMake
72 lines
2.4 KiB
CMake
cmake_minimum_required (VERSION 3.18)
|
|
project (HDF5_JAVA C Java)
|
|
|
|
set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR}")
|
|
find_package (Java)
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# Include some macros for reusable code
|
|
#-----------------------------------------------------------------------------
|
|
include (${HDF_RESOURCES_DIR}/UseJava.cmake)
|
|
|
|
message (VERBOSE "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}")
|
|
find_package (JNI)
|
|
message (VERBOSE "JNI_LIBRARIES=${JNI_LIBRARIES}")
|
|
message (VERBOSE "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
|
|
|
|
|
|
if (WIN32)
|
|
set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre")
|
|
else ()
|
|
set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre")
|
|
endif ()
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# Include the main src and config directories
|
|
#-----------------------------------------------------------------------------
|
|
set (HDF5_JAVA_INCLUDE_DIRECTORIES
|
|
${JNI_INCLUDE_DIRS}
|
|
${HDF5_JAVA_JNI_SRC_DIR}
|
|
${JAVA_INCLUDE_PATH}
|
|
${JAVA_INCLUDE_PATH2}
|
|
)
|
|
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_JAVA_INCLUDE_DIRECTORIES}")
|
|
|
|
set (CMAKE_JAVA_INCLUDE_PATH "")
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# Traverse source subdirectory
|
|
#-----------------------------------------------------------------------------
|
|
add_subdirectory (src)
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# Testing
|
|
#-----------------------------------------------------------------------------
|
|
if (NOT HDF5_EXTERNALLY_CONFIGURED AND BUILD_TESTING)
|
|
add_subdirectory (test)
|
|
endif ()
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# 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)
|
|
install (
|
|
DIRECTORY ${HDF_JRE_DIRECTORY}
|
|
DESTINATION ${HDF5_INSTALL_BIN_DIR}
|
|
USE_SOURCE_PERMISSIONS
|
|
)
|
|
endif ()
|