Skip to content

Commit

Permalink
Merge/update CMake, presets,java and tools (#3393)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Aug 21, 2023
1 parent 89b4afd commit ceef4a9
Show file tree
Hide file tree
Showing 238 changed files with 5,413 additions and 3,388 deletions.
7 changes: 3 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,18 @@ java/examples/testfiles/examples.intro.H5_CreateGroup.txt -text
java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt -text
java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt -text
java/examples/testfiles/examples.intro.H5_ReadWrite.txt -text
java/lib/ext/slf4j-nop-1.7.33.jar -text svneol=unset#application/zip
java/lib/ext/slf4j-simple-1.7.33.jar -text svneol=unset#application/zip
java/lib/ext/slf4j-nop-2.0.6.jar -text svneol=unset#application/zip
java/lib/ext/slf4j-simple-2.0.6.jar -text svneol=unset#application/zip
java/lib/hamcrest-core.jar -text svneol=unset#application/java-archive
java/lib/junit.jar -text svneol=unset#application/java-archive
java/lib/simplelogger.properties -text
java/lib/slf4j-api-1.7.33.jar -text svneol=unset#application/zip
java/lib/slf4j-api-2.0.6.jar -text svneol=unset#application/zip
java/src/CMakeLists.txt -text
java/src/Makefile.am -text
java/src/hdf/CMakeLists.txt -text
java/src/hdf/hdf5lib/CMakeLists.txt -text
java/src/hdf/hdf5lib/H5.java -text
java/src/hdf/hdf5lib/HDF5Constants.java -text
java/src/hdf/hdf5lib/HDF5GroupInfo.java -text
java/src/hdf/hdf5lib/HDFArray.java -text
java/src/hdf/hdf5lib/HDFNativeData.java -text
java/src/hdf/hdf5lib/callbacks/Callbacks.java -text
Expand Down
12 changes: 5 additions & 7 deletions CMakeFilters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
endif ()
if (SZIP_FOUND)
set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR})
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
endif ()
endif ()
if (SZIP_FOUND)
set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR})
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
endif ()
else ()
if (BUILD_SZIP_WITH_FETCHCONTENT)
Expand Down Expand Up @@ -200,8 +200,6 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME})
endif ()
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY})
else ()
message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5")
endif ()
endif ()
if (SZIP_FOUND)
Expand Down
48 changes: 25 additions & 23 deletions CMakeInstallation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ install (
option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF)
if (HDF5_PACK_EXAMPLES)
configure_file (
${HDF_RESOURCES_DIR}/HDF5_Examples.cmake.in
${HDF_RESOURCES_DIR}/examples/HDF5_Examples.cmake.in
${HDF5_BINARY_DIR}/HDF5_Examples.cmake @ONLY
)
install (
Expand All @@ -150,23 +150,27 @@ if (HDF5_PACK_EXAMPLES)
option (EXAMPLES_USE_RELEASE_NAME "Use the released examples artifact name" OFF)
option (EXAMPLES_DOWNLOAD "Download to use released examples files" OFF)
if (EXAMPLES_DOWNLOAD)
if (NOT EXAMPLES_USE_LOCALCONTENT)
set (EXAMPLES_URL ${EXAMPLES_TGZ_ORIGPATH}/${EXAMPLES_TGZ_ORIGNAME})
if (EXAMPLES_USE_RELEASE_NAME)
set (EXAMPLES_NAME ${EXAMPLES_TGZ_ORIGNAME})
else ()
set (EXAMPLES_URL ${TGZPATH}/${EXAMPLES_TGZ_ORIGNAME})
set (EXAMPLES_NAME ${HDF5_EXAMPLES_COMPRESSED})
endif ()
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Examples file is ${EXAMPLES_URL}")
if (NOT EXAMPLES_USE_LOCALCONTENT)
set (EXAMPLES_URL ${EXAMPLES_TGZ_ORIGPATH}/${EXAMPLES_NAME})
file (DOWNLOAD ${EXAMPLES_URL} ${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED} STATUS EX_DL)
message (STATUS "Examples file is ${EXAMPLES_URL} STATUS=${EX_DL}")
else ()
set (EXAMPLES_URL ${TGZPATH}/${EXAMPLES_NAME})
file (COPY_FILE ${EXAMPLES_URL} ${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED} RESULT EX_DL)
message (STATUS "Examples file is ${EXAMPLES_URL} RESULT=${EX_DL}")
endif ()
file (DOWNLOAD ${EXAMPLES_URL} ${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED})
if (EXISTS "${HDF5_BINARY_DIR}/${HDF5_EXAMPLES_COMPRESSED}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${HDF5_EXAMPLES_COMPRESSED}
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
COMMAND_ECHO STDOUT
)
endif ()
set (EXAMPLES_USE_RELEASE_NAME ON CACHE BOOL "" FORCE)
else ()
if (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}")
execute_process(
Expand All @@ -176,20 +180,18 @@ if (HDF5_PACK_EXAMPLES)
)
endif ()
endif ()
if (EXAMPLES_USE_RELEASE_NAME)
get_filename_component (EX_LAST_EXT ${HDF5_EXAMPLES_COMPRESSED} LAST_EXT)
if (${EX_LAST_EXT} STREQUAL ".zip")
get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE)
else ()
get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE)
get_filename_component (EX_DIR_NAME ${EX_DIR_NAME} NAME_WLE)
endif ()
execute_process(
COMMAND ${CMAKE_COMMAND} -E rename ${EX_DIR_NAME} HDF5Examples
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
COMMAND_ECHO STDOUT
)
get_filename_component (EX_LAST_EXT ${HDF5_EXAMPLES_COMPRESSED} LAST_EXT)
if (${EX_LAST_EXT} STREQUAL ".zip")
get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE)
else ()
get_filename_component (EX_DIR_NAME ${HDF5_EXAMPLES_COMPRESSED} NAME_WLE)
get_filename_component (EX_DIR_NAME ${EX_DIR_NAME} NAME_WLE)
endif ()
execute_process(
COMMAND ${CMAKE_COMMAND} -E rename ${EX_DIR_NAME} HDF5Examples
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
COMMAND_ECHO STDOUT
)
install (
DIRECTORY ${HDF5_BINARY_DIR}/HDF5Examples
DESTINATION ${HDF5_INSTALL_DATA_DIR}
Expand All @@ -204,13 +206,13 @@ if (HDF5_PACK_EXAMPLES)
)
install (
FILES
${HDF_RESOURCES_DIR}/CTestScript.cmake
${HDF_RESOURCES_DIR}/examples/CTestScript.cmake
DESTINATION ${HDF5_INSTALL_DATA_DIR}
COMPONENT hdfdocuments
)
install (
FILES
${HDF_RESOURCES_DIR}/HDF5_Examples_options.cmake
${HDF_RESOURCES_DIR}/examples/HDF5_Examples_options.cmake
DESTINATION ${HDF5_INSTALL_DATA_DIR}
COMPONENT hdfdocuments
)
Expand Down
27 changes: 13 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ set (HDF_CONFIG_DIR ${HDF5_SOURCE_DIR}/config)
set (HDF_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake)
set (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src)
set (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test)
set (HDF5_TEST_PAR_DIR ${HDF5_SOURCE_DIR}/testpar)
set (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++)
set (HDF5_CPP_TST_DIR ${HDF5_SOURCE_DIR}/c++/test)
set (HDF5_HL_SRC_DIR ${HDF5_SOURCE_DIR}/hl)
Expand All @@ -236,9 +237,9 @@ set (HDF5_JAVA_JNI_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/jni)
set (HDF5_JAVA_HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/hdf)
set (HDF5_JAVA_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/java/test)
set (HDF5_JAVA_LIB_DIR ${HDF5_SOURCE_DIR}/java/lib)
set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.33.jar)
set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.33.jar)
set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.33.jar)
set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-2.0.6.jar)
set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-2.0.6.jar)
set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-2.0.6.jar)
set (HDF5_DOXYGEN_DIR ${HDF5_SOURCE_DIR}/doxygen)

set (HDF5_SRC_INCLUDE_DIRS ${HDF5_SRC_DIR})
Expand Down Expand Up @@ -573,15 +574,6 @@ if (HDF5_ENABLE_COVERAGE)
endif ()
endif ()

#-----------------------------------------------------------------------------
# Option to indicate using dmalloc
#-----------------------------------------------------------------------------
# option (HDF5_ENABLE_USING_DMALLOC "Indicate that dmalloc is used" OFF)
# if (HDF5_ENABLE_USING_DMALLOC)
# find_package (DMALLOC)
# set (H5_HAVE_DMALLOC DMALLOC_FOUND)
# endif ()

#-----------------------------------------------------------------------------
# Option to indicate using a memory checker
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -661,6 +653,13 @@ if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer")
mark_as_advanced (HDF5_ENABLE_INSTRUMENT)
endif ()

#-----------------------------------------------------------------------------
# Add some definitions for Developer Builds
#-----------------------------------------------------------------------------
if (${HDF_CFG_NAME} MATCHES "Developer")
include (${HDF_RESOURCES_DIR}/HDF5DeveloperBuild.cmake)
endif ()

#-----------------------------------------------------------------------------
# Option to embed library info into executables
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -989,11 +988,11 @@ if (BUILD_TESTING)
mark_as_advanced (HDF5_TEST_JAVA)

if (NOT HDF5_EXTERNALLY_CONFIGURED)
if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test")
if (EXISTS "${HDF5_TEST_SRC_DIR}" AND IS_DIRECTORY "${HDF5_TEST_SRC_DIR}")
add_subdirectory (test)
endif ()
if (H5_HAVE_PARALLEL)
if (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar")
if (EXISTS "${HDF5_TEST_PAR_DIR}" AND IS_DIRECTORY "${HDF5_TEST_PAR_DIR}")
add_subdirectory (testpar)
endif ()
endif ()
Expand Down
72 changes: 46 additions & 26 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,35 @@
}
},
{
"name": "ci-StdCompression",
"name": "ci-CompressionVars",
"hidden": true,
"inherits": "ci-base-tgz",
"cacheVariables": {
"BUILD_ZLIB_WITH_FETCHCONTENT": "ON",
"ZLIB_PACKAGE_NAME": {"type": "STRING", "value": "zlib"},
"ZLIB_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/madler/zlib/releases/download/v1.2.13"},
"ZLIB_TGZ_ORIGNAME": {"type": "STRING", "value": "zlib-1.2.13.tar.gz"},
"ZLIB_USE_LOCALCONTENT": "OFF",
"BUILD_SZIP_WITH_FETCHCONTENT": "ON",
"LIBAEC_PACKAGE_NAME": {"type": "STRING", "value": "libaec"},
"LIBAEC_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/MathisRosenhauer/libaec/releases/download/v1.0.6"},
"LIBAEC_TGZ_ORIGNAME": {"type": "STRING", "value": "libaec-1.0.6.tar.gz"},
"LIBAEC_USE_LOCALCONTENT": "OFF"
"LIBAEC_TGZ_ORIGNAME": {"type": "STRING", "value": "libaec-1.0.6.tar.gz"}
}
},
{
"name": "ci-StdCompression",
"hidden": true,
"inherits": ["ci-base-tgz", "ci-CompressionVars"],
"cacheVariables": {
"HDF5_PACKAGE_EXTLIBS": "ON",
"ZLIB_USE_LOCALCONTENT": "OFF",
"LIBAEC_USE_LOCALCONTENT": "OFF",
"HDF5_ENABLE_SZIP_SUPPORT": "ON"
}
},
{
"name": "ci-base-plugins",
"hidden": true,
"inherits": "ci-base-tgz",
"cacheVariables": {
"PLUGIN_TGZ_NAME": {"type": "STRING", "value": "hdf5_plugins-1.14.0.tar.gz"},
"PLUGIN_TGZ_NAME": {"type": "STRING", "value": "hdf5_plugins.tar.gz"},
"PLUGIN_PACKAGE_NAME": {"type": "STRING", "value": "pl"},
"BSHUF_TGZ_NAME": {"type": "STRING", "value": "bitshuffle.tar.gz"},
"BSHUF_PACKAGE_NAME": {"type": "STRING", "value": "bshuf"},
Expand Down Expand Up @@ -63,32 +70,49 @@
}
},
{
"name": "ci-StdPlugins",
"name": "ci-PluginsVars",
"hidden": true,
"inherits": ["ci-base-plugins", "ci-base-tgz"],
"cacheVariables": {
"HDF5_ENABLE_PLUGIN_SUPPORT": "ON",
"PLUGIN_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5_plugins/archive/refs/tags"},
"PLUGIN_TGZ_ORIGNAME": {"type": "STRING", "value": "hdf5_plugins-1.14.0.tar.gz"}
"PLUGIN_TGZ_ORIGNAME": {"type": "STRING", "value": "hdf5_plugins-master.tar.gz"}
}
},
{
"name": "ci-StdExamples",
{
"name": "ci-StdPlugins",
"hidden": true,
"inherits": "ci-base",
"inherits": ["ci-base-plugins", "ci-PluginsVars", "ci-base-tgz"],
"cacheVariables": {
"HDF5_PACK_EXAMPLES": "ON",
"HDF5_EXAMPLES_COMPRESSED": {"type": "STRING", "value": "hdf5-examples-2.0.3.tar.gz"},
"H5PL_VERS_MAJOR": "1",
"H5PL_VERS_MINOR": "12",
"H5PL_VERS_RELEASE": "3"
}
},
{
"name": "ci-ExamplesVars",
"hidden": true,
"cacheVariables": {
"HDF5_EXAMPLES_COMPRESSED": {"type": "STRING", "value": "hdf5-examples-2.0.4.tar.gz"},
"HDF5_EXAMPLES_COMPRESSED_DIR": {"type": "STRING", "value": "${sourceParentDir}/temp"},
"EXAMPLES_TGZ_ORIGPATH": {"type": "STRING", "value": "https://github.com/HDFGroup/hdf5-examples/archive/refs/tags/"},
"EXAMPLES_TGZ_ORIGNAME": {"type": "STRING", "value": "2.0.3.tar.gz"},
"EXAMPLES_TGZ_ORIGNAME": {"type": "STRING", "value": "2.0.4.tar.gz"}
}
},
{
"name": "ci-StdExamples",
"hidden": true,
"inherits": ["ci-base", "ci-ExamplesVars", "ci-base-tgz"],
"cacheVariables": {
"EXAMPLES_USE_RELEASE_NAME": "ON",
"EXAMPLES_USE_LOCALCONTENT": "OFF",
"HDF5_PACK_EXAMPLES": "ON",
"EXAMPLES_DOWNLOAD": "ON"
}
},
{
{
"name": "ci-StdShar",
"hidden": true,
"inherits": "ci-StdCompression",
"inherits": ["ci-StdCompression", "ci-StdExamples"],
"cacheVariables": {
"HDF_PACKAGE_NAMESPACE": {"type": "STRING", "value": "hdf5::"},
"HDF5_INSTALL_MOD_FORTRAN": "NO",
Expand All @@ -105,8 +129,7 @@
"ci-x64-Release-MSVC",
"ci-CPP",
"ci-Java",
"ci-StdShar",
"ci-StdExamples"
"ci-StdShar"
]
},
{
Expand All @@ -117,8 +140,7 @@
"ci-CPP",
"ci-Fortran",
"ci-Java",
"ci-StdShar",
"ci-StdExamples"
"ci-StdShar"
]
},
{
Expand All @@ -129,8 +151,7 @@
"ci-CPP",
"ci-Fortran",
"ci-Java",
"ci-StdShar",
"ci-StdExamples"
"ci-StdShar"
]
},
{
Expand All @@ -141,8 +162,7 @@
"ci-CPP",
"ci-Fortran",
"ci-Java",
"ci-StdShar",
"ci-StdExamples"
"ci-StdShar"
]
}
],
Expand Down
30 changes: 30 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Scripts in `bin` and their purpose

Programs run via `autogen.sh` (or the equivalent in CMake) are indicated.

|Program|Purpose|
|-------|-------|
|`buildhdf5`|Convenience script to build HDF5 using the Autotools|
|`checkapi`|Checks if public API calls are used in internal functions|
|`chkcopyright`|Checks if files have appropriate copyright statements|
|`cmakehdf5`|Convenience script to build HDF5 using CMake|
|`debug-ohdr`|Examines debug output from `H5O_open/close` to look for open objects|
|`format_source`|Runs `clang-format` over the source files, applying our rules|
|`genparser`|Creates the flex/bison-based parser files in the high-level library|
|`h5cc.in`|Input file from which h5cc is created|
|`h5redeploy.in`|Input file from which h5redeploy is created|
|`h5vers`|Updates the library version number|
|`make_err`|Generates the H5E header files (called in `autogen.sh`)|
|`make_vers`|Generates H5version.h (called in `autogen.sh`)|
|`make_overflow`|Generates H5overflow.h (called in `autogen.sh`)|
|`output_filter`|Used in the tools test code to strip extraneous output before we diff files|
|`restore.sh`|Removes files generated by `autogen.sh`|
|`runbkprog`|Used by CMake to run test programs in the background|
|`switch_maint_mode`|Switches maintainer mode on/off in `configure.ac`|
|`trace`|Adds `TRACE` macros to HDF5 C library source files (run by `autogen.sh`)|
|`warnhist`|Generates compiler warning statistics for gcc/clang when fed output of make|

## TODO

* chkcopyright is currently semi-broken as it doesn't handle the full variety of copyright headers we need. We're leaving it in place, though, in the hopes that someone will update it in the future.
* Extending warnhist to better understand the output of additional compilers/languages would be nice.
Loading

0 comments on commit ceef4a9

Please sign in to comment.