summaryrefslogtreecommitdiffstats
path: root/config/cmake
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-03-12 17:07:51 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-03-12 17:07:51 (GMT)
commit48eaac202950cac1060499792d3a6faea20cc1ce (patch)
treee671814d2ab1cef5a1f440f3f84e3f0adee53c75 /config/cmake
parent0c3fc6836345e2b4f63a8f59ec7c3b13d7bf920b (diff)
parent64565f9771a50138e77a806d7ab330e3919c1847 (diff)
downloadhdf5-48eaac202950cac1060499792d3a6faea20cc1ce.zip
hdf5-48eaac202950cac1060499792d3a6faea20cc1ce.tar.gz
hdf5-48eaac202950cac1060499792d3a6faea20cc1ce.tar.bz2
Merge branch 'develop' into hdf5_1_10_merge
Diffstat (limited to 'config/cmake')
-rwxr-xr-xconfig/cmake/CTestScript.cmake2
-rw-r--r--config/cmake/HDF518_Examples.cmake.in2
-rw-r--r--config/cmake/HDF5_Examples.cmake.in2
-rw-r--r--config/cmake/UseJava.cmake74
-rwxr-xr-xconfig/cmake/scripts/CTestScript.cmake2
-rwxr-xr-xconfig/cmake/scripts/HDF5config.cmake2
6 files changed, 78 insertions, 6 deletions
diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake
index 27ae3a0..0269ba8 100755
--- a/config/cmake/CTestScript.cmake
+++ b/config/cmake/CTestScript.cmake
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
########################################################
# For any comments please contact cdashhelp@hdfgroup.org
#
diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in
index 0e81217..1f4f479 100644
--- a/config/cmake/HDF518_Examples.cmake.in
+++ b/config/cmake/HDF518_Examples.cmake.in
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
###############################################################################################################
# This script will build and run the examples from a folder
# Execute from a command line:
diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in
index 6453b16..eb57685 100644
--- a/config/cmake/HDF5_Examples.cmake.in
+++ b/config/cmake/HDF5_Examples.cmake.in
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
###############################################################################################################
# This script will build and run the examples from a folder
# Execute from a command line:
diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake
index c70f52e..60b1758 100644
--- a/config/cmake/UseJava.cmake
+++ b/config/cmake/UseJava.cmake
@@ -19,6 +19,7 @@
# [VERSION version]
# [OUTPUT_NAME name]
# [OUTPUT_DIR dir]
+# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
# )
#
# This command creates a <target_name>.jar. It compiles the given
@@ -34,6 +35,14 @@
# The default OUTPUT_DIR can also be changed by setting the variable
# CMAKE_JAVA_TARGET_OUTPUT_DIR.
#
+# Optionally, using option GENERATE_NATIVE_HEADERS, native header files can be generated
+# for methods declared as native. These files provide the connective glue that allow your
+# Java and C code to interact. An INTERFACE target will be created for an easy usage
+# of generated files. Sub-option DESTINATION can be used to specify output directory for
+# generated header files.
+#
+# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
+#
# Additional instructions:
#
# ::
@@ -167,6 +176,22 @@
#
#
#
+# ::
+#
+# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
+# include module JNI before any call to add_jar. The produced target for native
+# headers can then be used to compile C/C++ sources with command
+# target_link_libraries.
+#
+#
+# ::
+#
+# find_package(JNI)
+# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
+# add_library(bar bar.cpp)
+# target_link_libraries(bar PRIVATE foo-native)
+#
+#
# Target Properties:
#
# ::
@@ -358,6 +383,10 @@
# Create C header files from java classes. These files provide the connective glue
# that allow your Java and C code to interact.
#
+# This command will no longer be supported starting with version 1.10 of the JDK due
+# to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
+# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
+#
# There are two main signatures for create_javah. The first signature
# returns generated files through variable specified by GENERATED_FILES option:
#
@@ -449,7 +478,7 @@ function(add_jar _TARGET_NAME)
cmake_parse_arguments(_add_jar
""
"VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
- "SOURCES;INCLUDE_JARS"
+ "SOURCES;INCLUDE_JARS;GENERATE_NATIVE_HEADERS"
${ARGN}
)
@@ -495,6 +524,31 @@ function(add_jar _TARGET_NAME)
get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE)
endif ()
+ unset (_GENERATE_NATIVE_HEADERS)
+ if (_add_jar_GENERATE_NATIVE_HEADERS)
+ # Raise an error if JDK version is less than 1.8 because javac -h is not supported
+ # by earlier versions.
+ if ("${Java_VERSION}" VERSION_LESS 1.8)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS is not supported with this version of Java.")
+ endif()
+ cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS "" "DESTINATION" "" ${_add_jar_GENERATE_NATIVE_HEADERS})
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: missing required argument.")
+ endif()
+ list (LENGTH _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS length)
+ if (length GREATER 1)
+ list (REMOVE_AT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS 0)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS}: unexpected argument(s).")
+ endif()
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION)
+ set (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers")
+ endif()
+
+ set (_GENERATE_NATIVE_HEADERS_TARGET ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS})
+ set (_GENERATE_NATIVE_HEADERS_OUTPUT_DIR "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}")
+ set (_GENERATE_NATIVE_HEADERS -h "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else ()
@@ -626,6 +680,7 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_COMPILE_FLAGS}
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ ${_GENERATE_NATIVE_HEADERS}
${_JAVA_SOURCES_FILELISTS}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
@@ -736,6 +791,17 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_CLASS_OUTPUT_PATH}
)
+ if (_GENERATE_NATIVE_HEADERS)
+ # create an INTERFACE library encapsulating include directory for generated headers
+ add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE)
+ target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}"
+ ${JNI_INCLUDE_DIRS})
+ # this INTERFACE library depends on jar generation
+ add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
+
+ set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
endfunction()
function(INSTALL_JAR _TARGET_NAME)
@@ -1307,6 +1373,12 @@ function(create_javadoc _target)
endfunction()
function (create_javah)
+ if ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.10)
+ message (FATAL_ERROR "create_javah: not supported with this Java version. Use add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ elseif ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.8)
+ message (DEPRECATION "create_javah: this command will no longer be supported starting with version 1.10 of JDK. Update your project by using command add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ endif()
+
cmake_parse_arguments(_create_javah
""
"TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake
index cfad6f1..670196b 100755
--- a/config/cmake/scripts/CTestScript.cmake
+++ b/config/cmake/scripts/CTestScript.cmake
@@ -9,7 +9,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
########################################################
# This dashboard is maintained by The HDF Group
# For any comments please contact cdashhelp@hdfgroup.org
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index 8f219f3..3dddbca 100755
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -15,7 +15,7 @@
### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
#############################################################################################
-cmake_minimum_required (VERSION 3.3.2 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.10)
############################################################################
# Usage:
# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log