From 7ee92d580510a7d90db7f3be8d2061c9c8f09a1b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Jun 2019 06:55:05 -0500 Subject: HDFFV-10805 Merge SHARED ONLY option from develop --- CMakeLists.txt | 17 +- MANIFEST | 2 - c++/examples/CMakeLists.txt | 22 +- c++/src/CMakeLists.txt | 40 +- c++/test/CMakeLists.txt | 15 +- config/cmake/FindHDFJAVA.cmake.in | 79 ---- config/cmake/FindJNI.cmake | 347 ---------------- config/cmake/hdf5-config.cmake.in | 9 +- config/cmake/jrunTest.cmake | 2 +- config/cmake/libhdf5.settings.cmake.in | 10 +- config/cmake/scripts/HDF5options.cmake | 16 +- config/cmake/scripts/HPC/bsub-HDF5options.cmake | 15 +- config/cmake/scripts/HPC/qsub-HDF5options.cmake | 15 +- config/cmake/scripts/HPC/raybsub-HDF5options.cmake | 15 +- config/cmake/scripts/HPC/sbatch-HDF5options.cmake | 15 +- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- config/cmake_ext_mod/FindSZIP.cmake | 2 +- config/cmake_ext_mod/HDFMacros.cmake | 13 +- examples/CMakeLists.txt | 36 +- examples/CMakeTests.cmake | 173 ++------ fortran/examples/CMakeLists.txt | 145 +++---- fortran/examples/CMakeTests.cmake | 90 +---- fortran/src/CMakeLists.txt | 298 ++++++++------ fortran/test/CMakeLists.txt | 449 ++++++++------------- fortran/test/CMakeTests.cmake | 184 ++------- hl/c++/examples/CMakeLists.txt | 23 +- hl/c++/src/CMakeLists.txt | 34 +- hl/c++/test/CMakeLists.txt | 29 +- hl/examples/CMakeLists.txt | 11 +- hl/fortran/examples/CMakeLists.txt | 42 +- hl/fortran/src/CMakeLists.txt | 204 +++++----- hl/fortran/test/CMakeLists.txt | 47 +-- hl/fortran/test/CMakeTests.cmake | 60 +-- hl/src/CMakeLists.txt | 34 +- hl/test/CMakeLists.txt | 68 ++-- hl/tools/gif2h5/CMakeLists.txt | 65 ++- hl/tools/gif2h5/CMakeTests.cmake | 16 +- hl/tools/h5watch/CMakeLists.txt | 56 ++- hl/tools/h5watch/CMakeTests.cmake | 15 +- .../hdf5lib/exceptions/HDF5LibraryException.java | 2 +- java/src/jni/CMakeLists.txt | 2 +- release_docs/RELEASE.txt | 18 + src/CMakeLists.txt | 81 ++-- test/CMakeLists.txt | 214 +++++----- test/CMakeTests.cmake | 385 +++--------------- test/CMakeVFDTests.cmake | 200 +-------- testpar/CMakeLists.txt | 34 +- testpar/CMakeTests.cmake | 3 +- testpar/CMakeVFDTests.cmake | 4 +- tools/lib/CMakeLists.txt | 38 +- tools/src/h5copy/CMakeLists.txt | 18 +- tools/src/h5diff/CMakeLists.txt | 70 ++-- tools/src/h5dump/CMakeLists.txt | 26 +- tools/src/h5format_convert/CMakeLists.txt | 26 +- tools/src/h5import/CMakeLists.txt | 30 +- tools/src/h5jam/CMakeLists.txt | 59 ++- tools/src/h5ls/CMakeLists.txt | 18 +- tools/src/h5repack/CMakeLists.txt | 20 +- tools/src/h5stat/CMakeLists.txt | 18 +- tools/src/misc/CMakeLists.txt | 98 +++-- tools/test/h5copy/CMakeLists.txt | 26 +- tools/test/h5copy/CMakeTests.cmake | 32 +- tools/test/h5diff/CMakeLists.txt | 26 +- tools/test/h5diff/CMakeTests.cmake | 10 +- tools/test/h5dump/CMakeLists.txt | 28 +- tools/test/h5dump/CMakeTests.cmake | 92 +++-- tools/test/h5dump/CMakeTestsPBITS.cmake | 10 +- tools/test/h5dump/CMakeTestsVDS.cmake | 18 +- tools/test/h5dump/CMakeTestsXML.cmake | 10 +- tools/test/h5format_convert/CMakeLists.txt | 17 +- tools/test/h5format_convert/CMakeTests.cmake | 31 +- tools/test/h5import/CMakeLists.txt | 11 +- tools/test/h5import/CMakeTests.cmake | 29 +- tools/test/h5jam/CMakeLists.txt | 26 +- tools/test/h5jam/CMakeTests.cmake | 28 +- tools/test/h5ls/CMakeLists.txt | 22 +- tools/test/h5ls/CMakeTests.cmake | 14 +- tools/test/h5ls/CMakeTestsVDS.cmake | 14 +- tools/test/h5repack/CMakeLists.txt | 66 +-- tools/test/h5repack/CMakeTests.cmake | 70 ++-- tools/test/h5stat/CMakeLists.txt | 4 +- tools/test/h5stat/CMakeTests.cmake | 14 +- tools/test/misc/CMakeLists.txt | 46 ++- tools/test/misc/CMakeTestsClear.cmake | 26 +- tools/test/misc/CMakeTestsMkgrp.cmake | 12 +- tools/test/misc/CMakeTestsRepart.cmake | 14 +- tools/test/misc/vds/CMakeLists.txt | 11 +- tools/test/perform/CMakeLists.txt | 101 +++-- tools/test/perform/pio_engine.c | 6 + tools/test/perform/sio_engine.c | 6 + 90 files changed, 2072 insertions(+), 2827 deletions(-) delete mode 100644 config/cmake/FindHDFJAVA.cmake.in delete mode 100644 config/cmake/FindJNI.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a70ec4c..3461632 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,18 +416,23 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) # Mac OS X Options #----------------------------------------------------------------------------- if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS) - set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") + set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) endif () #----------------------------------------------------------------------------- # Option to Build Shared and Static libs, default is both #----------------------------------------------------------------------------- +option (ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF) +set (H5_ENABLE_STATIC_LIB YES) +if (ONLY_SHARED_LIBS) + set (H5_ENABLE_STATIC_LIB NO) + set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") +endif () option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H5_ENABLE_SHARED_LIB NO) if (BUILD_SHARED_LIBS) set (H5_ENABLE_SHARED_LIB YES) endif () -set (H5_ENABLE_STATIC_LIB YES) set (CMAKE_POSITION_INDEPENDENT_CODE ON) #----------------------------------------------------------------------------- @@ -725,13 +730,17 @@ add_subdirectory (src) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) - add_dependencies (${HDF5_LIB_TARGET} ZLIB) + if (NOT ONLY_SHARED_LIBS) + add_dependencies (${HDF5_LIB_TARGET} ZLIB) + endif () if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} ZLIB) endif () endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) - add_dependencies (${HDF5_LIB_TARGET} SZIP) + if (NOT ONLY_SHARED_LIBS) + add_dependencies (${HDF5_LIB_TARGET} SZIP) + endif () if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} SZIP) endif () diff --git a/MANIFEST b/MANIFEST index 5dd7659..7a59414 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3206,8 +3206,6 @@ ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.Info.plist.in ./config/cmake/CTestCustom.cmake -./config/cmake/FindHDFJAVA.cmake.in -./config/cmake/FindJNI.cmake ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index d3a18f2..2088019 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -34,17 +34,27 @@ set (tutr_examples foreach (example ${examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) - target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) - target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 945b352..8e7f8be 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -84,24 +84,26 @@ set (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h ) -add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) -target_include_directories(${HDF5_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -target_compile_definitions(${HDF5_CPP_LIB_TARGET} - PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings -) -TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) -set (install_targets ${HDF5_CPP_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) + target_include_directories (${HDF5_CPP_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_CPP_LIB_TARGET} + PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings + ) + TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) + set (install_targets ${HDF5_CPP_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) - target_include_directories(${HDF5_CPP_LIBSH_TARGET} + target_include_directories (${HDF5_CPP_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -136,7 +138,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) endif () - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) + endif () install ( TARGETS @@ -163,7 +167,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") set (_PKG_CONFIG_LIBS_PRIVATE) -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}") endif () diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 8e2d685..95ca9b1 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -38,16 +38,17 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) -target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(cpp_testhdf5 PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) -TARGET_C_PROPERTIES (cpp_testhdf5 STATIC) -target_link_libraries (cpp_testhdf5 PRIVATE - ${HDF5_CPP_LIB_TARGET} - ${HDF5_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} -) +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_testhdf5 STATIC) + target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (cpp_testhdf5 SHARED) + target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) +endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) include (CMakeTests.cmake) diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in deleted file mode 100644 index ed2b8c2..0000000 --- a/config/cmake/FindHDFJAVA.cmake.in +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# -# To be used by projects that make use of CMakeified hdf-java -# - -# -# Find the HDFJAVA includes and get all installed hdf-java library settings from -# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later -# for this feature to work. The following vars are set if hdf-java is found. -# -# HDFJAVA_FOUND - True if found, otherwise all other vars are undefined -# HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@) -# HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@) -# HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@) -# -# Target names that are valid (depending on enabled options) -# will be the following -# -# -# To aid in finding HDFJAVA as part of a subproject set -# HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies - -INCLUDE (SelectLibraryConfigurations) -INCLUDE (FindPackageHandleStandardArgs) - -# The HINTS option should only be used for values computed from the system. -set (_HDFJAVA_HINTS - $ENV{HOME}/.local - $ENV{HDFJAVA_ROOT} - $ENV{HDFJAVA_ROOT_DIR_HINT} -) -# Hard-coded guesses should still go in PATHS. This ensures that the user -# environment can always override hard guesses. -set (_HDFJAVA_PATHS - $ENV{HOME}/.local - $ENV{HDFJAVA_ROOT} - $ENV{HDFJAVA_ROOT_DIR_HINT} - /usr/lib/@HDFJAVA_PACKAGE@ - /usr/share/@HDFJAVA_PACKAGE@ - /usr/local/@HDFJAVA_PACKAGE@ - /usr/local/@HDFJAVA_PACKAGE@/share -) - -FIND_PATH (HDFJAVA_ROOT_DIR "@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake" - HINTS ${_HDFJAVA_HINTS} - PATHS ${_HDFJAVA_PATHS} - PATH_SUFFIXES - cmake/@HDFJAVA_PACKAGE@ - lib/cmake/@HDFJAVA_PACKAGE@ - share/cmake/@HDFJAVA_PACKAGE@ -) - -FIND_PATH (HDFJAVA_LIBRARY "jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar" - HINTS ${_HDFJAVA_HINTS} - PATHS ${_HDFJAVA_PATHS} - PATH_SUFFIXES - lib -) - -if (HDFJAVA_ROOT_DIR) - set (HDFJAVA_FOUND "YES") - INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) - set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}") - set (HDFJAVA_INCLUDE_DIRS - ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar - ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar - ) - -endif () diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake deleted file mode 100644 index 1e6daf6..0000000 --- a/config/cmake/FindJNI.cmake +++ /dev/null @@ -1,347 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. - -#.rst: -# FindJNI -# ------- -# -# Find JNI java libraries. -# -# This module finds if Java is installed and determines where the -# include files and libraries are. It also determines what the name of -# the library is. The caller may set variable JAVA_HOME to specify a -# Java installation prefix explicitly. -# -# This module sets the following result variables: -# -# :: -# -# JNI_INCLUDE_DIRS = the include dirs to use -# JNI_LIBRARIES = the libraries to use -# JNI_FOUND = TRUE if JNI headers and libraries were found. -# JAVA_AWT_LIBRARY = the path to the jawt library -# JAVA_JVM_LIBRARY = the path to the jvm library -# JAVA_INCLUDE_PATH = the include path to jni.h -# JAVA_INCLUDE_PATH2 = the include path to jni_md.h -# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h - -# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} -macro(java_append_library_directories _var) - # Determine java arch-specific library subdir - # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk - # 1.6.0_18 + icedtea patches. However, it would be much better to base the - # guess on the first part of the GNU config.guess platform triplet. - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32") - set(_java_libarch "x32" "amd64" "i386") - else() - set(_java_libarch "amd64" "i386") - endif() - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") - set(_java_libarch "i386") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") - set(_java_libarch "alpha") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - # Subdir is "arm" for both big-endian (arm) and little-endian (armel). - set(_java_libarch "arm" "aarch32") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") - # mips* machines are bi-endian mostly so processor does not tell - # endianess of the underlying system. - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") - set(_java_libarch "ppc64" "ppc64le") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") - set(_java_libarch "ppc64" "ppc") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - set(_java_libarch "ppc" "ppc64") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") - # Both flavours can run on the same processor - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") - set(_java_libarch "parisc" "parisc64") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") - # s390 binaries can run on s390x machines - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") - set(_java_libarch "sh") - else() - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") - endif() - - # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or - # system is non-Linux (where the code above has not been well tested) - if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) - list(APPEND _java_libarch "i386" "amd64" "ppc") - endif() - - # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer - # current value to a hardcoded list. Remove possible duplicates. - list(REMOVE_DUPLICATES _java_libarch) - - foreach(_path ${ARGN}) - if(_path MATCHES "{libarch}") - foreach(_libarch ${_java_libarch}) - string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") - if(EXISTS ${_newpath}) - list(APPEND ${_var} "${_newpath}") - endif() - endforeach() - else() - if(EXISTS ${_path}) - list(APPEND ${_var} "${_path}") - endif() - endif() - endforeach() -endmacro() - -#include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake) -INCLUDE (CMakeFindJavaCommon) - -# Save CMAKE_FIND_FRAMEWORK -if(DEFINED CMAKE_FIND_FRAMEWORK) - set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) -else() - unset(_JNI_CMAKE_FIND_FRAMEWORK) -endif() - -if(_JAVA_HOME_EXPLICIT) - set(CMAKE_FIND_FRAMEWORK NEVER) -endif() - -set(JAVA_AWT_LIBRARY_DIRECTORIES) -if(_JAVA_HOME) - JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - ${_JAVA_HOME}/jre/lib/{libarch} - ${_JAVA_HOME}/jre/lib - ${_JAVA_HOME}/lib/{libarch} - ${_JAVA_HOME}/lib - ${_JAVA_HOME} - ) -endif() -get_filename_component(java_install_version - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) - -list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" - ) -JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - /usr/java/lib - /usr/java/jre/lib - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /usr/lib/jvm/java/lib - /usr/lib64/jvm/java/lib - /usr/lib/java/jre/lib/{libarch} - /usr/lib64/java/jre/lib/{libarch} - /usr/lib/jvm/jre/lib/{libarch} - /usr/local/lib/java/jre/lib/{libarch} - /usr/local/share/java/jre/lib/{libarch} - /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} - /usr/lib/j2sdk1.5-sun/jre/lib/{libarch} - /opt/sun-jdk-1.5.0.04/jre/lib/{libarch} - /usr/lib/jvm/java-6-sun/jre/lib/{libarch} - /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} - /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex - /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} - /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora - # Debian specific paths for default JVM - /usr/lib/jvm/default-java/jre/lib/{libarch} - /usr/lib/jvm/default-java/jre/lib - /usr/lib/jvm/default-java/lib - # Arch Linux specific paths for default JVM - /usr/lib/jvm/default/jre/lib/{libarch} - /usr/lib/jvm/default/lib/{libarch} - # Ubuntu specific paths for default JVM - /usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 - /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 - /usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 - # OpenBSD specific paths for default JVM - /usr/local/jdk-1.7.0/jre/lib/{libarch} - /usr/local/jre-1.7.0/lib/{libarch} - /usr/local/jdk-1.6.0/jre/lib/{libarch} - /usr/local/jre-1.6.0/lib/{libarch} - # SuSE specific paths for default JVM - /usr/lib64/jvm/java/jre/lib/{libarch} - /usr/lib64/jvm/jre/lib/{libarch} - ) - -set(JAVA_JVM_LIBRARY_DIRECTORIES) -foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) - list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES - "${dir}" - "${dir}/client" - "${dir}/server" - # IBM SDK, Java Technology Edition, specific paths - "${dir}/j9vm" - "${dir}/default" - ) -endforeach() - -set(JAVA_AWT_INCLUDE_DIRECTORIES) -if(_JAVA_HOME) - list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include) -endif() -list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" -) - -JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES - ${_JAVA_HOME}/include - /usr/include - /usr/java/include - /usr/local/include - /usr/lib/java/include - /usr/lib64/java/include - /usr/local/lib/java/include - /usr/lib/jvm/java/include - /usr/lib/jvm/java-6-sun/include - /usr/lib/jvm/java-1.5.0-sun/include - /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex - /usr/lib/jvm/java-6-openjdk/include - /usr/lib/jvm/java-7-openjdk/include - /usr/lib64/jvm/java-7-openjdk/include - /usr/lib64/jvm/java-7-openjdk-amd64/include - /usr/lib/jvm/java-8-openjdk-{libarch}/include # ubuntu 15.10 - /usr/lib/jvm/java-7-openjdk-{libarch}/include # ubuntu 15.10 - /usr/lib/jvm/java-6-openjdk-{libarch}/include # ubuntu 15.10 - /usr/local/share/java/include - /usr/lib/j2sdk1.4-sun/include - /usr/lib/j2sdk1.5-sun/include - /opt/sun-jdk-1.5.0.04/include - # Debian specific path for default JVM - /usr/lib/jvm/default-java/include - # Arch specific path for default JVM - /usr/lib/jvm/default/include - # OpenBSD specific path for default JVM - /usr/local/jdk-1.7.0/include - /usr/local/jdk-1.6.0/include - # SuSE specific paths for default JVM - /usr/lib64/jvm/java/include - ) - -foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") - get_filename_component(jpath "${JAVA_PROG}" PATH) - foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include) - if(EXISTS ${jpath}/${JAVA_INC_PATH}) - list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}") - endif() - endforeach() - foreach(JAVA_LIB_PATH - ../lib ../jre/lib ../jre/lib/i386 - ../java/lib ../java/jre/lib ../java/jre/lib/i386 - ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386) - if(EXISTS ${jpath}/${JAVA_LIB_PATH}) - list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}") - endif() - endforeach() -endforeach() - -if(APPLE) - if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY") - set(_JNI_SEARCHES FRAMEWORK) - elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER") - set(_JNI_SEARCHES NORMAL) - elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST") - set(_JNI_SEARCHES NORMAL FRAMEWORK) - else() - set(_JNI_SEARCHES FRAMEWORK NORMAL) - endif() - set(_JNI_FRAMEWORK_JVM NAMES JavaVM) - set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}") -else() - set(_JNI_SEARCHES NORMAL) -endif() - -set(_JNI_NORMAL_JVM - NAMES jvm - PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES} - ) - -set(_JNI_NORMAL_JAWT - NAMES jawt - PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES} - ) - -foreach(search ${_JNI_SEARCHES}) - find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM}) - find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT}) - if(JAVA_JVM_LIBRARY) - break() - endif() -endforeach() -unset(_JNI_SEARCHES) -unset(_JNI_FRAMEWORK_JVM) -unset(_JNI_FRAMEWORK_JAWT) -unset(_JNI_NORMAL_JVM) -unset(_JNI_NORMAL_JAWT) - -# Find headers matching the library. -if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);") - set(CMAKE_FIND_FRAMEWORK ONLY) -else() - set(CMAKE_FIND_FRAMEWORK NEVER) -endif() - -# add in the include path -find_path(JAVA_INCLUDE_PATH jni.h - ${JAVA_AWT_INCLUDE_DIRECTORIES} -) - -find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h - PATHS - ${JAVA_INCLUDE_PATH} - ${JAVA_INCLUDE_PATH}/darwin - ${JAVA_INCLUDE_PATH}/win32 - ${JAVA_INCLUDE_PATH}/linux - ${JAVA_INCLUDE_PATH}/freebsd - ${JAVA_INCLUDE_PATH}/openbsd - ${JAVA_INCLUDE_PATH}/solaris - ${JAVA_INCLUDE_PATH}/hp-ux - ${JAVA_INCLUDE_PATH}/alpha - ${JAVA_INCLUDE_PATH}/aix -) - -find_path(JAVA_AWT_INCLUDE_PATH jawt.h - ${JAVA_INCLUDE_PATH} -) - -# Restore CMAKE_FIND_FRAMEWORK -if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK) - set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK}) - unset(_JNI_CMAKE_FIND_FRAMEWORK) -else() - unset(CMAKE_FIND_FRAMEWORK) -endif() - -#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -INCLUDE (FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY - JAVA_JVM_LIBRARY - JAVA_INCLUDE_PATH - JAVA_INCLUDE_PATH2 - JAVA_AWT_INCLUDE_PATH) - -mark_as_advanced( - JAVA_AWT_LIBRARY - JAVA_JVM_LIBRARY - JAVA_AWT_INCLUDE_PATH - JAVA_INCLUDE_PATH - JAVA_INCLUDE_PATH2 -) - -set(JNI_LIBRARIES - ${JAVA_AWT_LIBRARY} - ${JAVA_JVM_LIBRARY} -) - -set(JNI_INCLUDE_DIRS - ${JAVA_INCLUDE_PATH} - ${JAVA_INCLUDE_PATH2} - ${JAVA_AWT_INCLUDE_PATH} -) - diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index d0f1d00..1803117 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -42,7 +42,8 @@ set (${HDF5_PACKAGE_NAME}_ENABLE_THREADSAFE @HDF5_ENABLE_THREADSAFE@) set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) -set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@) +set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@) set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF5_LIBRARIES_TO_EXPORT@) set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") @@ -119,9 +120,15 @@ endif () # Handle default component(static) : if (NOT ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) + if (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS) set (${HDF5_PACKAGE_NAME}_LIB_TYPE) set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL static) set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_static_C true) + else () + set (${HDF5_PACKAGE_NAME}_LIB_TYPE) + set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL shared) + set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_shared_C true) + endif () endif () # Handle requested components: diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index fc49275..44ac15b 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -9,7 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# runTest.cmake executes a command and captures the output in a file. File is then compared +# jrunTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. cmake_policy(SET CMP0007 NEW) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 9a534df..9e91ac0 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -32,7 +32,7 @@ Linking Options: Languages: ---------- - C: yes + C: YES C Compiler: @CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_VERSION@ CPPFLAGS: @CPPFLAGS@ H5_CPPFLAGS: @H5_CPPFLAGS@ @@ -41,7 +41,7 @@ Languages: H5_CFLAGS: @H5_CFLAGS@ AM_CFLAGS: @AM_CFLAGS@ Shared C Library: @H5_ENABLE_SHARED_LIB@ - Static C Library: YES + Static C Library: @H5_ENABLE_STATIC_LIB@ Fortran: @HDF5_BUILD_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ @@ -49,7 +49,7 @@ Languages: @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: YES +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@ C++: @HDF5_BUILD_CPP_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ @@ -57,10 +57,10 @@ Languages: @BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: YES +@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@ JAVA: @HDF5_BUILD_JAVA@ -@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ +@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ Features: --------- diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 24eaf78..94aafac 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -27,7 +27,9 @@ ############################################################################################# #### Only build static libraries #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") -#### Add PICC option on linux/mac #### +#### Only build shared libraries #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DONLY_SHARED_LIBS:BOOL=OFF") +#### Add PIC option on linux/mac #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") ############################################################################################# @@ -69,12 +71,12 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ############################################################################################# ### enable parallel builds - -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") - +if (DEFINED MPI) + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") +endif() ############################################################################################# ### enable thread-safety builds diff --git a/config/cmake/scripts/HPC/bsub-HDF5options.cmake b/config/cmake/scripts/HPC/bsub-HDF5options.cmake index 83c17aa..7473e8a 100644 --- a/config/cmake/scripts/HPC/bsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/bsub-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "bsub") diff --git a/config/cmake/scripts/HPC/qsub-HDF5options.cmake b/config/cmake/scripts/HPC/qsub-HDF5options.cmake index 51c3891..34eba1b 100644 --- a/config/cmake/scripts/HPC/qsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/qsub-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_NAME "ctest.qsub") diff --git a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake index 4aad887..fa1ec4a 100644 --- a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "raybsub") diff --git a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake index f70526e..3205a1c 100644 --- a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake +++ b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands if (DEFINED KNL) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index bbd5170..63d9ee9 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -28,7 +28,7 @@ if (APPLE) list (LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH) if (ARCH_LENGTH GREATER 1) set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE) - message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" + message (FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" "due to technical reasons. The best approach would be build each architecture in separate directories" "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'" "variable has been set to a blank value which will build the default architecture for this system.") diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 97a2336..152f8ac 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -27,7 +27,7 @@ # Result variables ################### -This module will set the following variables in your project: +# This module will set the following variables in your project: # SZIP_FOUND, true if the SZIP headers and libraries were found. # SZIP_INCLUDE_DIR, the directory containing the SZIP headers. diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 2f4ce52..9da5006 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -28,7 +28,7 @@ macro (SET_HDF_BUILD_TYPE) endif() endif() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + message (STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" @@ -224,10 +224,9 @@ macro (TARGET_C_PROPERTIES wintarget libtype) $<$:${WIN_COMPILE_FLAGS}> $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries(${wintarget} INTERFACE - $<$:${WIN_LINK_FLAGS}> - $<$:${WIN_LINK_FLAGS}> - ) + if(MSVC) + set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}") + endif() endmacro () #----------------------------------------------------------------------------- @@ -294,7 +293,9 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") endif () - if (BUILD_SHARED_LIBS) + if (ONLY_SHARED_LIBS) + set (LIB_TYPE "Shared") + elseif (BUILD_SHARED_LIBS) set (LIB_TYPE "Static and Shared") else () set (LIB_TYPE "Static") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2239d64..6e1f79d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -41,32 +41,28 @@ set (examples foreach (example ${examples}) add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories(${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${example} STATIC) - target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) - set_target_properties (${example} PROPERTIES FOLDER examples) - if (BUILD_SHARED_LIBS) - add_executable (${example}-shared ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories(${example}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${example}-shared SHARED) - target_link_libraries (${example}-shared PRIVATE ${HDF5_LIBSH_TARGET}) - set_target_properties (${example}-shared PROPERTIES FOLDER examples) + target_include_directories (${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${example} STATIC) + target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${example} SHARED) + target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET}) endif () + set_target_properties (${example} PROPERTIES FOLDER examples) endforeach () if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - target_include_directories(ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ph5example STATIC) - target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) - set_target_properties (ph5example PROPERTIES FOLDER examples) - if (BUILD_SHARED_LIBS) - add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - target_include_directories(ph5example-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ph5example-shared SHARED) - target_link_libraries (ph5example-shared PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) - set_target_properties (ph5example-shared PROPERTIES FOLDER examples) + target_include_directories (ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (ph5example STATIC) + target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) + else () + TARGET_C_PROPERTIES (ph5example SHARED) + target_link_libraries (ph5example PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) endif () + set_target_properties (ph5example PROPERTIES FOLDER examples) endif () if (BUILD_TESTING) diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 1058566..6cab7dd 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -16,93 +16,8 @@ ############################################################################## ############################################################################## file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) - if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5EX-shared") - file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared/red ${PROJECT_BINARY_DIR}/H5EX-shared/blue ${PROJECT_BINARY_DIR}/H5EX-shared/u2w) - endif () - - # Remove any output file left over from previous test run - add_test ( - NAME EXAMPLES-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - Attributes.h5 - btrees_file.h5 - cmprss.h5 - default_file.h5 - dset.h5 - extend.h5 - extlink_prefix_source.h5 - extlink_source.h5 - extlink_target.h5 - group.h5 - groups.h5 - hard_link.h5 - mount1.h5 - mount2.h5 - one_index_file.h5 - only_dspaces_and_attrs_file.h5 - only_huge_mesgs_file.h5 - REF_REG.h5 - refere.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 - separate_indexes_file.h5 - small_lists_file.h5 - soft_link.h5 - subset.h5 - unix2win.h5 - blue/prefix_target.h5 - red/prefix_target.h5 - u2w/u2w_target.h5 - vds.h5 - vds-exc.h5 - vds-excalibur.h5 - vds-exclim.h5 - vds-percival.h5 - vds-percival-unlim.h5 - vds-percival-unlim-maxmin.h5 - a.h5 - b.h5 - c.h5 - d.h5 - vds-simpleIO.h5 - vds-eiger.h5 - ) - if (last_test) - set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-clear-objects") - - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND $) - else () - add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-${example}") - endforeach () - if (BUILD_SHARED_LIBS) - # Remove any output file left over from previous test run - add_test ( - NAME EXAMPLES-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + set (test_CLEANFILES Attributes.h5 btrees_file.h5 cmprss.h5 @@ -131,6 +46,9 @@ soft_link.h5 subset.h5 unix2win.h5 + blue/prefix_target.h5 + red/prefix_target.h5 + u2w/u2w_target.h5 vds.h5 vds-exc.h5 vds-excalibur.h5 @@ -144,39 +62,39 @@ d.h5 vds-simpleIO.h5 vds-eiger.h5 - blue/prefix_target.h5 - red/prefix_target.h5 - u2w/u2w_target.h5 - WORKING_DIRECTORY - ${PROJECT_BINARY_DIR}/H5EX-shared - ) - if (last_test) - set_tests_properties (EXAMPLES-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-shared-clear-objects") + ) - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-shared-${example} COMMAND $) - else () - add_test (NAME EXAMPLES-shared-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (EXAMPLES-shared-${example} PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) - if (last_test) - set_tests_properties (EXAMPLES-shared-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-shared-${example}") - endforeach () + # Remove any output file left over from previous test run + add_test ( + NAME EXAMPLES-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_CLEANFILES} + ) + if (last_test) + set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "EXAMPLES-clear-objects") + + foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND $) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + if (last_test) + set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "EXAMPLES-${example}") + endforeach () ### Windows pops up a modal permission dialog on this test if (H5_HAVE_PARALLEL AND NOT WIN32) @@ -198,25 +116,4 @@ set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) endif () set (last_test "MPI_TEST_EXAMPLES-ph5example") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_EXAMPLES-shared-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - else () - add_test (NAME MPI_TEST_EXAMPLES-shared-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=ph5example-shared.out" - -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" - -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" - ) - endif () - set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) - if (last_test) - set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "MPI_TEST_EXAMPLES-shared-ph5example") - endif () endif () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 0c570c6..e8dddd3 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,56 +35,43 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) target_compile_options(f90_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET f90_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) # set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:> +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f90_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f90_ex_${example}-shared + if (NOT BUILD_SHARED_LIBS) + target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(f90_ex_${example}-shared + target_link_libraries (f90_ex_${example} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) + set_target_properties (f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (f90_ex_${example}-shared + else () + target_include_directories (f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) -# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f90_ex_${example}-shared PROPERTIES + set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared @@ -94,18 +81,10 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f03_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) target_compile_options(f03_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET f03_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -115,35 +94,30 @@ foreach (example ${F2003_examples}) if(MSVC) set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f03_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran03 - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f03_ex_${example}-shared + if (NOT ONLY_SHARED_LIBS) + target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(f03_ex_${example}-shared + target_link_libraries (f03_ex_${example} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_link_libraries (f03_ex_${example}-shared + set_target_properties (f03_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran03 + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (f03_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) -# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f03_ex_${example}-shared PROPERTIES + set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared @@ -153,19 +127,10 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_include_directories (f90_ex_ph5example - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - ) target_compile_options(f90_ex_ph5example PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f90_ex_ph5example - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - $<$:${MPI_Fortran_LIBRARIES}> - ) # set_property(TARGET f90_ex_ph5example APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -175,36 +140,32 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) if(MSVC) set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f90_ex_ph5example PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_include_directories (f90_ex_ph5example-shared + if (NOT ONLY_SHARED_LIBS) + target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" ) - target_compile_options(f90_ex_ph5example-shared + target_link_libraries (f90_ex_ph5example PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:${MPI_Fortran_LIBRARIES}> + ) + set_target_properties (f90_ex_ph5example PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (f90_ex_ph5example + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" ) - target_link_libraries (f90_ex_ph5example-shared + target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:${MPI_Fortran_LIBRARIES}> ) -# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f90_ex_ph5example-shared PROPERTIES + set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index efbb209..1ad606c 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,36 +16,7 @@ ############################################################################## ############################################################################## - # Remove any output file left over from previous test run - add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 - ) - if (last_test) - set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-clear-objects") - if (BUILD_SHARED_LIBS) - add_test ( - NAME f90_ex-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + set (test_CLEANFILES compound.h5 copy1.h5 copy2.h5 @@ -61,12 +32,18 @@ subset.h5 SDScompound.h5 test.h5 - ) - if (last_test) - set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-shared-clear-objects") + ) + + # Remove any output file left over from previous test run + add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_CLEANFILES} + ) + if (last_test) + set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "f90_ex-clear-objects") foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -87,26 +64,6 @@ foreach (example ${examples}) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex-shared_${example} COMMAND $) - else () - add_test (NAME f90_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f90_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f90_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-shared_${example}") - endif () endforeach () foreach (example ${F2003_examples}) @@ -128,31 +85,8 @@ foreach (example ${F2003_examples}) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex-shared_${example} COMMAND $) - else () - add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex-shared_${example}") - endif () endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - if (BUILD_SHARED_LIBS) - add_test (NAME MPI_TEST_f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index f71e820..f80eaa9 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -40,7 +40,7 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) #----------------------------------------------------------------------------- add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90) -target_include_directories(H5_buildiface +target_include_directories (H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}" ) @@ -69,24 +69,28 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +if (NOT ONLY_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +endif () #----------------------------------------------------------------------------- add_executable (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) -target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS H5match_types -) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +target_include_directories (H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + DEPENDS H5match_types + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h @@ -131,24 +135,26 @@ set (f90CStub_C_SHHDRS ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) -add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) -target_include_directories(${HDF5_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES - FOLDER libraries/fortran - LINKER_LANGUAGE C -) -set (install_targets ${HDF5_F90_C_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) + target_include_directories (${HDF5_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES + FOLDER libraries/fortran + LINKER_LANGUAGE C + ) + set (install_targets ${HDF5_F90_C_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) - target_include_directories(${HDF5_F90_C_LIBSH_TARGET} + target_include_directories (${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -174,17 +180,19 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${f90_F_GEN_SOURCES} - COMMENT "Generating the H5_gen.F90 file" -) -add_custom_target (H5gen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 -) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + DEPENDS ${f90_F_GEN_SOURCES} + COMMENT "Generating the H5_gen.F90 file" + ) + add_custom_target (H5gen ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( @@ -220,18 +228,20 @@ set (f90_F_BASE_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90 ) -set (f90_F_SOURCES - # generated file - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 +if (NOT ONLY_SHARED_LIBS) + set (f90_F_SOURCES + # generated file + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - ${f90_F_BASE_SOURCES} + ${f90_F_BASE_SOURCES} - # generated file - ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + # generated file + ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - # normal distribution - ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 -) + # normal distribution + ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 + ) +endif () if (BUILD_SHARED_LIBS) set (f90_F_SOURCES_SHARED # generated file @@ -250,43 +260,45 @@ endif () #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) -target_include_directories (${HDF5_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include>" -) -target_compile_definitions(${HDF5_F90_LIB_TARGET} - PRIVATE - $<$:HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_F90_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_LIB_TARGET} - PRIVATE - ${LINK_Fortran_LIBS} - $<$:${MPI_Fortran_LIBRARIES}> -) -#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES - FOLDER libraries/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") -set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) -add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) + target_include_directories (${HDF5_F90_LIB_TARGET} + PRIVATE + "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" + ) + target_compile_definitions(${HDF5_F90_LIB_TARGET} + PRIVATE + $<$:HDF5F90_WINDOWS> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_F90_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_LIB_TARGET} + PRIVATE + ${LINK_Fortran_LIBS} + $<$:${MPI_Fortran_LIBRARIES}> + ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES + FOLDER libraries/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") + set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) + add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) @@ -351,35 +363,37 @@ install ( fortheaders ) -set (mod_files - ${MOD_BUILD_DIR}/h5fortran_types.mod - ${MOD_BUILD_DIR}/hdf5.mod - ${MOD_BUILD_DIR}/h5fortkit.mod - ${MOD_BUILD_DIR}/h5global.mod - ${MOD_BUILD_DIR}/h5a.mod - ${MOD_BUILD_DIR}/h5d.mod - ${MOD_BUILD_DIR}/h5e.mod - ${MOD_BUILD_DIR}/h5f.mod - ${MOD_BUILD_DIR}/h5g.mod - ${MOD_BUILD_DIR}/h5i.mod - ${MOD_BUILD_DIR}/h5l.mod - ${MOD_BUILD_DIR}/h5lib.mod - ${MOD_BUILD_DIR}/h5o.mod - ${MOD_BUILD_DIR}/h5p.mod - ${MOD_BUILD_DIR}/h5r.mod - ${MOD_BUILD_DIR}/h5s.mod - ${MOD_BUILD_DIR}/h5t.mod - ${MOD_BUILD_DIR}/h5z.mod - ${MOD_BUILD_DIR}/h5_gen.mod -) -install ( - FILES - ${mod_files} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR}/static - COMPONENT - fortheaders -) +if (NOT ONLY_SHARED_LIBS) + set (mod_files + ${MOD_BUILD_DIR}/h5fortran_types.mod + ${MOD_BUILD_DIR}/hdf5.mod + ${MOD_BUILD_DIR}/h5fortkit.mod + ${MOD_BUILD_DIR}/h5global.mod + ${MOD_BUILD_DIR}/h5a.mod + ${MOD_BUILD_DIR}/h5d.mod + ${MOD_BUILD_DIR}/h5e.mod + ${MOD_BUILD_DIR}/h5f.mod + ${MOD_BUILD_DIR}/h5g.mod + ${MOD_BUILD_DIR}/h5i.mod + ${MOD_BUILD_DIR}/h5l.mod + ${MOD_BUILD_DIR}/h5lib.mod + ${MOD_BUILD_DIR}/h5o.mod + ${MOD_BUILD_DIR}/h5p.mod + ${MOD_BUILD_DIR}/h5r.mod + ${MOD_BUILD_DIR}/h5s.mod + ${MOD_BUILD_DIR}/h5t.mod + ${MOD_BUILD_DIR}/h5z.mod + ${MOD_BUILD_DIR}/h5_gen.mod + ) + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/static + COMPONENT + fortheaders + ) +endif () if (BUILD_SHARED_LIBS) set (modsh_files @@ -421,8 +435,10 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) endif () - INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + endif () install ( TARGETS @@ -436,3 +452,53 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_F90_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_F90_LIB_CORENAME}") +endif () +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_F90_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT fortlibraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5fc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5fc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT fortlibraries + ) +endif () + + diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index b862fcd..f7f9038 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5_FORTRAN_TESTS C Fortran) #----------------------------------------------------------------------------- add_executable (H5_test_buildiface ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90) -target_include_directories(H5_test_buildiface +target_include_directories (H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR} ) @@ -31,35 +31,37 @@ set_target_properties (H5_test_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +else () file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Add Test Lib #----------------------------------------------------------------------------- -add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) -set_source_files_properties (t.c PROPERTIES LANGUAGE C) -target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE - ${HDF5_F90_C_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} -) -H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test/fortran - LINKER_LANGUAGE C -) -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) + set_source_files_properties (t.c PROPERTIES LANGUAGE C) + target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE + ${HDF5_F90_C_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test/fortran + LINKER_LANGUAGE C + ) +else () add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) - target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} + target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -78,19 +80,19 @@ if (BUILD_SHARED_LIBS) ) endif () -add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static - DEPENDS H5_test_buildiface - COMMENT "Generating the tf_gen.F90 file" -) -add_custom_target (H5testgen ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 -) -set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) - -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static + DEPENDS H5_test_buildiface + COMMENT "Generating the tf_gen.F90 file" + ) + add_custom_target (H5testgen ALL + DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + ) + set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) +else () add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 COMMAND $ @@ -104,15 +106,16 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) endif () -set (HDF5_F90_TF_SOURCES - # generated files - ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 +if (NOT BUILD_SHARED_LIBS) + set (HDF5_F90_TF_SOURCES + # generated files + ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - # normal distribution - tf.F90 -) -set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) -if (BUILD_SHARED_LIBS) + # normal distribution + tf.F90 + ) + set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) +else () set (HDF5_F90_TF_SOURCES_SHARED # generated file ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 @@ -123,40 +126,40 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) endif () -add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) -target_include_directories (${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - INTERFACE - "$/include>" -) -target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - $<$:HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} -) -#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) -add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) - -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) + target_include_directories (${HDF5_F90_TEST_LIB_TARGET} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE + "$/include>" + ) + target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} + PRIVATE + $<$:HDF5F90_WINDOWS> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) + add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) +else () add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE @@ -218,18 +221,10 @@ add_executable (testhdf5_fortran tH5Z.F90 tHDF5.F90 ) -target_include_directories (testhdf5_fortran - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(testhdf5_fortran PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (testhdf5_fortran - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET testhdf5_fortran APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -239,58 +234,36 @@ target_link_libraries (testhdf5_fortran if(MSVC) set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (testhdf5_fortran PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (testhdf5_fortran-shared - fortranlib_test.F90 - tH5A.F90 - tH5D.F90 - tH5E.F90 - tH5F.F90 - tH5G.F90 - tH5I.F90 - tH5P.F90 - tH5R.F90 - tH5S.F90 - tH5Sselect.F90 - tH5T.F90 - tH5VL.F90 - tH5Z.F90 - tHDF5.F90 - ) - target_include_directories (testhdf5_fortran-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (testhdf5_fortran PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(testhdf5_fortran-shared + target_link_libraries (testhdf5_fortran PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (testhdf5_fortran PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (testhdf5_fortran-shared + add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (testhdf5_fortran + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (testhdf5_fortran-shared PROPERTIES + set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for testhdf5_fortran_1_8 @@ -302,18 +275,10 @@ add_executable (testhdf5_fortran_1_8 tH5MISC_1_8.F90 tHDF5_1_8.F90 ) -target_include_directories (testhdf5_fortran_1_8 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(testhdf5_fortran_1_8 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (testhdf5_fortran_1_8 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -323,49 +288,36 @@ target_link_libraries (testhdf5_fortran_1_8 if(MSVC) set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (testhdf5_fortran_1_8 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (testhdf5_fortran_1_8-shared - fortranlib_test_1_8.F90 - tH5O.F90 - tH5A_1_8.F90 - tH5G_1_8.F90 - tH5MISC_1_8.F90 - tHDF5_1_8.F90 - ) - target_include_directories (testhdf5_fortran_1_8-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (testhdf5_fortran_1_8 PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(testhdf5_fortran_1_8-shared + target_link_libraries (testhdf5_fortran_1_8 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (testhdf5_fortran_1_8 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (testhdf5_fortran_1_8 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_link_libraries (testhdf5_fortran_1_8-shared + target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES + set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fortranlib_test_F03 @@ -379,18 +331,10 @@ add_executable (fortranlib_test_F03 tH5T_F03.F90 tHDF5_F03.F90 ) -target_include_directories (fortranlib_test_F03 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(fortranlib_test_F03 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fortranlib_test_F03 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET fortranlib_test_F03 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -400,67 +344,44 @@ target_link_libraries (fortranlib_test_F03 if(MSVC) set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fortranlib_test_F03 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fortranlib_test_F03-shared - fortranlib_test_F03.F90 - tH5E_F03.F90 - tH5F_F03.F90 - tH5L_F03.F90 - tH5O_F03.F90 - tH5P_F03.F90 - tH5T_F03.F90 - tHDF5_F03.F90 - ) - target_include_directories (fortranlib_test_F03-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fortranlib_test_F03 PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (fortranlib_test_F03 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fortranlib_test_F03 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_link_libraries (fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fortranlib_test_F03-shared PROPERTIES + set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) -target_include_directories (fflush1 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) target_compile_options(fflush1 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fflush1 - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET fflush1 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -470,58 +391,44 @@ target_link_libraries (fflush1 if(MSVC) set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fflush1 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fflush1-shared fflush1.F90) - target_include_directories (fflush1-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fflush1 PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_compile_options(fflush1-shared + target_link_libraries (fflush1 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (fflush1 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fflush1 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - target_link_libraries (fflush1-shared + target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET fflush1-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fflush1-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fflush1-shared PROPERTIES + set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fflush1 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) -target_include_directories (fflush2 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) target_compile_options (fflush2 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fflush2 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET fflush2 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -531,42 +438,36 @@ target_link_libraries (fflush2 if(MSVC) set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fflush2 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fflush2-shared fflush2.F90) - target_include_directories (fflush2-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fflush2 PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_compile_options(fflush2-shared + target_link_libraries (fflush2 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (fflush2 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (fflush2-shared + add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fflush2 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET fflush2-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fflush2-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fflush2-shared PROPERTIES + set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fflush2 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () include (CMakeTests.cmake) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 5fa10f4..ac412c3 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -15,48 +15,49 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fshared") -endif () + +set (test_CLEANFILES + a.h5 + b.h5 + c.h5 + d.h5 + dsetf_F03.h5 + enum1.h5 + extern_1a.raw + extern_2a.raw + extern_3a.raw + extern_4a.raw + extren_raw.raw + get_info.h5 + nbit.h5 + t_array_F03.h5 + t_bit_F03.h5 + t_controlchar_F03.h5 + t_enum_F03.h5 + t_objref_F03.h5 + t_opaque_F03.h5 + t_regref_F03.h5 + t_string_F03.h5 + t_vlen_F03.h5 + t_vlstring_F03.h5 + t_vlstringrw_F03.h5 + tarray1.h5 + tarray2.h5 + tarray3.h5 + test_create.h5 + tget_file_image.h5 + th5o_ref.h5 + titerate.h5 + vds.h5 + visit.h5 +) # Remove any output file left over from previous test run add_test ( NAME FORTRAN_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - a.h5 - b.h5 - c.h5 - d.h5 - dsetf_F03.h5 - enum1.h5 - extern_1a.raw - extern_2a.raw - extern_3a.raw - extern_4a.raw - extren_raw.raw - get_info.h5 - nbit.h5 - t_array_F03.h5 - t_bit_F03.h5 - t_controlchar_F03.h5 - t_enum_F03.h5 - t_objref_F03.h5 - t_opaque_F03.h5 - t_regref_F03.h5 - t_string_F03.h5 - t_vlen_F03.h5 - t_vlstring_F03.h5 - t_vlstringrw_F03.h5 - tarray1.h5 - tarray2.h5 - tarray3.h5 - test_create.h5 - tget_file_image.h5 - th5o_ref.h5 - titerate.h5 - vds.h5 - visit.h5 + ${test_CLEANFILES} ) if (last_test) set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -129,114 +130,3 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear- #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2 COMMAND $) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) - -if (BUILD_SHARED_LIBS) - add_test ( - NAME FORTRAN_testhdf5-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - a.h5 - b.h5 - c.h5 - d.h5 - dsetf_F03.h5 - enum1.h5 - extern_1a.raw - extern_2a.raw - extern_3a.raw - extern_4a.raw - extren_raw.raw - get_info.h5 - nbit.h5 - t_array_F03.h5 - t_bit_F03.h5 - t_controlchar_F03.h5 - t_enum_F03.h5 - t_objref_F03.h5 - t_opaque_F03.h5 - t_regref_F03.h5 - t_string_F03.h5 - t_vlen_F03.h5 - t_vlstring_F03.h5 - t_vlstringrw_F03.h5 - tarray1.h5 - tarray2.h5 - tarray3.h5 - test_create.h5 - tget_file_image.h5 - th5o_ref.h5 - titerate.h5 - vds.h5 - visit.h5 - WORKING_DIRECTORY - ${PROJECT_BINARY_DIR}/fshared - ) - set_tests_properties (FORTRAN_testhdf5-shared-clear-objects PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $) - else () - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=testhdf5_fortran.txt" - #-D "TEST_REFERENCE=testhdf5_fortran.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS "FORTRAN_testhdf5_fortran;FORTRAN_testhdf5-shared-clear-objects") - - #-- Adding test for testhdf5_fortran_1_8 - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $) - else () - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt" - #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) - - #-- Adding test for fortranlib_test_F03 - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $) - else () - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) - - #-- Adding test for fflush1 - add_test (NAME FORTRAN_fflush1-shared COMMAND $) - set_tests_properties (FORTRAN_fflush1-shared PROPERTIES DEPENDS FORTRAN_fflush2) - - #-- Adding test for fflush2 - add_test (NAME FORTRAN_fflush2-shared COMMAND $) - set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) -endif () diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 8e64239..50e08e8 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -5,13 +5,22 @@ project (HDF5_HL_CPP_EXAMPLES CXX) # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) -target_include_directories(ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (ptExampleFL STATIC) -target_link_libraries (ptExampleFL PRIVATE - ${HDF5_HL_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_LIB_TARGET} -) +target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (ptExampleFL STATIC) + target_link_libraries (ptExampleFL PRIVATE + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (ptExampleFL SHARED) + target_link_libraries (ptExampleFL PRIVATE + ${HDF5_HL_CPP_LIBSH_TARGET} + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) +endif () set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) if (BUILD_TESTING) diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 77419c6..eb83d8c 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -8,21 +8,23 @@ project (HDF5_HL_CPP_SRC CXX) set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) -add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) -target_include_directories(${HDF5_HL_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) -set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) + target_include_directories (${HDF5_HL_CPP_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) + set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) - target_include_directories(${HDF5_HL_CPP_LIBSH_TARGET} + target_include_directories (${HDF5_HL_CPP_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -56,7 +58,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) endif () - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) + endif () install ( TARGETS @@ -83,7 +87,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") set (_PKG_CONFIG_LIBS_PRIVATE) -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") endif () diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 68c049c..cfb24a8 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -2,15 +2,26 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_HL_CPP_TEST CXX) add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) -target_include_directories(hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (hl_ptableTest STATIC) -target_link_libraries (hl_ptableTest PRIVATE - ${HDF5_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_HL_CPP_LIB_TARGET} -) +target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_ptableTest STATIC) + target_link_libraries (hl_ptableTest PRIVATE + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_HL_CPP_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (hl_ptableTest SHARED) + target_link_libraries (hl_ptableTest PRIVATE + ${HDF5_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_CPP_LIBSH_TARGET} + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_HL_CPP_LIBSH_TARGET} + ) +endif () set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) include (CMakeTests.cmake) diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 97c6de5..86c1770 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -28,9 +28,14 @@ set (examples foreach (example ${examples}) add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories(hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_ex_${example} STATIC) - target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_ex_${example} STATIC) + target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (hl_ex_${example} SHARED) + target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) endforeach () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 27971b2..e41b8fe 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -8,18 +8,10 @@ set (examples foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (hl_f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) target_compile_options(hl_f90_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_ex_${example} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -29,11 +21,35 @@ foreach (example ${examples}) if(MSVC) set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (hl_f90_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) + if (NOT BUILD_SHARED_LIBS) + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_link_libraries (hl_f90_ex_${example} + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) + set_target_properties (hl_f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_link_libraries (hl_f90_ex_${example} + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + ) + set_target_properties (hl_f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + endif () endforeach () if (BUILD_TESTING) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 7ec3b63..a684088 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -16,7 +16,7 @@ endif () #----------------------------------------------------------------------------- add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 ) -target_include_directories(H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") +target_include_directories (H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") @@ -37,8 +37,10 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +if (NOT ONLY_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +endif () #----------------------------------------------------------------------------- # hl_f90CStub lib @@ -54,24 +56,25 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C) set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) -add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) -target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES - FOLDER libraries/hl/fortran - LINKER_LANGUAGE C -) -set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) - +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) + target_include_directories (${HDF5_HL_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES + FOLDER libraries/hl/fortran + LINKER_LANGUAGE C + ) + set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) - target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} + target_include_directories (${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -99,21 +102,23 @@ set (HDF5_HL_F90_F_BASE_SOURCES ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static - DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} - COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" -) -add_custom_target (H5HLgen ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 -) -set_source_files_properties ( - ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 - ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 - PROPERTIES GENERATED TRUE -) +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static + DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} + COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" + ) + add_custom_target (H5HLgen ALL + DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + ) + set_source_files_properties ( + ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 + ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + PROPERTIES GENERATED TRUE + ) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 @@ -132,15 +137,16 @@ if (BUILD_SHARED_LIBS) ) endif () -set (HDF5_HL_F90_F_SOURCES - ${HDF5_HL_F90_F_BASE_SOURCES} - - # generated files - ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 - ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 -) -set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran) +if (NOT ONLY_SHARED_LIBS) + set (HDF5_HL_F90_F_SOURCES + ${HDF5_HL_F90_F_BASE_SOURCES} + # generated files + ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 + ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + ) + set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran) +endif () if (BUILD_SHARED_LIBS) set (HDF5_HL_F90_F_SOURCES_SHARED ${HDF5_HL_F90_F_BASE_SOURCES} @@ -152,42 +158,43 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_HL_F90_F_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) endif () -add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) -target_include_directories (${HDF5_HL_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include>" -) -target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} - PUBLIC - $<$:HDF5F90_WINDOWS> - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_HL_F90_LIB_TARGET} - PUBLIC - ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} -) -#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES - FOLDER libraries/hl/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") -set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) -add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) - +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) + target_include_directories (${HDF5_HL_F90_LIB_TARGET} + PRIVATE + "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" + ) + target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} + PUBLIC + $<$:HDF5F90_WINDOWS> + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_HL_F90_LIB_TARGET} + PUBLIC + ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + ) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES + FOLDER libraries/hl/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") + set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) + add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} @@ -240,24 +247,25 @@ endif () #----------------------------------------------------------------------------- -set (mod_files - ${MOD_BUILD_DIR}/h5ds.mod - ${MOD_BUILD_DIR}/h5tb.mod - ${MOD_BUILD_DIR}/h5tb_const.mod - ${MOD_BUILD_DIR}/h5lt.mod - ${MOD_BUILD_DIR}/h5lt_const.mod - ${MOD_BUILD_DIR}/h5im.mod -) - -install ( - FILES - ${mod_files} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR}/static - COMPONENT - fortheaders -) +if (NOT ONLY_SHARED_LIBS) + set (mod_files + ${MOD_BUILD_DIR}/h5ds.mod + ${MOD_BUILD_DIR}/h5tb.mod + ${MOD_BUILD_DIR}/h5tb_const.mod + ${MOD_BUILD_DIR}/h5lt.mod + ${MOD_BUILD_DIR}/h5lt_const.mod + ${MOD_BUILD_DIR}/h5im.mod + ) + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/static + COMPONENT + fortheaders + ) +endif () if (BUILD_SHARED_LIBS) set (modsh_files ${MODSH_BUILD_DIR}/h5ds.mod @@ -285,8 +293,10 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) endif () - INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) - #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + endif () install ( TARGETS diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index fca2852..c152142 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -13,18 +13,10 @@ set (H5_TESTS macro (ADD_H5_FORTRAN_EXE file) add_executable (hl_f90_${file} ${file}.F90) - target_include_directories (hl_f90_${file} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) target_compile_options(hl_f90_${file} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_${file} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} - ) # set_property(TARGET hl_f90_${file} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -34,35 +26,30 @@ macro (ADD_H5_FORTRAN_EXE file) if(MSVC) set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (hl_f90_${file} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (hl_f90_${file}-shared ${file}.F90) - target_include_directories (hl_f90_${file}-shared + if (NOT BUILD_SHARED_LIBS) + target_include_directories (hl_f90_${file} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - target_compile_options(hl_f90_${file}-shared + target_link_libraries (hl_f90_${file} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} + ) + set_target_properties (hl_f90_${file} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (hl_f90_${file} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - target_link_libraries (hl_f90_${file}-shared + target_link_libraries (hl_f90_${file} PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ) -# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET hl_f90_${file}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (hl_f90_${file}-shared PROPERTIES + set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 54cc6ef..2137d1a 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -16,6 +16,18 @@ ############################################################################## ############################################################################## +set (test_CLEANFILES + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 + dsetf5.h5 + f1img.h5 + f1tab.h5 + f2tab.h5 + tstds.h5 +) + macro (ADD_H5_FORTRAN_TEST file) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_FORTRAN_f90_${file} COMMAND $) @@ -32,61 +44,15 @@ macro (ADD_H5_FORTRAN_TEST file) ) endif () set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND $) - else () - add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_${file}-shared.txt" - #-D "TEST_REFERENCE=hl_f90_${file}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_${file}-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - endif () endmacro () # Remove any output file left over from previous test run add_test ( NAME HL_FORTRAN_test-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1img.h5 - f1tab.h5 - f2tab.h5 - tstds.h5 + -E remove ${test_CLEANFILES} ) -if (BUILD_SHARED_LIBS) - add_test ( - NAME HL_FORTRAN_test-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1img.h5 - f1tab.h5 - f2tab.h5 - tstds.h5 - ) - set_tests_properties (HL_FORTRAN_test-shared-clear-objects - PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds" - ) -endif () - foreach (h5_test ${H5_TESTS}) ADD_H5_FORTRAN_TEST(${h5_test}) endforeach () diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index bf0f6ff..7125403 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -32,21 +32,23 @@ set (HL_PRIVATE_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h ) -add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) -target_include_directories(${HDF5_HL_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") -set (install_targets ${HDF5_HL_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) + target_include_directories (${HDF5_HL_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") + set (install_targets ${HDF5_HL_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) - target_include_directories(${HDF5_HL_LIBSH_TARGET} + target_include_directories (${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -80,7 +82,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) endif () - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) + endif () install ( TARGETS @@ -107,7 +111,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") set (_PKG_CONFIG_LIBS_PRIVATE) -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}") endif () diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 238b5e1..2959c6c 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -17,29 +17,26 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_EXE hl_name) +macro (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_${hl_name} STATIC) - target_link_libraries (hl_${hl_name} PRIVATE - ${HDF5_HL_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} - ) - set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO () - -MACRO (HL_ADD_SHEXE hl_name) - add_executable (hl_${hl_name} ${hl_name}.c) - target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_${hl_name} SHARED) - target_link_libraries (hl_${hl_name} PRIVATE - ${HDF5_HL_LIBSH_TARGET} - ${HDF5_TEST_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - ) + target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_${hl_name} STATIC) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) + else () + TARGET_C_PROPERTIES (hl_${hl_name} SHARED) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) + endif () set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO () +endmacro () HL_ADD_EXE (test_lite) HL_ADD_EXE (test_image) @@ -52,22 +49,31 @@ HL_ADD_EXE (test_h5do_compat) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) -target_include_directories(hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (hl_test_packet STATIC) -target_link_libraries (hl_test_packet PRIVATE - ${HDF5_HL_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} -) +target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_test_packet STATIC) + target_link_libraries (hl_test_packet PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (hl_test_packet SHARED) + target_link_libraries (hl_test_packet PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) +endif () set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. # It should only be run during development when new test files are needed # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (hl_gen_test_ds gen_test_ds.c) - target_include_directories(hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ds STATIC) target_link_libraries (hl_gen_test_ds PRIVATE ${HDF5_HL_LIB_TARGET} @@ -77,7 +83,7 @@ if (HDF5_BUILD_GENERATORS) set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) add_executable (hl_gen_test_ld gen_test_ld.c) - target_include_directories(hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ld STATIC) target_link_libraries (hl_gen_test_ld PRIVATE ${HDF5_HL_LIB_TARGET} 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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${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 $ testfiles/image1.gif image1.h5) +add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) +add_test (NAME HL_TOOLS_h52gif COMMAND $ 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 $ testfiles/h52giftst.h5 image.gif -i nosuch_image) +add_test (NAME HL_TOOLS_h52gif_none COMMAND $ 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 $ testfiles/h52giftst.h5 image.gif -i palette) +#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") -add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ 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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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};$<$:${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=$" + -D "TEST_PROGRAM=$" -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=$" + -D "TEST_PROGRAM=$" -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=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java index 3a1361a..17a81e9 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -262,7 +262,7 @@ public class HDF5LibraryException extends HDF5Exception { return "unrecognized message"; } else if (err_code == HDF5Constants.H5E_CANTDELETE) { - return " Can't delete message"; + return "Can't delete message"; } else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) { return "Can't open object"; diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index ca48fa6..f3e6012 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -74,7 +74,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) ########### JNI libraries always must be built shared ############### add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) -target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} +target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a3f2232..fef4c63 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,24 @@ New Features Configuration: ------------- + - Add option to build only shared libs + + A request was made to prevent building static libraries and only build + shared. A new option was added to CMake, ONLY_SHARED_LIBS, which will + skip building static libraries. Certain utility functions will build with + static libs but are not published. Tests are adjusted to use the correct + libraries. + + (ADB - 2019/06/12, HDFFV-10805) + + - Change tools test that test the error stack + + There are some use cases which can cause the error stack of tools to be + different then the expected. These tests now use grepTest.cmake, this was + changed to allow the error file to be searched for an expected string. + + (ADB - 2019/04/15, HDFFV-10741) + - Rework CMake command files to fix MPI testing. Added setup fixture to remove any test generated files and added DEPENDS diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01434ba..aff732d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -930,7 +930,7 @@ endif () if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) - target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect @@ -1020,7 +1020,7 @@ else () endif () add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings @@ -1060,41 +1060,48 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) -add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) - -add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) -target_include_directories(${HDF5_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -target_compile_definitions(${HDF5_LIB_TARGET} - PUBLIC - ${HDF_EXTRA_C_FLAGS} - ${HDF_EXTRA_FLAGS} - $,DEBUG,NDEBUG> - PRIVATE - $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> -) -TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_LIB_TARGET} - PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" - PUBLIC $<$>:${CMAKE_DL_LIBS}> -) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) -add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) - -set (install_targets ${HDF5_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) + add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) + + add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + target_include_directories (${HDF5_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_LIB_TARGET} + PUBLIC + ${HDF_EXTRA_C_FLAGS} + ${HDF_EXTRA_FLAGS} + $,DEBUG,NDEBUG> + PRIVATE + $<$:H5_DEBUG_API> # Enable tracing of the API + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + ) + TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_LIB_TARGET} + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" + PUBLIC $<$>:${CMAKE_DL_LIBS}> + ) + if (NOT WIN32) + target_link_libraries (${HDF5_LIB_TARGET} + PRIVATE $<$:Threads::Threads> + ) + endif () + set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) + add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) + + set (install_targets ${HDF5_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) - target_include_directories(${HDF5_LIBSH_TARGET} + target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -1111,8 +1118,8 @@ if (BUILD_SHARED_LIBS) ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} - PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" - PUBLIC $<$>:${CMAKE_DL_LIBS}> $<$:Threads::Threads> + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" $<$:Threads::Threads> + PUBLIC $<$>:${CMAKE_DL_LIBS}> ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") @@ -1145,7 +1152,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) endif () - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + endif () install ( TARGETS @@ -1174,7 +1183,9 @@ foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS}) set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") endforeach () -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}") endif () diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 42fc3a6..5b34ec5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,29 +23,32 @@ set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/swmr_common.h ) -add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) -target_include_directories(${HDF5_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_TEST_LIB_TARGET} - PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} - PRIVATE $<$:ws2_32.lib> -) -if (MINGW) - target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) + target_include_directories (${HDF5_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_TEST_LIB_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} + PRIVATE $<$:ws2_32.lib> + ) + if (MINGW) + target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") + endif () + H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test) endif () -H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0) if (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) - target_include_directories(${HDF5_TEST_LIBSH_TARGET} + target_include_directories (${HDF5_TEST_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$:H5_HAVE_THREADSAFE> + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} @@ -85,9 +88,9 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) - target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED) - target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -110,9 +113,9 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) - target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED) - target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -241,17 +244,15 @@ set (H5_TESTS macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - target_include_directories(${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${file} STATIC) - target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) - set_target_properties (${file} PROPERTIES FOLDER test) - if (BUILD_SHARED_LIBS) - add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c) - target_include_directories(${file}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${file}-shared SHARED) - target_link_libraries (${file}-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - set_target_properties (${file}-shared PROPERTIES FOLDER test) + target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${file} SHARED) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () + set_target_properties (${file} PROPERTIES FOLDER test) endmacro () set (H5_TESTS_MULTIPLE @@ -273,61 +274,58 @@ endforeach () ######### Also special handling of link libs ############# #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) -target_include_directories(direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (direct_chunk STATIC) -target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) -set_target_properties (direct_chunk PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (direct_chunk-shared ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) - target_include_directories(direct_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (direct_chunk-shared SHARED) - target_link_libraries (direct_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS}) - set_target_properties (direct_chunk-shared PROPERTIES FOLDER test) +target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (direct_chunk STATIC) + target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) +else () + TARGET_C_PROPERTIES (direct_chunk SHARED) + target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS}) endif () +set_target_properties (direct_chunk PROPERTIES FOLDER test) ######### Special handling for multiple sources ############# #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) -target_include_directories(testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (testhdf5 STATIC) -target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET}) -set_target_properties (testhdf5 PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (testhdf5-shared ${testhdf5_SOURCES}) - target_include_directories(testhdf5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (testhdf5-shared SHARED) - target_link_libraries (testhdf5-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - set_target_properties (testhdf5-shared PROPERTIES FOLDER test) +target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (testhdf5 STATIC) + target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (testhdf5 SHARED) + target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (testhdf5 PROPERTIES FOLDER test) #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) -target_include_directories(cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (cache_image STATIC) -target_link_libraries (cache_image PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (cache_image PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (cache_image-shared ${cache_image_SOURCES}) - target_include_directories(cache_image-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cache_image-shared SHARED) - target_link_libraries (cache_image-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (cache_image-shared PROPERTIES FOLDER test) +target_include_directories (cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cache_image STATIC) + target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (cache_image SHARED) + target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (cache_image PROPERTIES FOLDER test) #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) -target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (ttsafe STATIC) -target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (ttsafe PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (ttsafe-shared ${ttsafe_SOURCES}) - target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ttsafe-shared SHARED) - target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (ttsafe-shared PROPERTIES FOLDER test) +target_include_directories (ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (ttsafe STATIC) + target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIB_TARGET}) + if (NOT WIN32) + target_link_libraries (ttsafe + PRIVATE $<$:Threads::Threads> + ) + endif () +else () + TARGET_C_PROPERTIES (ttsafe SHARED) + target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$:Threads::Threads>) endif () +set_target_properties (ttsafe PROPERTIES FOLDER test) ############################################################################## ### A D D I T I O N A L T E S T S ### @@ -397,31 +395,27 @@ endforeach () # This has to be copied to the test directory for execve() to find it # and it can't be renamed (i.e., no -shared). add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c) -target_include_directories(accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (accum_swmr_reader STATIC) -target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (accum_swmr_reader STATIC) + target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (accum_swmr_reader SHARED) + target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (accum_swmr_reader PROPERTIES FOLDER test) #-- Set accum dependencies set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader) -if (BUILD_SHARED_LIBS) - set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader) -endif () ############################################################################## ### P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (filter_plugin SHARED) - target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET}) - set_target_properties (filter_plugin PROPERTIES FOLDER test) -else () - add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (filter_plugin STATIC) - target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) endif () @@ -430,44 +424,38 @@ endif () ############################################################################## set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) -target_include_directories(use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (use_append_chunk STATIC) -target_link_libraries (use_append_chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (use_append_chunk PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES}) - target_include_directories(use_append_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (use_append_chunk-shared SHARED) - target_link_libraries (use_append_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test) +target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_append_chunk STATIC) + target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_append_chunk SHARED) + target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (use_append_chunk PROPERTIES FOLDER test) set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) -target_include_directories(use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (use_append_mchunks STATIC) -target_link_libraries (use_append_mchunks PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (use_append_mchunks PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES}) - target_include_directories(use_append_mchunks-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED) - target_link_libraries (use_append_mchunks-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test) +target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_append_mchunks STATIC) + target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_append_mchunks SHARED) + target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (use_append_mchunks PROPERTIES FOLDER test) set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) -target_include_directories(use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) -target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES}) - target_include_directories(use_disable_mdc_flushes-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED) - target_link_libraries (use_disable_mdc_flushes-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test) +target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) + target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_disable_mdc_flushes SHARED) + target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) include (CMakeTests.cmake) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index eccf9d4..9a5791a 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -20,11 +20,6 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files") -if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files") -endif () # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory @@ -39,20 +34,9 @@ add_custom_command ( COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "$" "${PROJECT_BINARY_DIR}/H5TEST/accum_swmr_reader" ) -if (BUILD_SHARED_LIBS) - add_custom_command ( - TARGET accum_swmr_reader - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${PROJECT_BINARY_DIR}/H5TEST-shared/accum_swmr_reader" - ) -endif () foreach (h5_tfile ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files") - endif () endforeach () # -------------------------------------------------------------------- @@ -68,9 +52,6 @@ set (HDF5_REFERENCE_FILES foreach (ref_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files") - endif () endforeach () # -------------------------------------------------------------------- @@ -130,10 +111,6 @@ set (HDF5_REFERENCE_PLIST_FILES foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIB_files") HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIBSH_files") - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIBSH_files") - endif () endforeach () # -------------------------------------------------------------------- @@ -194,38 +171,35 @@ set (HDF5_REFERENCE_TEST_FILES foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files") - endif () endforeach () add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) -if (BUILD_SHARED_LIBS) - add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list}) -endif () + +set (testhdf5_CLEANFILES + coord.h5 + dtypes10.h5 + sys_file1 + tattr.h5 + tfile1.h5 + tfile2.h5 + tfile3.h5 + tfile4.h5 + tfile5.h5 + tfile6.h5 + tfile7.h5 + tfilespace.h5 + th5o_file + th5s1.h5 + tselect.h5 + tsohm.h5 + tsohm_dst.h5 + tsohm_src.h5 +) # Remove any output file left over from previous test run add_test (NAME H5TEST-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} - -E remove - coord.h5 - dtypes10.h5 - sys_file1 - tattr.h5 - tfile1.h5 - tfile2.h5 - tfile3.h5 - tfile4.h5 - tfile5.h5 - tfile6.h5 - tfile7.h5 - tfilespace.h5 - th5o_file - th5s1.h5 - tselect.h5 - tsohm.h5 - tsohm_dst.h5 - tsohm_src.h5 + -E remove ${testhdf5_CLEANFILES} WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -255,59 +229,6 @@ set_tests_properties (H5TEST-testhdf5-select PROPERTIES ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -if (NOT HDF5_ENABLE_USING_MEMCHECKER) - if (BUILD_SHARED_LIBS) - add_test (NAME H5TEST-shared-clear-testhdf5-objects - COMMAND ${CMAKE_COMMAND} - -E remove - coord.h5 - dtypes10.h5 - sys_file1 - tattr.h5 - tfile1.h5 - tfile2.h5 - tfile3.h5 - tfile4.h5 - tfile5.h5 - tfile6.h5 - tfile7.h5 - tfilespace.h5 - th5o_file - th5s1.h5 - tselect.h5 - tsohm.h5 - tsohm_dst.h5 - tsohm_src.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP shared_clear_testhdf5) - add_test (NAME H5TEST-shared-testhdf5-base COMMAND $ -x heap -x file -x select) - set_tests_properties (H5TEST-shared-testhdf5-base PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - add_test (NAME H5TEST-shared-testhdf5-heap COMMAND $ -o heap) - set_tests_properties (H5TEST-shared-testhdf5-heap PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - add_test (NAME H5TEST-shared-testhdf5-file COMMAND $ -o file) - set_tests_properties (H5TEST-shared-testhdf5-file PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - add_test (NAME H5TEST-shared-testhdf5-select COMMAND $ -o select) - set_tests_properties (H5TEST-shared-testhdf5-select PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () -endif () ############################################################################## ############################################################################## @@ -565,6 +486,7 @@ foreach (h5_test ${H5_TESTS}) -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=${h5_test}.txt" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" #-D "TEST_REFERENCE=${test}.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" @@ -584,49 +506,6 @@ set_tests_properties (H5TEST-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) -if (BUILD_SHARED_LIBS) - # Remove any output file left over from previous test run - add_test (NAME H5TEST-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects) - - foreach (h5_test ${H5_TESTS}) - if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) - if ("${h5_test}" STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-shared-${h5_test} - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" - ) - else () - add_test (NAME H5TEST-shared-${h5_test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${h5_test}.txt" - #-D "TEST_REFERENCE=${test}.out" - -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (H5TEST-shared-${h5_test} PROPERTIES - FIXTURES_REQUIRED shared_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () - endforeach () - - set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) -endif () - #-- Adding test for cache if (NOT CYGWIN) add_test (NAME H5TEST-clear-cache-objects @@ -660,56 +539,22 @@ if (NOT CYGWIN) endif () if (TEST_CACHE_IMAGE) -#-- Adding test for cache_image -add_test ( - NAME H5TEST-clear-cache_image-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_image_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) -add_test (NAME H5TEST-cache_image COMMAND $) -set_tests_properties (H5TEST-cache_image PROPERTIES - FIXTURES_REQUIRED cache_image_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) -endif () - -if (BUILD_SHARED_LIBS) - #-- Adding test for cache - if (NOT CYGWIN AND NOT WIN32) - add_test (NAME H5TEST-shared-clear-cache-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP shared_cache_clear_objects) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-shared-cache COMMAND $) - else () - add_test (NAME H5TEST-shared-cache COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=cache-shared.txt" - #-D "TEST_REFERENCE=cache-shared.out" - -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (H5TEST-shared-cache PROPERTIES - FIXTURES_REQUIRED shared_cache_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - endif () + #-- Adding test for cache_image + add_test ( + NAME H5TEST-clear-cache_image-objects + COMMAND ${CMAKE_COMMAND} + -E remove + cache_image_test.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) + add_test (NAME H5TEST-cache_image COMMAND $) + set_tests_properties (H5TEST-cache_image PROPERTIES + FIXTURES_REQUIRED cache_image_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) endif () #-- Adding test for flush1/2 @@ -777,7 +622,6 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES WILL_FAIL "true" ) - ############################################################################## ############################################################################## ### A D D I T I O N A L T E S T S ### @@ -921,130 +765,38 @@ add_test (NAME H5TEST-clear-links_env-objects ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects) -add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" - -D "TEST_ENV_VALUE:STRING=.:tmp" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=links_env.txt" - -D "TEST_REFERENCE=links_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" -) -set_tests_properties (H5TEST-links_env PROPERTIES - FIXTURES_REQUIRED links_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -#-- Adding test for libinfo -add_test (NAME H5TEST-testlibinfo - COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -if (BUILD_SHARED_LIBS) - #-- Adding test for err_compat - if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - add_test (NAME H5TEST-shared-clear-err_compat-objects - COMMAND ${CMAKE_COMMAND} - -E remove - err_compat.txt - err_compat.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-err_compat-objects PROPERTIES FIXTURES_SETUP shared_err_compat_clear_objects) - add_test (NAME H5TEST-shared-err_compat COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "ERROR_APPEND=1" - -D "TEST_OUTPUT=err_compat.txt" - -D "TEST_REFERENCE=err_compat_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-err_compat PROPERTIES - FIXTURES_REQUIRED shared_err_compat_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () - - #-- Adding test for error_test - add_test (NAME H5TEST-shared-clear-error_test-objects - COMMAND ${CMAKE_COMMAND} - -E remove - error_test.txt - error_test.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects) - if (HDF5_USE_16_API_DEFAULT) - add_test ( - NAME H5TEST-shared-error_test - COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" - ) - set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED) - else () - add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "ERROR_APPEND=1" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-error_test PROPERTIES - FIXTURES_REQUIRED shared_error_test_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () - - #-- Adding test for links_env - add_test (NAME H5TEST-shared-clear-links_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove - links_env.txt - links_env.txt.err - extlinks_env0.h5 - extlinks_env1.h5 - tmp/extlinks_env1.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-links_env-objects PROPERTIES FIXTURES_SETUP shared_links_env_clear_objects) - add_test (NAME H5TEST-shared-links_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-links_env COMMAND $) +else () + add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" - -D "TEST_ENV_VALUE:STRING=.:tmp" + #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" + #-D "TEST_ENV_VALUE:STRING=.:tmp" -D "TEST_EXPECT=0" -D "TEST_OUTPUT=links_env.txt" -D "TEST_REFERENCE=links_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5TEST-shared-links_env PROPERTIES - FIXTURES_REQUIRED shared_links_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) +endif () +set_tests_properties (H5TEST-links_env PROPERTIES + FIXTURES_REQUIRED links_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (NOT BUILD_SHARED_LIBS) #-- Adding test for libinfo - add_test (NAME H5TEST-shared-testlibinfo + add_test (NAME H5TEST-testlibinfo + COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +else () + #-- Adding test for libinfo + add_test (NAME H5TEST-testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () @@ -1094,9 +846,6 @@ if (ENABLE_EXTENDED_TESTS) #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") - if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/flushrefresh_test") - endif () find_package (Perl) if (PERL_FOUND) add_test (NAME H5TEST-clear-testflushrefresh-objects @@ -1127,10 +876,10 @@ if (ENABLE_EXTENDED_TESTS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) - else () - message (STATUS "Cannot execute TEST flushrefresh - perl not found") endif () -endif() +else () + message (STATUS "Cannot execute TEST flushrefresh - perl not found") +endif () ############################################################################## ############################################################################## @@ -1148,10 +897,10 @@ endif () ############################################################################## ############################################################################## -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${genfile} STATIC) target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 64ccacd..5f02c9f 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -34,37 +34,23 @@ foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files") - if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files") - endif () endforeach () foreach (vfdtest ${VFD_LIST}) foreach (h5_tfile ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () foreach (vfdtest ${VFD_LIST}) foreach (ref_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () foreach (vfdtest ${VFD_LIST}) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () @@ -72,17 +58,10 @@ foreach (vfdtest ${VFD_LIST}) foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIB_files") HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIBSH_files") - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIB tests" DEPENDS ${HDF5_VFDTEST_LIB_files_list}) -if (BUILD_SHARED_LIBS) - add_custom_target(HDF5_VFDTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIBSH tests" DEPENDS ${HDF5_VFDTEST_LIBSH_files_list}) -endif () ############################################################################## ############################################################################## @@ -134,39 +113,10 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () else () add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}" ) - if (BUILD_SHARED_LIBS) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared" - ) - endif () endif () else () add_test ( @@ -191,30 +141,6 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () endif () else () add_test ( @@ -239,80 +165,32 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache") - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () endif () endmacro () macro (DO_VFD_TEST vfdtest vfdname resultcode) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} - ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () + add_test ( + NAME VFD-${vfdname}-${vfdtest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-${vfdtest}.out + ${vfdname}/${vfdname}-${vfdtest}.out.err + ) + add_test (NAME VFD-${vfdname}-${vfdtest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} + ) endmacro () macro (ADD_VFD_TEST vfdname resultcode) @@ -332,15 +210,6 @@ endif () if (NOT CYGWIN) set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () - if (BUILD_SHARED_LIBS) - set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared) - set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - if (NOT CYGWIN AND NOT WIN32) - set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - endif () - endif () if (HDF5_TEST_FHEAP_VFD) add_test ( NAME VFD-${vfdname}-fheap-clear-objects @@ -365,31 +234,6 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-fheap-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-fheap-shared.out - ${vfdname}-shared/${vfdname}-fheap-shared.out.err - ) - add_test (NAME VFD-${vfdname}-fheap-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-fheap-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES - DEPENDS VFD-${vfdname}-fheap-shared-clear-objects - TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () endif () endmacro () diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 96ce0c0..1aecef6 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -22,24 +22,38 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) -target_include_directories(testphdf5 +target_include_directories (testphdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -TARGET_C_PROPERTIES (testphdf5 STATIC) -target_link_libraries (testphdf5 - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" -) +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (testphdf5 STATIC) + target_link_libraries (testphdf5 + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) +else () + TARGET_C_PROPERTIES (testphdf5 SHARED) + target_link_libraries (testphdf5 + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) +endif () set_target_properties (testphdf5 PROPERTIES FOLDER test/par) MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) - target_include_directories(${file} + target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) - TARGET_C_PROPERTIES (${file} STATIC) - target_link_libraries (${file} - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" - ) + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) + else () + TARGET_C_PROPERTIES (${file} SHARED) + target_link_libraries (${file} + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) + endif () set_target_properties (${file} PROPERTIES FOLDER test/par) ENDMACRO (ADD_H5P_EXE file) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index b4c8111..0702d13 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -18,8 +18,7 @@ # Remove any output file left over from previous test run add_test (NAME MPI_TEST-clear-testphdf5-objects COMMAND ${CMAKE_COMMAND} - -E remove - ParaTest.h5 + -E remove ParaTest.h5 WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index c0b848b..7333c6d 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -44,8 +44,8 @@ endforeach () NAME MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ${vfdname}-shared/${vfdname}-${h5_test}.out - ${vfdname}-shared/${vfdname}-${h5_test}.out.err + ${vfdname}/${vfdname}-${h5_test}.out + ${vfdname}/${vfdname}-${h5_test}.out.err ) add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 1596ea7..e9dfcaa 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -32,25 +32,27 @@ set (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h ) -add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) -target_include_directories(${HDF5_TOOLS_LIB_TARGET} - PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>) -TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_TOOLS_LIB_TARGET} - PUBLIC ${HDF5_LIB_TARGET} - PRIVATE "$<$:${MPI_C_LIBRARIES}>" -) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools) -set (install_targets ${HDF5_TOOLS_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) + target_include_directories (${HDF5_TOOLS_LIB_TARGET} + PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>) + TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_TOOLS_LIB_TARGET} + PUBLIC ${HDF5_LIB_TARGET} + PRIVATE "$<$:${MPI_C_LIBRARIES}>" + ) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools) + set (install_targets ${HDF5_TOOLS_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) - target_include_directories(${HDF5_TOOLS_LIBSH_TARGET} + target_include_directories (${HDF5_TOOLS_LIBSH_TARGET} PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -82,7 +84,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) endif () - INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) + endif () install ( TARGETS diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 10b3f3d..85233ef 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5COPY C) # -------------------------------------------------------------------- # Add the h5copy and test executables # -------------------------------------------------------------------- -add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) -target_include_directories(h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5copy STATIC) -target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5copy PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) + target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5copy STATIC) + target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5copy PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") -set (H5_DEP_EXECUTABLES h5copy) + set (H5_DEP_EXECUTABLES h5copy) +endif () if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - target_include_directories(h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5copy-shared SHARED) target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5copy-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 671e6b6..96ed6ad 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -4,24 +4,25 @@ project (HDF5_TOOLS_SRC_H5DIFF C) # -------------------------------------------------------------------- # Add the h5diff executables # -------------------------------------------------------------------- -add_executable (h5diff - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c -) -target_include_directories(h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5diff STATIC) -target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5diff PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") - -set (H5_DEP_EXECUTABLES h5diff) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5diff + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c + ) + target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5diff STATIC) + target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5diff PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") + set (H5_DEP_EXECUTABLES h5diff) +endif () if (BUILD_SHARED_LIBS) add_executable (h5diff-shared ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) - target_include_directories(h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5diff-shared SHARED) target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5diff-shared PROPERTIES FOLDER tools) @@ -31,15 +32,30 @@ if (BUILD_SHARED_LIBS) endif () if (H5_HAVE_PARALLEL) - add_executable (ph5diff - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c - ) - target_include_directories(ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ph5diff STATIC) - target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") - set_target_properties (ph5diff PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") + if (NOT ONLY_SHARED_LIBS) + add_executable (ph5diff + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c + ) + target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (ph5diff STATIC) + target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") + set_target_properties (ph5diff PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff) + endif () + if (BUILD_SHARED_LIBS) + add_executable (ph5diff-shared + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c + ) + target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (ph5diff-shared SHARED) + target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>") + set_target_properties (ph5diff-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff-shared") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff-shared) + endif () endif () ############################################################################## @@ -63,16 +79,4 @@ if (HDF5_EXPORTED_TARGETS) ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) - - if (H5_HAVE_PARALLEL) - #INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) - - install ( - TARGETS - ph5diff - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications - ) - endif () endif () diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 25166c7..383b04e 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5DUMP C) # -------------------------------------------------------------------- # Add the h5dump executables # -------------------------------------------------------------------- -add_executable (h5dump - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c -) -target_include_directories(h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5dump STATIC) -target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5dump PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5dump + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c + ) + target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5dump STATIC) + target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5dump PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") -set (H5_DEP_EXECUTABLES h5dump) + set (H5_DEP_EXECUTABLES h5dump) +endif () if (BUILD_SHARED_LIBS) add_executable (h5dump-shared @@ -23,7 +25,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) - target_include_directories(h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5dump-shared SHARED) target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5dump-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 79a1316..540be8c 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -4,14 +4,26 @@ project (HDF5_TOOLS_SRC_H5FC C) # -------------------------------------------------------------------- # Add the h5format_convert executables # -------------------------------------------------------------------- -add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) -target_include_directories(h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5format_convert STATIC) -target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5format_convert PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) + target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5format_convert STATIC) + target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5format_convert PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") -set (H5_DEP_EXECUTABLES h5format_convert) + set (H5_DEP_EXECUTABLES h5format_convert) +endif () +if (BUILD_SHARED_LIBS) + add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) + target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5format_convert-shared SHARED) + target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5format_convert-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5format_convert-shared) +endif () ############################################################################## ############################################################################## diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index 7b38420..dd7921d 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -4,15 +4,29 @@ project (HDF5_TOOLS_SRC_H5IMPORT C) # -------------------------------------------------------------------- # Add the h5import executables # -------------------------------------------------------------------- -add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) -target_include_directories(h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5import STATIC) -target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -#set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) -set_target_properties (h5import PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) + target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5import STATIC) + target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) + set_target_properties (h5import PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") -set (H5_DEP_EXECUTABLES h5import) + set (H5_DEP_EXECUTABLES h5import) +endif () + +if (BUILD_SHARED_LIBS) + add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) + target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5import-shared SHARED) + target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + #set_target_properties (h5import-shared PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) + set_target_properties (h5import-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5import-shared) +endif () ############################################################################## ############################################################################## diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index c455b2f..f430417 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -4,24 +4,47 @@ project (HDF5_TOOLS_SRC_H5JAM C) # -------------------------------------------------------------------- # Add the h5jam executables # -------------------------------------------------------------------- -add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) -target_include_directories(h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5jam STATIC) -target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5jam PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") - -add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) -target_include_directories(h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5unjam STATIC) -target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5unjam PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") - -set (H5_DEP_EXECUTABLES - h5jam - h5unjam -) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) + target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5jam STATIC) + target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5jam PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") + + add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) + target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5unjam STATIC) + target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5unjam PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") + + set (H5_DEP_EXECUTABLES + h5jam + h5unjam + ) +endif () + +if (BUILD_SHARED_LIBS) + add_executable (h5jam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) + target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5jam-shared SHARED) + target_link_libraries (h5jam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5jam-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam-shared") + + add_executable (h5unjam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) + target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5unjam-shared SHARED) + target_link_libraries (h5unjam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5unjam-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h5jam-shared + h5unjam-shared + ) +endif () ############################################################################## ############################################################################## diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 5b31b84..f2470fb 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5LS C) #----------------------------------------------------------------------------- # Add the h5ls executable #----------------------------------------------------------------------------- -add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) -target_include_directories(h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5ls STATIC) -target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5ls PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) + target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5ls STATIC) + target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5ls PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") -set (H5_DEP_EXECUTABLES h5ls) + set (H5_DEP_EXECUTABLES h5ls) +endif () if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - target_include_directories(h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5ls-shared SHARED) target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5ls-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index c0cd558..4a1430e 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -14,18 +14,20 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) -add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) -target_include_directories(h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5repack STATIC) -target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5repack PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") - -set (H5_DEP_EXECUTABLES h5repack) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) + target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5repack STATIC) + target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5repack PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") + + set (H5_DEP_EXECUTABLES h5repack) +endif () if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - target_include_directories(h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5repack-shared SHARED) target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repack-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 56c172c..55c675f 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5STAT C) # -------------------------------------------------------------------- # Add the h5stat executables # -------------------------------------------------------------------- -add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) -target_include_directories(h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5stat STATIC) -target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5stat PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) + target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5stat STATIC) + target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5stat PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") -set (H5_DEP_EXECUTABLES h5stat) + set (H5_DEP_EXECUTABLES h5stat) +endif () if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - target_include_directories(h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5stat-shared SHARED) target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5stat-shared PROPERTIES FOLDER tools) diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 937799f..7c3d7f0 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -5,40 +5,78 @@ project (HDF5_TOOLS_SRC_MISC C) # Add the misc executables # -------------------------------------------------------------------- #-- Misc Executables -add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) -target_include_directories(h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5debug STATIC) -target_link_libraries (h5debug PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5debug PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) + target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5debug STATIC) + target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5debug PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") -add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) -target_include_directories(h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5repart STATIC) -target_link_libraries (h5repart PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5repart PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") + add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) + target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5repart STATIC) + target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5repart PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") -add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) -target_include_directories(h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5mkgrp STATIC) -target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5mkgrp PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") + add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) + target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5mkgrp STATIC) + target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5mkgrp PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") -add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) -target_include_directories(h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5clear STATIC) -target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5clear PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") + add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) + target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5clear STATIC) + target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5clear PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") -set (H5_DEP_EXECUTABLES - h5debug - h5repart - h5mkgrp - h5clear -) + set (H5_DEP_EXECUTABLES + h5debug + h5repart + h5mkgrp + h5clear + ) +endif () +if (BUILD_SHARED_LIBS) + add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) + target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5debug-shared SHARED) + target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5debug-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared") + + add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) + target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5repart-shared SHARED) + target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5repart-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared") + + add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) + target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5mkgrp-shared SHARED) + target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared") + + add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) + target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5clear-shared SHARED) + target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5clear-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h5debug-shared + h5repart-shared + h5mkgrp-shared + h5clear-shared + ) +endif () #----------------------------------------------------------------------------- # Generate the h5cc file containing settings needed to compile programs diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index a71a12a..ecf371f 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5COPY C) # -------------------------------------------------------------------- # Add the h5copy test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c) - target_include_directories(h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5copygentest STATIC) target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) @@ -18,15 +18,15 @@ endif () # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5COPY_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy") + set (H5COPY_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5COPY_TOOL_PLUGIN_LIB_CORENAME}") + set (H5COPY_TOOL_PLUGIN_LIB_TARGET ${H5COPY_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) + target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5COPY_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 85a8788..856aa72 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -45,6 +45,12 @@ endforeach () add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list}) + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -52,7 +58,7 @@ ############################################################################## # - # Perform h5copy according to passing parmeters + # Perform h5copy according to passing parameters # macro (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -67,7 +73,7 @@ add_test ( NAME H5COPY_F-${testname} - COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -81,7 +87,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_F-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) if (${resultcode} EQUAL 1) @@ -103,7 +109,7 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -117,7 +123,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -149,7 +155,7 @@ add_test ( NAME H5COPY-${testname}-prefill - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -161,14 +167,14 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -190,7 +196,7 @@ add_test ( NAME H5COPY_SAME-${testname}-prefill - COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -202,14 +208,14 @@ add_test ( NAME H5COPY_SAME-${testname} - COMMAND $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_SAME-${testname}-DIFF - COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) if (${resultcode} EQUAL 1) @@ -225,7 +231,7 @@ macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) + add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () @@ -245,7 +251,7 @@ add_test ( NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${testname}.out.out" diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index c0aac36..0a874ec 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5DIFF C) # -------------------------------------------------------------------- # Add the h5diff and test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - target_include_directories(h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5diffgentest STATIC) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) @@ -18,15 +18,15 @@ endif () # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5DIFF_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") + set (H5DIFF_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}") + set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) + target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5DIFF_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 6bce3f7..bbde8f4 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -343,6 +343,12 @@ endif () add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list}) + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -352,7 +358,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -375,7 +381,7 @@ add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 51938ae..1672774 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5DUMP C) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5DUMP_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (H5DUMP_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}") + set (H5DUMP_TOOL_PLUGIN_LIB_TARGET ${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -21,23 +21,23 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5DUMP_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () # -------------------------------------------------------------------- # Add the h5dump test executable # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - target_include_directories(h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5dumpgentest STATIC) - target_link_libraries (h5dumpgentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5dumpgentest COMMAND $) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index ed3449b..81179e3 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -399,10 +399,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -423,7 +429,7 @@ add_test ( NAME H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=h5dump-${testname}.out" @@ -452,7 +458,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -473,7 +479,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -488,7 +494,7 @@ macro (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") @@ -509,7 +515,7 @@ add_test ( NAME H5DUMP-N-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}-N.out" @@ -524,7 +530,7 @@ macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -545,7 +551,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -567,7 +573,7 @@ macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -589,7 +595,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -625,7 +631,7 @@ set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-output-${resultfile} - COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile} + COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile} ) set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects) @@ -653,7 +659,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -666,7 +672,7 @@ endif () endmacro () - macro (ADD_H5ERR_MASK_TEST resultfile resultcode) + macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -680,21 +686,20 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () - macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) + macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -708,17 +713,16 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" + -D "TEST_ERRREF=${result_errcheck}" -D "TEST_ENV_VAR:STRING=${envvar}" -D "TEST_ENV_VALUE:STRING=${envval}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () @@ -739,7 +743,7 @@ add_test ( NAME H5DUMP-IMPORT-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${conffile}.out" @@ -771,7 +775,7 @@ add_test ( NAME H5DUMP_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -1197,12 +1201,12 @@ # test for displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups - ADD_H5ERR_MASK_TEST (tgroup-2 1 --enable-error-stack --group=/g2 --group / -g /y tgroup.h5) + ADD_H5ERR_MASK_TEST (tgroup-2 1 "h5dump error: unable to open group \"/y\"" --enable-error-stack --group=/g2 --group / -g /y tgroup.h5) # test for displaying simple space datasets ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5) # test for displaying selected datasets - ADD_H5ERR_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) + ADD_H5ERR_MASK_TEST (tdset-2 1 "h5dump error: unable to get link info from \"dset3\"" --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) # test for displaying attributes ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5) @@ -1210,7 +1214,7 @@ ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /\\\\/attr1 --attribute /attr4 --attribute=/attr5 tattr.h5) ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5) # test for header and error messages - ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) + ADD_H5ERR_MASK_TEST (tattr-3 1 "h5dump error: unable to open attribute \"attr\"" --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) # test for displaying at least 9 attributes on root from a be machine ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5) # test for displaying attributes in shared datatype (also in group and dataset) @@ -1224,7 +1228,7 @@ ADD_H5_TEST_N (tslink-2 0 --enable-error-stack -N slink2 tslink.h5) ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5) # test for displaying dangling soft links - ADD_H5ERR_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5) + ADD_H5ERR_MASK_TEST (tslink-D 0 "component not found" --enable-error-stack -d /slink1 tslink.h5) # tests for hard links ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5) @@ -1241,7 +1245,7 @@ ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5) # test for unamed type - ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") + ADD_H5ERR_MASK_TEST (tcomp-3 0 "object '#6632' doesn't exist" "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) ADD_H5_TEST (tcompound_complex2 0 --enable-error-stack tcompound_complex2.h5) @@ -1257,7 +1261,7 @@ ADD_H5_TEST (tnestedcmpddt 0 --enable-error-stack tnestedcmpddt.h5) # test for options - ADD_H5ERR_MASK_TEST (tall-1 0 --enable-error-stack tall.h5) + ADD_H5ERR_MASK_TEST (tall-1 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack tall.h5) ADD_H5_TEST (tall-2 0 --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5) ADD_H5_TEST (tall-3 0 --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5) ADD_H5_TEST_N (tall-3 0 --enable-error-stack -N /g2/dset2.1 -N /g1/g1.2/g1.2.1/slink tall.h5) @@ -1288,7 +1292,7 @@ # test for files with array data ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5) # # added for bug# 2092 - tarray1_big.h5 - ADD_H5ERR_MASK_TEST (tarray1_big 0 --enable-error-stack -R tarray1_big.h5) + ADD_H5ERR_MASK_TEST (tarray1_big 0 "Undefined reference pointer" --enable-error-stack -R tarray1_big.h5) ADD_H5_TEST (tarray2 0 --enable-error-stack tarray2.h5) ADD_H5_TEST (tarray3 0 --enable-error-stack tarray3.h5) ADD_H5_TEST (tarray4 0 --enable-error-stack tarray4.h5) @@ -1317,13 +1321,13 @@ ADD_H5_TEST (tlarge_objname 0 --enable-error-stack -w157 tlarge_objname.h5) # test '-A' to suppress data but print attr's - ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5) + ADD_H5ERR_MASK_TEST (tall-2A 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A tall.h5) # test '-A' to suppress attr's but print data - ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5) + ADD_H5ERR_MASK_TEST (tall-2A0 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A 0 tall.h5) # test '-r' to print attributes in ASCII instead of decimal - ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5) + ADD_H5ERR_MASK_TEST (tall-2B 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A -r tall.h5) # test Subsetting ADD_H5_TEST (tall-4s 0 --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5) @@ -1352,7 +1356,7 @@ ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5) # test -p with a non existing dataset - ADD_H5ERR_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5) + ADD_H5ERR_MASK_TEST (tperror 1 "h5dump error: unable to get link info from \"bogus\"" --enable-error-stack -p -d bogus tfcontents1.h5) # test for file contents ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) @@ -1499,9 +1503,9 @@ # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) - ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) + ADD_H5ERR_MASK_TEST (tdataregR 0 "Undefined reference pointer" --enable-error-stack -R tdatareg.h5) ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5) - ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5) + ADD_H5ERR_MASK_TEST (tattrregR 0 "Undefined reference pointer" -R --enable-error-stack tattrreg.h5) ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o) # tests for group creation order @@ -1519,21 +1523,21 @@ ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5) # tests for link references and order - ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) - ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) + ADD_H5ERR_MASK_TEST (torderlinks1 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) + ADD_H5ERR_MASK_TEST (torderlinks2 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) # tests for floating point user defined printf format ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5) # tests for traversal of external links - ADD_H5ERR_MASK_TEST (textlinksrc 0 --enable-error-stack textlinksrc.h5) - ADD_H5ERR_MASK_TEST (textlinkfar 0 --enable-error-stack textlinkfar.h5) + ADD_H5ERR_MASK_TEST (textlinksrc 0 "Too many soft links in path" --enable-error-stack textlinksrc.h5) + ADD_H5ERR_MASK_TEST (textlinkfar 0 "Too many soft links in path" --enable-error-stack textlinkfar.h5) # test for dangling external links - ADD_H5ERR_MASK_TEST (textlink 0 --enable-error-stack textlink.h5) + ADD_H5ERR_MASK_TEST (textlink 0 "unable to open external file, external link file name = 'anotherfile'" --enable-error-stack textlink.h5) # test for error stack display (BZ2048) - ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5) + ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "filter plugins disabled" "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5) # test for -o -y for dataset with attributes ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o) diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index a8ccb7d..feb5c68 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -119,10 +119,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -143,7 +149,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index d7e3b88..c557ba4 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -115,10 +115,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -139,7 +145,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" @@ -154,7 +160,7 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -178,7 +184,7 @@ add_test ( NAME H5DUMP_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" -D "TEST_OUTPUT=${resultfile}.out" @@ -195,7 +201,7 @@ macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -216,7 +222,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index e48cec1..a883b86 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -160,6 +160,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -176,7 +182,7 @@ macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) + add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") @@ -197,7 +203,7 @@ add_test ( NAME H5DUMP_XML-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--xml;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 170ba4c..019252f 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -5,16 +5,21 @@ project (HDF5_TOOLS_TEST_H5FC C) # Add the h5format_convert test executables # -------------------------------------------------------------------- add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) -target_include_directories(h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5fc_chk_idx STATIC) -target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5fc_chk_idx STATIC) + target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5fc_chk_idx SHARED) + target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) - target_include_directories(h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5fc_gentest STATIC) - target_link_libraries (h5fc_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5fc_gentest COMMAND $) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 5599c1b..e1abc48 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -97,6 +97,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -121,7 +127,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -136,7 +142,7 @@ add_test ( NAME H5FC-${testname}-NA COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -173,7 +179,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -186,7 +192,7 @@ endif () endmacro () - macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile) + macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode result_errcheck testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -209,15 +215,14 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") set (last_test "H5FC-${testname}-${testfile}") @@ -247,7 +252,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -294,7 +299,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -337,7 +342,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -349,7 +354,7 @@ add_test ( NAME H5FC_CHECK_DUMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}_chk.out" @@ -475,7 +480,7 @@ # # # h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset) - ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v) + ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 "h5format_convert error: unable to downgrade dataset \"/DSET_ERR\"" h5fc_err_level.h5 -v) # # # diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 500be58..9364683 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -5,9 +5,14 @@ project (HDF5_TOOLS_TEST_H5IMPORT C) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c) -target_include_directories(h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5importtest STATIC) -target_link_libraries (h5importtest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5importtest STATIC) + target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5importtest SHARED) + target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5importtest PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 1090640..9d36276 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -95,10 +95,17 @@ ### T H E T E S T S M A C R O S ### ############################################################################## ############################################################################## + + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST testname importfile conffile testfile) # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) if (last_test) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () @@ -116,13 +123,13 @@ ) set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) add_test ( NAME H5IMPORT-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.new" @@ -135,7 +142,7 @@ add_test ( NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.out" @@ -170,7 +177,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" @@ -182,7 +189,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" @@ -196,7 +203,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.imp" @@ -209,7 +216,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dff" @@ -243,7 +250,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;${testname}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testname}.dmp" @@ -256,7 +263,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testname}.bin;-c;${testname}.dmp;-o;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testname}.imp" @@ -268,7 +275,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d-${testname}.dmp" diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index cc70adc..585a8a1 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5JAM C) # -------------------------------------------------------------------- # Add the h5jam test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c) - target_include_directories(h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5jamgentest STATIC) target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) @@ -15,15 +15,25 @@ if (HDF5_BUILD_GENERATORS) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) -target_include_directories(getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (getub STATIC) -target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (getub STATIC) + target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (getub SHARED) + target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (getub PROPERTIES FOLDER tools) add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c) -target_include_directories(tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (tellub STATIC) -target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (tellub STATIC) + target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (tellub SHARED) + target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (tellub PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 677ba5c..84af48b 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -47,6 +47,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + # ============================================================ # TEST_H5JAM_OUTPUT # For the purpose to verify only output & exitcode from h5jam @@ -54,7 +60,7 @@ macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -69,7 +75,7 @@ add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -90,7 +96,7 @@ macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -105,7 +111,7 @@ add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -133,7 +139,7 @@ add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.new" @@ -146,7 +152,7 @@ add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${actual}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.out" @@ -181,7 +187,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) else () @@ -189,7 +195,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${outfile}.ufile.txt" @@ -200,7 +206,7 @@ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else () - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") endif () @@ -261,7 +267,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) endif () - add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) + add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if (NOT HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) set (compare_test ${outfile}) @@ -316,7 +322,7 @@ ) set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP) - add_test (NAME H5JAM-${testname}_NONE COMMAND $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) + add_test (NAME H5JAM-${testname}_NONE COMMAND $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY) set (compare_test ${chkfile}) diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index dc5804c..0da03c5 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5LS C) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5LS_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (H5LS_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5LS_TOOL_PLUGIN_LIB_CORENAME}") + set (H5LS_TOOL_PLUGIN_LIB_TARGET ${H5LS_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -21,12 +21,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5LS_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 95af5ab..f4babb6 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -134,10 +134,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -157,7 +163,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -192,7 +198,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -218,7 +224,7 @@ add_test ( NAME H5LS_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 562a892..04fb306 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -80,10 +80,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -103,7 +109,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" @@ -118,7 +124,7 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -141,7 +147,7 @@ add_test ( NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 890d5d2..92b61fc 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -5,11 +5,16 @@ project (HDF5_TOOLS_TEST_H5REPACK C) # Add h5Repack test executables # -------------------------------------------------------------------- add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) -target_include_directories(testh5repack_detect_szip +target_include_directories (testh5repack_detect_szip PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC) -target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC) + target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (testh5repack_detect_szip SHARED) + target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) +endif () set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) set (REPACK_COMMON_SOURCES @@ -22,35 +27,40 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c) -target_include_directories(h5repacktest +target_include_directories (h5repacktest PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -TARGET_C_PROPERTIES (h5repacktest STATIC) -target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repacktest STATIC) + target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5repacktest SHARED) + target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) +endif () set_target_properties (h5repacktest PROPERTIES FOLDER tools) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") - set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) + set (H5REPACK_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + set (H5REPACK_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}") + set (H5REPACK_TOOL_PLUGIN_LIB_TARGET ${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}) + set (H5REPACK_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") + set (H5REPACK_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}") + set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") - add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -58,20 +68,20 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5REPACK_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} + TARGET ${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 2ad12ad..3a90b2c 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -157,10 +157,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) @@ -180,7 +186,7 @@ add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=h5repack-${testname}.out" @@ -213,12 +219,12 @@ endif () add_test ( NAME H5REPACK_OLD-${testname} - COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects) add_test ( NAME H5REPACK_OLD-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) endif () @@ -245,12 +251,12 @@ endif () add_test ( NAME H5REPACK-${testname} - COMMAND $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects) add_test ( NAME H5REPACK-${testname}_DFF - COMMAND $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) endif () @@ -270,7 +276,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) if (last_test) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -290,7 +296,7 @@ add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -304,7 +310,7 @@ endif () endmacro () - macro (ADD_H5_MASK_TEST testname testtype resultcode resultfile) + macro (ADD_H5_MASK_TEST testname testtype resultcode result_errcheck resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -318,7 +324,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) if (last_test) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) @@ -338,15 +344,15 @@ add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" - -D "TEST_MASK_ERROR=true" + -D "TEST_SKIP_COMPARE=true" -D "TEST_REFERENCE=${resultfile}.mty" - -D "TEST_ERRREF=${resultfile}-${testname}.tst" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) endif () @@ -376,14 +382,14 @@ endif () add_test ( NAME H5REPACK_DMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -419,14 +425,14 @@ endif () add_test ( NAME H5REPACK_STAT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} ) set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_STAT-h5stat-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -463,19 +469,19 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -498,7 +504,7 @@ add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -538,14 +544,14 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -575,13 +581,13 @@ endif () add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -606,7 +612,7 @@ endif () add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties ( ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES @@ -629,12 +635,12 @@ endif () add_test ( NAME H5REPACK_META-${testname}_N - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects) add_test ( NAME H5REPACK_META-${testname}_M - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N) @@ -662,7 +668,7 @@ add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_EXPECT=${resultcode}" @@ -677,7 +683,7 @@ add_test ( NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -1222,7 +1228,7 @@ ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS -l CONTI) ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT -l dset2:COMPA) ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT -l COMPA) - ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack) + ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 "dimensionality of chunks doesn't match the dataspace" ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack) ################################################################ # layout conversions (file has no filters) diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index e65c76f..f3bd20b 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5STAT C) # -------------------------------------------------------------------- # Add the h5stat test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - target_include_directories(h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5stat_gentest STATIC) target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 737f4b5..63886d0 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -93,10 +93,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -117,7 +123,7 @@ add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" @@ -132,7 +138,7 @@ macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -153,7 +159,7 @@ add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 556b5b2..f5e3ea3 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -4,18 +4,28 @@ project (HDF5_TOOLS_TEST_MISC C) # -------------------------------------------------------------------- # Add the misc test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - target_include_directories(h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5repart_gentest STATIC) - target_link_libraries (h5repart_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repart_gentest STATIC) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5repart_gentest SHARED) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - target_include_directories(h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5clear_gentest STATIC) - target_link_libraries (h5clear_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5clear_gentest STATIC) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5clear_gentest SHARED) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $) @@ -24,15 +34,25 @@ if (HDF5_BUILD_GENERATORS) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) -target_include_directories(h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5repart_test STATIC) -target_link_libraries (h5repart_test PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repart_test STATIC) + target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5repart_test SHARED) + target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5repart_test PROPERTIES FOLDER tools) add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) -target_include_directories(clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (clear_open_chk STATIC) -target_link_libraries (clear_open_chk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (clear_open_chk STATIC) + target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (clear_open_chk SHARED) + target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (clear_open_chk PROPERTIES FOLDER tools) include (CMakeTestsRepart.cmake) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 24774fd..c7b2fe9 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -83,6 +83,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + # Need special dependencies for tests that use the same reference file # This is an issue on Windows macro (ADD_H5_CMP testname resultfile resultcode) @@ -100,7 +106,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -128,7 +134,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -165,7 +171,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -201,7 +207,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -219,7 +225,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_RET-${testname} - COMMAND $ ${ARGN} + COMMAND $ ${ARGN} ) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") @@ -255,7 +261,7 @@ add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_before_size.out" @@ -267,12 +273,12 @@ if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment=${incr_size} ${testname}.h5 + COMMAND $ --increment=${incr_size} ${testname}.h5 ) else () add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment ${testname}.h5 + COMMAND $ --increment ${testname}.h5 ) endif () set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") @@ -281,7 +287,7 @@ add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_after_size.out" @@ -317,7 +323,7 @@ endif () # After "h5clear" the file, the subsequent file open succeeds - add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $ -s ${testfile}.h5) + add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $ -s ${testfile}.h5) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode}) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND $ ${testfile}.h5) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index 87d3a20..db1f805 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -54,6 +54,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode resultoption) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -69,7 +75,7 @@ add_test ( NAME H5MKGRP-${resultfile} - COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} + COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} ) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (HDF5_ENABLE_USING_MEMCHECKER) @@ -81,7 +87,7 @@ add_test ( NAME H5MKGRP-${resultfile}-h5ls COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -110,7 +116,7 @@ add_test ( NAME H5MKGRP_CMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 8edd243..53949a2 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -58,6 +58,12 @@ ############################################################################## ############################################################################## + 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 H5REPART-clearall-objects @@ -74,25 +80,25 @@ set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. - add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) + add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) set_tests_properties (H5REPART-h5repart_20K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # repartition family member size to 5 KB. - add_test (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) + add_test (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) set_tests_properties (H5REPART-h5repart_5K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes - add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) set_tests_properties (H5REPART-h5repart_single PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes (old argument) - add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) + add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES FIXTURES_REQUIRED clear_testrepart ) diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index 98bce4d..092cabc 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -3,9 +3,14 @@ project (HDF5_TOOLS_TEST_MISC_VDS C) MACRO (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) - target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${genfile} STATIC) - target_link_libraries (${genfile} PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (${genfile} STATIC) + target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${genfile} SHARED) + target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) ENDMACRO () diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index fa41608..77b154a 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -10,9 +10,14 @@ set (h5perf_serial_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -target_include_directories(h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5perf_serial STATIC) -target_link_libraries (h5perf_serial PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_serial STATIC) + target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5perf_serial SHARED) + target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5perf_serial PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) @@ -20,11 +25,17 @@ if (HDF5_BUILD_PERFORM_STANDALONE) set (h5perf_serial_alone_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - target_include_directories(h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) - target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf_serial_alone SHARED) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE @@ -36,9 +47,14 @@ set (chunk_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c ) add_executable(chunk ${chunk_SOURCES}) -target_include_directories(chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (chunk STATIC) -target_link_libraries(chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (chunk STATIC) + target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (chunk SHARED) + target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (chunk PROPERTIES FOLDER perform) #-- Adding test for iopipe @@ -46,9 +62,14 @@ set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c ) add_executable (iopipe ${iopipe_SOURCES}) -target_include_directories(iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (iopipe STATIC) -target_link_libraries (iopipe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (iopipe STATIC) + target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (iopipe SHARED) + target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (iopipe PROPERTIES FOLDER perform) #-- Adding test for overhead @@ -56,9 +77,14 @@ set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c ) add_executable (overhead ${overhead_SOURCES}) -target_include_directories(overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (overhead STATIC) -target_link_libraries (overhead PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (overhead STATIC) + target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (overhead SHARED) + target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (overhead PROPERTIES FOLDER perform) #-- Adding test for perf_meta @@ -66,9 +92,14 @@ set (perf_meta_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c ) add_executable (perf_meta ${perf_meta_SOURCES}) -target_include_directories(perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (perf_meta STATIC) -target_link_libraries (perf_meta PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf_meta STATIC) + target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (perf_meta SHARED) + target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (perf_meta PROPERTIES FOLDER perform) #-- Adding test for zip_perf @@ -76,9 +107,14 @@ set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) add_executable (zip_perf ${zip_perf_SOURCES}) -target_include_directories(zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (zip_perf STATIC) -target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (zip_perf STATIC) + target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_COMP_LIBS}) +else () + TARGET_C_PROPERTIES (zip_perf SHARED) + target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_COMP_LIBS}) +endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) if (H5_HAVE_PARALLEL AND BUILD_TESTING) @@ -88,9 +124,14 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf ${h5perf_SOURCES}) - target_include_directories(h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5perf STATIC) - target_link_libraries (h5perf PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf STATIC) + target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf SHARED) + target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5perf PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) @@ -98,11 +139,17 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) set (h5perf_alone_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - target_include_directories(h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5perf_alone STATIC) - target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_alone STATIC) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf_alone SHARED) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5perf_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 1c0d621..43a0f64 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -82,6 +82,12 @@ /* POSIX I/O macros */ +#ifdef H5_HAVE_WIN32_API +/* Can't link against the library, so this test will use the older, non-Unicode + * _open() call on Windows. + */ +#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) +#endif /* H5_HAVE_WIN32_API */ #define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600) #define POSIXOPEN(fn, F) HDopen(fn, F, 0600) #define POSIXCLOSE(F) HDclose(F) diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 4fead3f..11de229 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -54,6 +54,12 @@ } while(0) /* POSIX I/O macros */ +#ifdef H5_HAVE_WIN32_API +/* Can't link against the library, so this test will use the older, non-Unicode + * _open() call on Windows. + */ +#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) +#endif /* H5_HAVE_WIN32_API */ #define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600) #define POSIXOPEN(fn, F) HDopen(fn, F, 0600) #define POSIXCLOSE(F) HDclose(F) -- cgit v0.12