summaryrefslogtreecommitdiffstats
path: root/hl/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-06-20 11:55:05 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-06-20 11:55:05 (GMT)
commit7ee92d580510a7d90db7f3be8d2061c9c8f09a1b (patch)
treee810e42048e557b954b713185c40793938f8d375 /hl/tools
parentc2a744995125e308f1a37d6daaa9749126cf9f60 (diff)
downloadhdf5-7ee92d580510a7d90db7f3be8d2061c9c8f09a1b.zip
hdf5-7ee92d580510a7d90db7f3be8d2061c9c8f09a1b.tar.gz
hdf5-7ee92d580510a7d90db7f3be8d2061c9c8f09a1b.tar.bz2
HDFFV-10805 Merge SHARED ONLY option from develop
Diffstat (limited to 'hl/tools')
-rw-r--r--hl/tools/gif2h5/CMakeLists.txt65
-rw-r--r--hl/tools/gif2h5/CMakeTests.cmake16
-rw-r--r--hl/tools/h5watch/CMakeLists.txt56
-rw-r--r--hl/tools/h5watch/CMakeTests.cmake15
4 files changed, 111 insertions, 41 deletions
diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt
index a27ab18..14a5f5f 100644
--- a/hl/tools/gif2h5/CMakeLists.txt
+++ b/hl/tools/gif2h5/CMakeLists.txt
@@ -14,24 +14,58 @@ set (GIF2H5_SOURCES
)
#-- Add gif2hdf5 program
-add_executable (gif2h5 ${GIF2H5_SOURCES})
-target_include_directories(gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (gif2h5 STATIC)
-target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (gif2h5 ${GIF2H5_SOURCES})
+ target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (gif2h5 STATIC)
+ target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5")
+ set (H5_DEP_EXECUTABLES
+ gif2h5
+ )
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ add_executable (gif2h5-shared ${GIF2H5_SOURCES})
+ target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (gif2h5-shared SHARED)
+ target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (gif2h5-shared PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ gif2h5-shared
+ )
+endif ()
#-- Add h52gif program
set (hdf2gif_SOURCES
${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdf2gif.c
${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c
)
-add_executable (h52gif ${hdf2gif_SOURCES})
-target_include_directories(h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h52gif STATIC)
-target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
-set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif")
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h52gif ${hdf2gif_SOURCES})
+ target_include_directories (h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h52gif STATIC)
+ target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h52gif PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h52gif
+ )
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ add_executable (h52gif-shared ${hdf2gif_SOURCES})
+ target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h52gif-shared SHARED)
+ target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (h52gif-shared PROPERTIES FOLDER tools/hl)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif-shared")
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h52gif-shared
+ )
+endif ()
if (BUILD_TESTING)
# --------------------------------------------------------------------
@@ -39,9 +73,9 @@ if (BUILD_TESTING)
# used in the CMake Build system as we rely on the test files that are
# shipped with HDF5 source archives
# --------------------------------------------------------------------
- if (HDF5_BUILD_GENERATORS)
+ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c)
- target_include_directories(hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (hl_h52gifgentest STATIC)
target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl)
@@ -58,8 +92,7 @@ endif ()
if (HDF5_EXPORTED_TARGETS)
install (
TARGETS
- gif2h5
- h52gif
+ ${H5_DEP_EXECUTABLES}
EXPORT
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications
diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake
index 61c004e..1cc989c 100644
--- a/hl/tools/gif2h5/CMakeTests.cmake
+++ b/hl/tools/gif2h5/CMakeTests.cmake
@@ -27,6 +27,12 @@ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "$
HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5" "gif2h5_files")
add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list})
+if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+else ()
+ set (tgt_ext "-shared")
+endif ()
+
# Remove any output file left over from previous test run
add_test (
NAME HL_TOOLS-clear-objects
@@ -38,19 +44,19 @@ add_test (
image24.gif
)
-add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5)
+add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5${tgt_ext}> testfiles/image1.gif image1.h5)
set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects)
-add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image)
+add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image1.gif -i image)
set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects)
-add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i nosuch_image)
+add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image.gif -i nosuch_image)
set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true")
set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects)
-#add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i palette)
+#add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/h52giftst.h5 image.gif -i palette)
#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true")
-add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
+add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif${tgt_ext}> testfiles/ex_image2.h5 image24.gif -i image24bitpixel)
set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true")
set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects)
diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt
index 1d1c341..b3d65f7 100644
--- a/hl/tools/h5watch/CMakeLists.txt
+++ b/hl/tools/h5watch/CMakeLists.txt
@@ -9,11 +9,22 @@ set (H5WATCH_SOURCES
)
#-- Add h5watch program
-add_executable (h5watch ${H5WATCH_SOURCES})
-target_include_directories(h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (h5watch STATIC)
-target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
-set_target_properties (h5watch PROPERTIES FOLDER tools/hl)
+if (NOT ONLY_SHARED_LIBS)
+ add_executable (h5watch ${H5WATCH_SOURCES})
+ target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5watch STATIC)
+ target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ set_target_properties (h5watch PROPERTIES FOLDER tools/hl)
+ set (H5_DEP_EXECUTABLES h5watch)
+endif ()
+if (BUILD_SHARED_LIBS)
+ add_executable (h5watch-shared ${H5WATCH_SOURCES})
+ target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (h5watch-shared SHARED)
+ target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ set_target_properties (h5watch-shared PROPERTIES FOLDER tools/hl)
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared)
+endif ()
if (BUILD_TESTING)
#-- Add swmr_check_compat_vfd program
@@ -21,9 +32,14 @@ if (BUILD_TESTING)
${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c
)
add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES})
- target_include_directories(hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC)
- target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET})
+ target_include_directories (hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC)
+ target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd SHARED)
+ target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl)
#-- Add extend_dset program
@@ -31,15 +47,25 @@ if (BUILD_TESTING)
${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c
)
add_executable (extend_dset ${extend_dset_SOURCES})
- target_include_directories(extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (extend_dset STATIC)
- target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (extend_dset STATIC)
+ target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (extend_dset SHARED)
+ target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET})
+ endif ()
set_target_properties (extend_dset PROPERTIES FOLDER tools/hl)
add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c)
- target_include_directories(h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (h5watchgentest STATIC)
- target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT ONLY_SHARED_LIBS)
+ TARGET_C_PROPERTIES (h5watchgentest STATIC)
+ target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ else ()
+ TARGET_C_PROPERTIES (h5watchgentest SHARED)
+ target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ endif ()
set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl)
include (CMakeTests.cmake)
@@ -51,7 +77,7 @@ endif ()
if (HDF5_EXPORTED_TARGETS)
install (
TARGETS
- h5watch
+ ${H5_DEP_EXECUTABLES}
EXPORT
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications
diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake
index a4d3fa2..fba8484 100644
--- a/hl/tools/h5watch/CMakeTests.cmake
+++ b/hl/tools/h5watch/CMakeTests.cmake
@@ -68,12 +68,18 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
##############################################################################
##############################################################################
+ if (NOT BUILD_SHARED_LIBS)
+ set (tgt_ext "")
+ else ()
+ set (tgt_ext "-shared")
+ endif ()
+
macro (ADD_H5_TEST resultfile resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
NAME H5WATCH_ARGS-h5watch-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -91,7 +97,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
add_test (
NAME H5WATCH_ARGS-h5watch-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
@@ -110,14 +116,13 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
add_test (
NAME H5WATCH-${resultfile}-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
- ${resultfile}.h5
+ -E remove ${resultfile}.h5
)
set_tests_properties (H5WATCH-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
add_test (
NAME H5WATCH-${resultfile}
COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch${tgt_ext}>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"