diff options
33 files changed, 887 insertions, 230 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d49b20..afb85c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,13 +123,14 @@ SET (HDF5_HL_F90_C_LIB_TARGET ${HDF5_HL_F90_C_LIB_CORENAME}) #----------------------------------------------------------------------------- SET (HDF5_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake) SET (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src) -SET (HDF5_TEST_SOURCE_DIR ${HDF5_SOURCE_DIR}/test) -SET (HDF5_CPP_SOURCE_DIR ${HDF5_SOURCE_DIR}/c++) -SET (HDF5_CPP_TEST_DIR ${HDF5_CPP_SOURCE_DIR}/test) -SET (HDF5_HL_SOURCE_DIR ${HDF5_SOURCE_DIR}/hl) -SET (HDF5_TOOLS_SOURCE_DIR ${HDF5_SOURCE_DIR}/tools) -SET (HDF5_PERFORM_SOURCE_DIR ${HDF5_SOURCE_DIR}/perform) -SET (HDF5_F90_SOURCE_DIR ${HDF5_SOURCE_DIR}/fortran) +SET (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test) +SET (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++) +SET (HDF5_CPP_TST_DIR ${HDF5_SOURCE_DIR}/c++/test) +SET (HDF5_HL_SRC_DIR ${HDF5_SOURCE_DIR}/hl) +SET (HDF5_HL_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/hl/c++) +SET (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools) +SET (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/perform) +SET (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran) # set default prefix location SET (CMAKE_INSTALL_PREFIX "./hdf5" CACHE PATH "Install path prefix, prepended onto install directories") @@ -372,6 +373,7 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR}) #----------------------------------------------------------------------------- # Option to Enable MPI Parallel #----------------------------------------------------------------------------- +SET (CMAKE_MODULE_PATH ${HDF5_RESOURCES_DIR} ${CMAKE_MODULE_PATH}) OPTION (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF) IF (HDF5_ENABLE_PARALLEL) INCLUDE (FindMPI) @@ -517,6 +519,11 @@ IF (BUILD_TESTING) IF (EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/perform ${PROJECT_BINARY_DIR}/perform) ENDIF(EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") + IF (H5_HAVE_PARALLEL) + IF (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") + ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/testpar ${PROJECT_BINARY_DIR}/testpar) + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar") + ENDIF (H5_HAVE_PARALLEL) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) INCLUDE (${HDF5_SOURCE_DIR}/CTestConfig.cmake) ENDIF (BUILD_TESTING) @@ -632,8 +639,8 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) # Configure the hdf5-config.cmake file for the build directory #----------------------------------------------------------------------------- SET (HDF5_INCLUDES_BUILD_TIME - ${HDF5_SRC_DIR} ${HDF5_CPP_SOURCE_DIR} ${HDF5_HL_SOURCE_DIR} - ${HDF5_TOOLS_SOURCE_DIR} ${HDF5_BINARY_DIR} + ${HDF5_SRC_DIR} ${HDF5_CPP_SRC_DIR} ${HDF5_HL_SRC_DIR} + ${HDF5_TOOLS_SRC_DIR} ${HDF5_BINARY_DIR} ) SET (HDF5_VERSION_STRING @HDF5_PACKAGE_VERSION@) SET (HDF5_VERSION_MAJOR @HDF5_PACKAGE_VERSION_MAJOR@) @@ -1871,6 +1871,7 @@ ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/FindHDF5.cmake +./config/cmake/FindMPI.cmake ./config/cmake/hdf5-config.cmake.build.in ./config/cmake/hdf5-config.cmake.install.in ./config/cmake/hdf5-config-version.cmake.in @@ -1893,6 +1894,7 @@ ./fortran/examples/CMakeLists.txt ./fortran/src/CMakeLists.txt ./fortran/test/CMakeLists.txt +./fortran/testpar/CMakeLists.txt ./hl/CMakeLists.txt ./hl/c++/CMakeLists.txt ./hl/c++/examples/CMakeLists.txt diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index fee9a6a..4c6dd5f 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -19,66 +19,66 @@ CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in # Define cpp Library #----------------------------------------------------------------------------- SET (CPP_SRCS - ${HDF5_CPP_SOURCE_DIR}/src/H5AbstractDs.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5ArrayType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5AtomType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5Attribute.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5CommonFG.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5CompType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5DataSet.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5DataSpace.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5DataType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5DcreatProp.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5DxferProp.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5EnumType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5Exception.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5FaccProp.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5FcreatProp.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5File.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5FloatType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5Group.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5IdComponent.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5IntType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5Library.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5Object.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5PredType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5PropList.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5StrType.cpp - ${HDF5_CPP_SOURCE_DIR}/src/H5VarLenType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5CommonFG.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5CompType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSet.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSpace.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DcreatProp.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DxferProp.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5EnumType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Exception.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5FaccProp.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5FcreatProp.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5File.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5FloatType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Group.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.cpp + ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.cpp ) SET (CPP_HDRS - ${HDF5_CPP_SOURCE_DIR}/src/H5AbstractDs.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Alltypes.h - ${HDF5_CPP_SOURCE_DIR}/src/H5ArrayType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5AtomType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Attribute.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Classes.h - ${HDF5_CPP_SOURCE_DIR}/src/H5CommonFG.h - ${HDF5_CPP_SOURCE_DIR}/src/H5CompType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Cpp.h - ${HDF5_CPP_SOURCE_DIR}/src/H5CppDoc.h - ${HDF5_CPP_SOURCE_DIR}/src/H5DataSet.h - ${HDF5_CPP_SOURCE_DIR}/src/H5DataSpace.h - ${HDF5_CPP_SOURCE_DIR}/src/H5DataType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5DcreatProp.h - ${HDF5_CPP_SOURCE_DIR}/src/H5DxferProp.h - ${HDF5_CPP_SOURCE_DIR}/src/H5EnumType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Exception.h - ${HDF5_CPP_SOURCE_DIR}/src/H5FaccProp.h - ${HDF5_CPP_SOURCE_DIR}/src/H5FcreatProp.h - ${HDF5_CPP_SOURCE_DIR}/src/H5File.h - ${HDF5_CPP_SOURCE_DIR}/src/H5FloatType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Group.h - ${HDF5_CPP_SOURCE_DIR}/src/H5IdComponent.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Include.h - ${HDF5_CPP_SOURCE_DIR}/src/H5IntType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Library.h - ${HDF5_CPP_SOURCE_DIR}/src/H5Object.h - ${HDF5_CPP_SOURCE_DIR}/src/H5PredType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5PropList.h - ${HDF5_CPP_SOURCE_DIR}/src/H5StrType.h - ${HDF5_CPP_SOURCE_DIR}/src/H5VarLenType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Alltypes.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Classes.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5CommonFG.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5CompType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Cpp.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5CppDoc.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSet.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSpace.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DataType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DcreatProp.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5DxferProp.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5EnumType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Exception.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5FaccProp.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5FcreatProp.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5File.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5FloatType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Group.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Include.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5IntType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Library.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5Object.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5PredType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5PropList.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.h + ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h ) ADD_LIBRARY (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS}) diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 770348e..722bd37 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_CPP_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed # with "cpp_". This allows for easier filtering of the test suite when @@ -7,8 +8,6 @@ cmake_minimum_required (VERSION 2.8) # which would only run the C++ based unit tests. # -------------------------------------------------------------------- -PROJECT (HDF5_CPP_TEST) - #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- @@ -34,7 +33,7 @@ SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) CONFIGURE_FILE (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) -INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR} ) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR} ) ADD_EXECUTABLE (cpp_testhdf5 ${CPP_TEST_SRCS} ) H5_NAMING (cpp_testhdf5) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8b3e9be..3a16856 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -17,7 +17,15 @@ MESSAGE (STATUS " GetConsoleScreenBufferInfo function for Windows") # Always SET this for now IF we are on an OS X box #----------------------------------------------------------------------------- IF (APPLE) - SET (H5_AC_APPLE_UNIVERSAL_BUILD 1) + 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" + "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.") + ENDIF() + SET (H5_AC_APPLE_UNIVERSAL_BUILD 0) ENDIF (APPLE) #----------------------------------------------------------------------------- diff --git a/config/cmake/FindMPI.cmake b/config/cmake/FindMPI.cmake new file mode 100644 index 0000000..555d2d5 --- /dev/null +++ b/config/cmake/FindMPI.cmake @@ -0,0 +1,364 @@ +# - Message Passing Interface (MPI) module. +# +# The Message Passing Interface (MPI) is a library used to write +# high-performance parallel applications that use message passing, and +# is typically deployed on a cluster. MPI is a standard interface +# (defined by the MPI forum) for which many implementations are +# available. All of these implementations have somewhat different +# compilation approaches (different include paths, libraries to link +# against, etc.), and this module tries to smooth out those differences. +# +# This module will set the following variables: +# MPI_FOUND TRUE if we have found MPI +# MPI_COMPILE_FLAGS Compilation flags for MPI programs +# MPI_INCLUDE_PATH Include path(s) for MPI header +# MPI_LINK_FLAGS Linking flags for MPI programs +# MPI_LIBRARY First MPI library to link against (cached) +# MPI_EXTRA_LIBRARY Extra MPI libraries to link against (cached) +# MPI_LIBRARIES All libraries to link MPI programs against +# MPIEXEC Executable for running MPI programs +# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving it the +# number of processors to run on +# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly before the +# executable to run. +# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after all other flags. +# +# This module will attempt to auto-detect these settings, first by +# looking for a MPI compiler, which many MPI implementations provide +# as a pass-through to the native compiler to simplify the compilation +# of MPI programs. The MPI compiler is stored in the cache variable +# MPI_COMPILER, and will attempt to look for commonly-named drivers +# mpic++, mpicxx, mpiCC, or mpicc. If the compiler driver is found and +# recognized, it will be used to set all of the module variables. To +# skip this auto-detection, set MPI_LIBRARY and MPI_INCLUDE_PATH in +# the CMake cache. +# +# If no compiler driver is found or the compiler driver is not +# recognized, this module will then search for common include paths +# and library names to try to detect MPI. +# +# If CMake initially finds a different MPI than was intended, and you +# want to use the MPI compiler auto-detection for a different MPI +# implementation, set MPI_COMPILER to the MPI compiler driver you want +# to use (e.g., mpicxx) and then set MPI_LIBRARY to the string +# MPI_LIBRARY-NOTFOUND. When you re-configure, auto-detection of MPI +# will run again with the newly-specified MPI_COMPILER. +# +# When using MPIEXEC to execute MPI applications, you should typically +# use all of the MPIEXEC flags as follows: +# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE +# ${MPIEXEC_POSTFLAGS} ARGS +# where PROCS is the number of processors on which to execute the program, +# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the +# MPI program. + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is maintained by David Partyka <dave.partyka@kitware.com>. + +# A set of directories to search through in addition to the standard system paths +# that find_program will search through. +# Microsoft HPC SDK is automatically added to the system path +# Argonne National Labs MPICH2 sets a registry key that we can use. + +set(_MPI_PACKAGE_DIR + mpi + mpich + openmpi + lib/mpi + lib/mpich + lib/openmpi + "MPICH/SDK" + "Microsoft Compute Cluster Pack" + ) + +set(_MPI_PREFIX_PATH) +if(WIN32) + list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..") + list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]") +endif() + +foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH}) + foreach(MpiPackageDir ${_MPI_PREFIX_PATH}) + if(EXISTS ${SystemPrefixDir}/${MpiPackageDir}) + list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}") + endif() + endforeach(MpiPackageDir) +endforeach(SystemPrefixDir) + +# Most mpi distros have some form of mpiexec which gives us something we can reliably look for. +find_program(MPIEXEC + NAMES mpiexec mpirun lamexec + PATHS ${_MPI_PREFIX_PATH} + PATH_SUFFIXES bin + DOC "Executable for running MPI programs." + ) + +# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin). +# This gives us a fairly reliable base directory to search for /bin /lib and /include from. +get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH) +get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH) + +# If there is an mpi compiler find it and interogate (farther below) it for the include +# and lib dirs otherwise we will continue to search from ${_MPI_BASE_DIR}. +find_program(MPI_COMPILER + NAMES mpiCC mpicc mpic++ mpicxx + HINTS "${_MPI_BASE_DIR}" + PATH_SUFFIXES bin + DOC "MPI compiler. Used only to detect MPI compilation flags.") +mark_as_advanced(MPI_COMPILER) + +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.") +set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.") +set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.") +set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.") +mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS + MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS) + +if (MPI_INCLUDE_PATH AND MPI_LIBRARY) + # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in + # the cache, and we don't want to override those settings. +elseif (MPI_COMPILER) + # Check whether the -showme:compile option works. This indicates + # that we have either Open MPI or a newer version of LAM-MPI, and + # implies that -showme:link will also work. + # Note that Windows distros do not have an mpi compiler to interogate. + exec_program(${MPI_COMPILER} + ARGS -showme:compile + OUTPUT_VARIABLE MPI_COMPILE_CMDLINE + RETURN_VALUE MPI_COMPILER_RETURN) + + if (MPI_COMPILER_RETURN EQUAL 0) + # If we appear to have -showme:compile, then we should also have + # -showme:link. Try it. + exec_program(${MPI_COMPILER} + ARGS -showme:link + OUTPUT_VARIABLE MPI_LINK_CMDLINE + RETURN_VALUE MPI_COMPILER_RETURN) + + # Note that we probably have -showme:incdirs and -showme:libdirs + # as well. + set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE) + endif (MPI_COMPILER_RETURN EQUAL 0) + + if (MPI_COMPILER_RETURN EQUAL 0) + # Do nothing: we have our command lines now + else (MPI_COMPILER_RETURN EQUAL 0) + # Older versions of LAM-MPI have "-showme". Try it. + exec_program(${MPI_COMPILER} + ARGS -showme + OUTPUT_VARIABLE MPI_COMPILE_CMDLINE + RETURN_VALUE MPI_COMPILER_RETURN) + endif (MPI_COMPILER_RETURN EQUAL 0) + + if (MPI_COMPILER_RETURN EQUAL 0) + # Do nothing: we have our command lines now + else (MPI_COMPILER_RETURN EQUAL 0) + # MPICH uses "-show". Try it. + exec_program(${MPI_COMPILER} + ARGS -show + OUTPUT_VARIABLE MPI_COMPILE_CMDLINE + RETURN_VALUE MPI_COMPILER_RETURN) + endif (MPI_COMPILER_RETURN EQUAL 0) + + if (MPI_COMPILER_RETURN EQUAL 0) + # We have our command lines, but we might need to copy + # MPI_COMPILE_CMDLINE into MPI_LINK_CMDLINE, if the underlying + if (NOT MPI_LINK_CMDLINE) + SET(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE}) + endif (NOT MPI_LINK_CMDLINE) + else (MPI_COMPILER_RETURN EQUAL 0) + message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}") + endif (MPI_COMPILER_RETURN EQUAL 0) +endif (MPI_INCLUDE_PATH AND MPI_LIBRARY) + +if (MPI_INCLUDE_PATH AND MPI_LIBRARY) + # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in + # the cache, and we don't want to override those settings. +elseif (MPI_COMPILE_CMDLINE) + # Extract compile flags from the compile command line. + string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}") + set(MPI_COMPILE_FLAGS_WORK) + foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) + if (MPI_COMPILE_FLAGS_WORK) + set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}") + else(MPI_COMPILE_FLAGS_WORK) + set(MPI_COMPILE_FLAGS_WORK ${FLAG}) + endif(MPI_COMPILE_FLAGS_WORK) + endforeach(FLAG) + + # Extract include paths from compile command line + string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}") + set(MPI_INCLUDE_PATH_WORK) + foreach(IPATH ${MPI_ALL_INCLUDE_PATHS}) + string(REGEX REPLACE "^-I" "" IPATH ${IPATH}) + string(REGEX REPLACE "//" "/" IPATH ${IPATH}) + list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) + endforeach(IPATH) + + if (NOT MPI_INCLUDE_PATH_WORK) + if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS) + # The compile command line didn't have any include paths on it, + # but we may have -showme:incdirs. Use it. + exec_program(${MPI_COMPILER} + ARGS -showme:incdirs + OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK + RETURN_VALUE MPI_COMPILER_RETURN) + separate_arguments(MPI_INCLUDE_PATH_WORK) + endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS) + endif (NOT MPI_INCLUDE_PATH_WORK) + + if (NOT MPI_INCLUDE_PATH_WORK) + # If all else fails, just search for mpi.h in the normal include + # paths. + find_path(MPI_INCLUDE_PATH mpi.h + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} + PATH_SUFFIXES include + ) + set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH}) + endif (NOT MPI_INCLUDE_PATH_WORK) + + # Extract linker paths from the link command line + string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + set(MPI_LINK_PATH) + foreach(LPATH ${MPI_ALL_LINK_PATHS}) + string(REGEX REPLACE "^-L" "" LPATH ${LPATH}) + string(REGEX REPLACE "//" "/" LPATH ${LPATH}) + list(APPEND MPI_LINK_PATH ${LPATH}) + endforeach(LPATH) + + if (NOT MPI_LINK_PATH) + if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS) + # The compile command line didn't have any linking paths on it, + # but we may have -showme:libdirs. Use it. + exec_program(${MPI_COMPILER} + ARGS -showme:libdirs + OUTPUT_VARIABLE MPI_LINK_PATH + RETURN_VALUE MPI_COMPILER_RETURN) + separate_arguments(MPI_LINK_PATH) + endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS) + endif (NOT MPI_LINK_PATH) + + # Extract linker flags from the link command line + string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}") + set(MPI_LINK_FLAGS_WORK) + foreach(FLAG ${MPI_ALL_LINK_FLAGS}) + if (MPI_LINK_FLAGS_WORK) + set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}") + else(MPI_LINK_FLAGS_WORK) + set(MPI_LINK_FLAGS_WORK ${FLAG}) + endif(MPI_LINK_FLAGS_WORK) + endforeach(FLAG) + + # Extract the set of libraries to link against from the link command + # line + string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + + # Determine full path names for all of the libraries that one needs + # to link against in an MPI program + set(MPI_LIBRARIES) + foreach(LIB ${MPI_LIBNAMES}) + string(REGEX REPLACE "^-l" "" LIB ${LIB}) + set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) + find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH}) + if (MPI_LIB) + list(APPEND MPI_LIBRARIES ${MPI_LIB}) + else (MPI_LIB) + message(SEND_ERROR "Unable to find MPI library ${LIB}") + endif (MPI_LIB) + endforeach(LIB) + set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE) + + # Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and + # MPI_EXTRA_LIBRARY. + list(LENGTH MPI_LIBRARIES MPI_NUMLIBS) + list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED) + if (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED) + list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK) + set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE) + else (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED) + set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE) + endif (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED) + if (MPI_NUMLIBS GREATER 1) + set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES}) + list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0) + set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE) + else (MPI_NUMLIBS GREATER 1) + set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE) + endif (MPI_NUMLIBS GREATER 1) + + # Set up all of the appropriate cache entries + set(MPI_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI compilation flags" FORCE) + set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE) + set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE) +else (MPI_COMPILE_CMDLINE) +# No MPI compiler to interogate so attempt to find everything with find functions. + find_path(MPI_INCLUDE_PATH mpi.h + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} + PATH_SUFFIXES include + ) + + # Decide between 32-bit and 64-bit libraries for Microsoft's MPI + if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + set(MS_MPI_ARCH_DIR amd64) + else() + set(MS_MPI_ARCH_DIR i386) + endif() + + find_library(MPI_LIBRARY + NAMES mpi mpich msmpi + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} + PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR} + ) + + find_library(MPI_EXTRA_LIBRARY + NAMES mpi++ + HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH} + PATH_SUFFIXES lib + DOC "Extra MPI libraries to link against.") + + set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags") + set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags") +endif (MPI_INCLUDE_PATH AND MPI_LIBRARY) + +# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required +if("${MPI_LIBRARY}" MATCHES "mpich.rts") + set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts) + set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts) +endif("${MPI_LIBRARY}" MATCHES "mpich.rts") + +# Set up extra variables to conform to +if (MPI_EXTRA_LIBRARY) + set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY}) +else (MPI_EXTRA_LIBRARY) + set(MPI_LIBRARIES ${MPI_LIBRARY}) +endif (MPI_EXTRA_LIBRARY) + +if (MPI_INCLUDE_PATH AND MPI_LIBRARY) + set(MPI_FOUND TRUE) +else (MPI_INCLUDE_PATH AND MPI_LIBRARY) + set(MPI_FOUND FALSE) +endif (MPI_INCLUDE_PATH AND MPI_LIBRARY) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments +find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH) + +mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY + MPI_EXTRA_LIBRARY) + +# unset to cleanup namespace +unset(_MPI_PACKAGE_DIR) +unset(_MPI_PREFIX_PATH) +unset(_MPI_BASE_DIR) diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt index 02cd07f..a4bfb17 100644 --- a/fortran/CMakeLists.txt +++ b/fortran/CMakeLists.txt @@ -149,4 +149,7 @@ ENDIF (HDF5_BUILD_EXAMPLES) #----------------------------------------------------------------------------- IF (BUILD_TESTING) ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test) + IF (H5_HAVE_PARALLEL) + ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/testpar ${HDF5_F90_BINARY_DIR}/testpar) + ENDIF (H5_HAVE_PARALLEL) ENDIF (BUILD_TESTING) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index f8a453e..f1ed52f 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -1,14 +1,14 @@ cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_F90_EXAMPLES C CXX Fortran) # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed # with "f90_ex_". This allows for easier filtering of the examples. # -------------------------------------------------------------------- -PROJECT (HDF5_F90_EXAMPLES C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) LINK_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} @@ -66,3 +66,35 @@ FOREACH (example ${examples}) ${HDF5_LIB_TARGET} ) ENDFOREACH (example ${examples}) + +IF (H5_HAVE_PARALLEL) + ADD_EXECUTABLE (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) + H5_NAMING (f90_ex_ph5example) + IF (WIN32) + IF (BUILD_SHARED_LIBS) + IF (MSVC) + SET_TARGET_PROPERTIES (f90_ex_ph5example + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) + ENDIF (MSVC) + ELSE (BUILD_SHARED_LIBS) + IF (MSVC) + SET_TARGET_PROPERTIES (f90_ex_ph5example + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (MSVC) + ENDIF (BUILD_SHARED_LIBS) + SET_PROPERTY (TARGET f90_ex_ph5example + APPEND PROPERTY COMPILE_DEFINITIONS + HDF5F90_WINDOWS + ) + SET_TARGET_PROPERTIES (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran) + ENDIF (WIN32) + TARGET_LINK_LIBRARIES (f90_ex_ph5example + ${HDF5_F90_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +ENDIF (H5_HAVE_PARALLEL) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 7875f97..26475e6 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) LINK_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt new file mode 100644 index 0000000..4b9d4f1 --- /dev/null +++ b/fortran/testpar/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran) + +#----------------------------------------------------------------------------- +# Setup include Directories +#----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) +LINK_DIRECTORIES ( + ${CMAKE_Fortran_MODULE_DIRECTORY} + ${HDF5_F90_BINARY_DIR} + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} +) + +#----------------------------------------------------------------------------- +# Add Tests +#----------------------------------------------------------------------------- + +#-- Adding test for parallel_test +ADD_EXECUTABLE (parallel_test + ptest.f90 + hyper.f90 + mdset.f90 +) +H5_NAMING (parallel_test) +TARGET_LINK_LIBRARIES (parallel_test + ${HDF5_F90_TEST_LIB_TARGET} + ${HDF5_F90_LIB_TARGET} + ${HDF5_LIB_TARGET} +) +IF (WIN32) + IF (MSVC) + TARGET_LINK_LIBRARIES (parallel_test "ws2_32.lib") + IF (BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (parallel_test + PROPERTIES + COMPILE_FLAGS "/dll" + LINK_FLAGS "/SUBSYSTEM:CONSOLE" + ) + ELSE (BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (parallel_test + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (BUILD_SHARED_LIBS) + ENDIF (MSVC) +ENDIF (WIN32) +SET_TARGET_PROPERTIES (parallel_test PROPERTIES LINKER_LANGUAGE Fortran) + +ADD_TEST (NAME parallel_test COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:parallel_test>) diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 8fcb9bd..2a06b9c 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -4,8 +4,8 @@ PROJECT (HDF5_HL_CPP_EXAMPLES) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) -INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_DIR}/src) # -------------------------------------------------------------------- # Add in the examples for the Packet Table codes diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 459520e..afd4cf4 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -4,10 +4,11 @@ PROJECT (HDF5_HL_CPP_SRC) #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR}) + SET (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) SET (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) -INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) -INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR}) ADD_LIBRARY ( ${HDF5_HL_CPP_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_CPP_SRCS}) TARGET_LINK_LIBRARIES ( diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index e9b09da..afcb8fe 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -4,17 +4,17 @@ PROJECT (HDF5_HL_CPP_TEST) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) -INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/c++/src) # -------------------------------------------------------------------- # Add in the unit tests for the packet table c++ wrapper # -------------------------------------------------------------------- IF (BUILD_TESTING) - INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR}) - INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/test) - INCLUDE_DIRECTORIES (${HDF5_CPP_SOURCE_DIR}/src) + INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) + INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/test) + INCLUDE_DIRECTORIES (${HDF5_CPP_SRC_DIR}/src) ADD_EXECUTABLE (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) H5_NAMING (hl_ptableTest) diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index 1aca0d7..4c2256c 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -4,12 +4,12 @@ PROJECT(HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_F90_SRC_DIR}/src) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR}) INCLUDE_DIRECTORIES (${HDF5_F90_SRC_BINARY_DIR}) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY}) -LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_FORTRAN_SOURCE_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +LINK_DIRECTORIES (${HDF5_SRC_DIR} ${HDF5_F90_SRC_DIR}/src ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) #----------------------------------------------------------------------------- # Add debug information (intel Fortran : JB) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index bd9a695..3ba6969 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) LINK_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_HL_F90_BINARY_DIR} @@ -17,7 +17,7 @@ SET (examples ) FOREACH (example ${examples}) - ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.f90) + ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) H5_NAMING (hl_f90_ex_${example}) IF (WIN32) IF (MSVC) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 07fcb30..f003c49 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -7,10 +7,10 @@ PROJECT(HDF5_HL_F90_SRC C CXX Fortran) INCLUDE_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} - ${HDF5_F90_SOURCE_DIR}/src + ${HDF5_F90_SRC_DIR}/src ${HDF5_F90_SRC_BINARY_DIR} ${HDF5_HL_F90_SRC_SOURCE_DIR} - ${HDF5_HL_SOURCE_DIR}/src + ${HDF5_HL_SRC_DIR}/src ) LINK_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 14bd622..f505dbd 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- # Add Tests #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) LINK_DIRECTORIES ( ${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_HL_F90_BINARY_DIR} diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 6042853..e34936d 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -11,7 +11,7 @@ ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # List Source files #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_HL_SOURCE_DIR}/src) +INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src) SET (HL_SRCS ${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 91d7c80..d016aed 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required (VERSION 2.8) +PROJECT (HDF5_HL_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed # with "hl_". This allows for easier filtering of the test suite when @@ -7,8 +8,6 @@ cmake_minimum_required (VERSION 2.8) # which would only run the High Level based unit tests. # -------------------------------------------------------------------- -PROJECT (HDF5_HL_TEST) - #----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation #----------------------------------------------------------------------------- @@ -16,7 +15,7 @@ SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) CONFIGURE_FILE (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) -INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR}) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # -------------------------------------------------------------------- # Macro used to add a unit test @@ -42,7 +41,9 @@ MACRO (HL_ADD_TEST hl_name files) ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>) + # -------------------------------------------------------------------- #-- Copy the necessary files. + # -------------------------------------------------------------------- FOREACH (h5_file ${files}) SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}") @@ -66,7 +67,7 @@ HL_ADD_TEST (test_table "test_table_be.hdf5;test_table_cray.hdf5;test_table_le.h # 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 (NOT BUILD_SHARED_LIBS) +IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (hl_gen_test_ds gen_test_ds.c) H5_NAMING (hl_gen_test_ds) IF (WIN32) @@ -84,4 +85,4 @@ IF (NOT BUILD_SHARED_LIBS) ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ) -ENDIF (NOT BUILD_SHARED_LIBS) +ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index e8c729d..62a0ea5 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -14,7 +14,7 @@ SET (GIF2H5_SRCS ) #-- Add gif2hdf5 program -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5) ADD_EXECUTABLE (gif2h5 ${GIF2H5_SRCS}) @@ -55,7 +55,7 @@ TARGET_LINK_LIBRARIES (hdf2gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_T # used in the CMake Build system as we rely on the test files that are # shipped with HDF5 source archives # -------------------------------------------------------------------- -IF (NOT BUILD_SHARED_LIBS) +IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) H5_NAMING (hl_h52gifgentest) IF (WIN32) @@ -69,7 +69,7 @@ IF (NOT BUILD_SHARED_LIBS) TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) # ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) -ENDIF (NOT BUILD_SHARED_LIBS) +ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Add file(s) to CMake Install diff --git a/perform/CMakeLists.txt b/perform/CMakeLists.txt index a0b7fae..6168bb3 100644 --- a/perform/CMakeLists.txt +++ b/perform/CMakeLists.txt @@ -4,8 +4,8 @@ PROJECT (HDF5_PERFORM ) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR}) -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib ) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib ) #----------------------------------------------------------------------------- # Add Tests @@ -132,3 +132,67 @@ ENDIF (WIN32) TARGET_LINK_LIBRARIES (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME zip_perf COMMAND $<TARGET_FILE:zip_perf> "-h") + +IF (H5_HAVE_PARALLEL) + #-- Adding test for h5perf + SET (h5perf_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/pio_timer.c + ${HDF5_PERFORM_SOURCE_DIR}/pio_perf.c + ${HDF5_PERFORM_SOURCE_DIR}/pio_engine.c + ) + ADD_EXECUTABLE (h5perf ${h5perf_SRCS}) + H5_NAMING (h5perf) + IF (WIN32) + IF (MSVC) + IF (NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (h5perf + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (MSVC) + ENDIF (WIN32) + TARGET_LINK_LIBRARIES (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + + ADD_TEST (NAME h5perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:h5perf>) + + #-- Adding test for benchpar + SET (benchpar_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/benchpar.c + ) + ADD_EXECUTABLE (benchpar ${benchpar_SRCS}) + H5_NAMING (benchpar) + IF (WIN32) + IF (MSVC) + IF (NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (benchpar + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (MSVC) + ENDIF (WIN32) + TARGET_LINK_LIBRARIES (benchpar ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + + ADD_TEST (NAME benchpar COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:benchpar>) + + #-- Adding test for mpi-perf + SET (mpi-perf_SRCS + ${HDF5_PERFORM_SOURCE_DIR}/mpi-perf.c + ) + ADD_EXECUTABLE (mpi-perf ${mpi-perf_SRCS}) + H5_NAMING (mpi-perf) + IF (WIN32) + IF (MSVC) + IF (NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (mpi-perf + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (MSVC) + ENDIF (WIN32) + TARGET_LINK_LIBRARIES (mpi-perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + + ADD_TEST (NAME mpi-perf COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:mpi-perf>) +ENDIF (H5_HAVE_PARALLEL) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 169ecde..961f674 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 2.8) -PROJECT (H5_TEST) +PROJECT (HDF5_TEST) #----------------------------------------------------------------------------- # Define Sources @@ -31,6 +31,90 @@ TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE}) +# -------------------------------------------------------------------- +# Copy all the HDF5 files from the test directory into the source directory +# -------------------------------------------------------------------- +SET (HDF5_TEST_FILES + tnullspace.h5 +) + +FOREACH (h5_tfile ${HDF5_TEST_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/${h5_tfile}") + #MESSAGE (STATUS " Copying ${h5_tfile}") + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest} + ) +ENDFOREACH (h5_tfile ${HDF5_TEST_FILES}) + +# -------------------------------------------------------------------- +# Copy all the HDF5 files from the test directory into the source directory +# -------------------------------------------------------------------- +SET (HDF5_REFERENCE_FILES + err_compat_1 + err_compat_2 + error_test_1 + error_test_2 +) + +FOREACH (ref_file ${HDF5_REFERENCE_FILES}) + SET (dest "${PROJECT_BINARY_DIR}/testfiles/${ref_file}") + #MESSAGE (STATUS " Copying ${h5_file}") + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} + ) +ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES}) + +# -------------------------------------------------------------------- +#-- Copy all the HDF5 files from the test directory into the source directory +# -------------------------------------------------------------------- +SET (HDF5_REFERENCE_TEST_FILES + be_data.h5 + be_extlink1.h5 + be_extlink2.h5 + corrupt_stab_msg.h5 + deflate.h5 + family_v16_00000.h5 + family_v16_00001.h5 + family_v16_00002.h5 + family_v16_00003.h5 + fill_old.h5 + fixed_idx.h5 + group_old.h5 + le_data.h5 + le_extlink1.h5 + le_extlink2.h5 + mergemsg.h5 + noencoder.h5 + specmetaread.h5 + tarrold.h5 + tbad_msg_count.h5 + tbogus.h5 + test_filters_be.hdf5 + test_filters_le.hdf5 + th5s.h5 + tlayouto.h5 + tmtimen.h5 + tmtimeo.h5 + vms_data.h5 +) + +FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) + SET (dest "${HDF5_TEST_BINARY_DIR}/${h5_file}") + #MESSAGE (STATUS " Copying ${h5_file} to ${dest}") + ADD_CUSTOM_COMMAND ( + TARGET ${HDF5_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest} + ) +ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) + SET (testhdf5_SRCS ${HDF5_TEST_SOURCE_DIR}/testhdf5.c ${HDF5_TEST_SOURCE_DIR}/tarray.c @@ -40,8 +124,10 @@ SET (testhdf5_SRCS ${HDF5_TEST_SOURCE_DIR}/tcoords.c ${HDF5_TEST_SOURCE_DIR}/tfile.c ${HDF5_TEST_SOURCE_DIR}/tgenprop.c + ${HDF5_TEST_SOURCE_DIR}/th5o.c ${HDF5_TEST_SOURCE_DIR}/th5s.c ${HDF5_TEST_SOURCE_DIR}/theap.c + ${HDF5_TEST_SOURCE_DIR}/tid.c ${HDF5_TEST_SOURCE_DIR}/titerate.c ${HDF5_TEST_SOURCE_DIR}/tmeta.c ${HDF5_TEST_SOURCE_DIR}/tmisc.c @@ -49,14 +135,12 @@ SET (testhdf5_SRCS ${HDF5_TEST_SOURCE_DIR}/trefstr.c ${HDF5_TEST_SOURCE_DIR}/tselect.c ${HDF5_TEST_SOURCE_DIR}/tskiplist.c + ${HDF5_TEST_SOURCE_DIR}/tsohm.c ${HDF5_TEST_SOURCE_DIR}/ttime.c ${HDF5_TEST_SOURCE_DIR}/ttst.c ${HDF5_TEST_SOURCE_DIR}/tunicode.c ${HDF5_TEST_SOURCE_DIR}/tvltypes.c ${HDF5_TEST_SOURCE_DIR}/tvlstr.c - ${HDF5_TEST_SOURCE_DIR}/th5o.c - ${HDF5_TEST_SOURCE_DIR}/tsohm.c - ${HDF5_TEST_SOURCE_DIR}/tid.c ) #-- Adding test for testhdf5 @@ -75,6 +159,12 @@ ENDIF (WIN32) TARGET_LINK_LIBRARIES (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) ADD_TEST (NAME testhdf5 COMMAND $<TARGET_FILE:testhdf5>) + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## MACRO (ADD_H5_TEST file) ADD_EXECUTABLE (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) @@ -95,50 +185,50 @@ MACRO (ADD_H5_TEST file) ENDMACRO (ADD_H5_TEST file) SET (H5_TESTS - app_ref - big + lheap + ohdr + stab + gheap + #cache + #cache_api + pool + hyperslab + istore bittests - btree2 -# cache -# cache_api - cmpd_dset - cross_read - dangle - dsets dt_arith - dtransform dtypes - enum - err_compat - error_test + dsets + cmpd_dset extend external - fheap + objcopy + links + unlink + big + mtime fillval + mount flush1 flush2 - freespace + app_ref + enum + set_extent + #ttsafe getname - gheap - hyperslab - istore - lheap - links - mf - mount - mtime + vfd ntypes - objcopy - ohdr - pool + dangle + dtransform reserved - set_extent - stab + cross_read + freespace + mf + btree2 + fheap + error_test + err_compat tcheck_version testmeta - ttsafe - unlink - vfd ) FOREACH (test ${H5_TESTS}) @@ -151,6 +241,12 @@ IF (WIN32) ENDIF (WIN32) +############################################################################## +############################################################################## +### A D D I T I O N A L T E S T S ### +############################################################################## +############################################################################## + #-- Adding test for cache ADD_EXECUTABLE (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) H5_NAMING (cache) @@ -185,63 +281,77 @@ TARGET_LINK_LIBRARIES (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache_api COMMAND $<TARGET_FILE:cache_api>) -#-- Copy all the HDF5 files from the test directory into the source directory -SET (HDF5_REFERENCE_TEST_FILES - tnullspace.h5 +#-- Adding test for ttsafe +ADD_EXECUTABLE (ttsafe + ${HDF5_TEST_SOURCE_DIR}/ttsafe.c + ${HDF5_TEST_SOURCE_DIR}/ttsafe_dcreate.c + ${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c + ${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c + ${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c ) +H5_NAMING (ttsafe) +IF (WIN32) + IF (MSVC) + IF (NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (ttsafe + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (MSVC) +ENDIF (WIN32) +TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file}") - ADD_CUSTOM_COMMAND ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest} - ) -ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) +ADD_TEST (NAME ttsafe COMMAND $<TARGET_FILE:ttsafe>) +############################################################################## +############################################################################## +### T H E G E N E R A T O R S ### +############################################################################## +############################################################################## -#-- Copy all the HDF5 files from the test directory into the source directory -SET (HDF5_REFERENCE_TEST_FILES - be_data.h5 - be_extlink1.h5 - be_extlink2.h5 - corrupt_stab_msg.h5 - deflate.h5 - family_v16_00000.h5 - family_v16_00001.h5 - family_v16_00002.h5 - family_v16_00003.h5 - fill_old.h5 - fixed_idx.h5 - group_old.h5 - le_data.h5 - le_extlink1.h5 - le_extlink2.h5 - mergemsg.h5 - noencoder.h5 - specmetaread.h5 - tarrold.h5 - tbad_msg_count.h5 - tbogus.h5 - test_filters_be.hdf5 - test_filters_le.hdf5 - th5s.h5 - tlayouto.h5 - tmtimen.h5 - tmtimeo.h5 - vms_data.h5 -) +IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + MACRO (ADD_H5_GENERATOR genfile) + ADD_EXECUTABLE (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) + H5_NAMING (${genfile}) + IF (WIN32) + IF (MSVC) + IF (NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES (${genfile} + PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:MSVCRT" + ) + ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (MSVC) + ENDIF (WIN32) + TARGET_LINK_LIBRARIES (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + ENDMACRO (ADD_H5_GENERATOR genfile) -FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) - SET (dest "${H5_TEST_BINARY_DIR}/${h5_file}") - #MESSAGE (STATUS " Copying ${h5_file} to ${dest}") - ADD_CUSTOM_COMMAND ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${H5_TEST_SOURCE_DIR}/${h5_file} ${dest} + # generator executables + SET (H5_GENERATORS + gen_bad_ohdr + gen_bogus + gen_cross + gen_deflate + gen_filters + gen_idx + gen_new_array + gen_new_fill + gen_new_group + gen_new_mtime + gen_new_super + gen_noencoder + gen_nullspace + gen_udlinks + space_overflow + gen_sizes_lheap ) -ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) + + FOREACH (gen ${H5_GENERATORS}) + ADD_EXECUTABLE (${gen} ${HDF5_TEST_SOURCE_DIR}/${gen}.c) + H5_NAMING (${gen}) + TARGET_LINK_LIBRARIES (${gen} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + ENDFOREACH (gen ${H5_GENERATORS}) + +ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 0eac602..05e0ced 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required (VERSION 2.8) -PROJECT (H5_TEST_PAR) +PROJECT (HDF5_TEST_PAR) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib ) #----------------------------------------------------------------------------- # Define Tests #----------------------------------------------------------------------------- @@ -15,6 +17,7 @@ SET (testphdf5_SRCS ${HDF5_TEST_PAR_SOURCE_DIR}/t_span_tree.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_chunk_alloc.c ${HDF5_TEST_PAR_SOURCE_DIR}/t_filter_read.c + ${HDF5_TEST_PAR_SOURCE_DIR}/t_rank_projection.c ) #-- Adding test for testhdf5 @@ -32,7 +35,7 @@ IF (WIN32) ENDIF (WIN32) TARGET_LINK_LIBRARIES (testphdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) -ADD_TEST (NAME testphdf5 COMMAND $<TARGET_FILE:testphdf5>) +ADD_TEST (NAME testphdf5 COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:testphdf5>) MACRO (ADD_H5P_TEST file) ADD_EXECUTABLE (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) @@ -49,7 +52,7 @@ MACRO (ADD_H5P_TEST file) ENDIF (WIN32) TARGET_LINK_LIBRARIES (${file} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - ADD_TEST (NAME ${file} COMMAND $<TARGET_FILE:${file}>) + ADD_TEST (NAME ${file} COMMAND ${MPIEXEC} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS} $<TARGET_FILE:${file}>) ENDMACRO (ADD_H5P_TEST file) SET (H5P_TESTS diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt index 2cb3a43..b9dad2d 100644 --- a/tools/h5copy/CMakeLists.txt +++ b/tools/h5copy/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5COPY) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- @@ -33,7 +33,7 @@ SET (H5_DEP_EXECUTABLES h5copy) ############################################################################## IF (BUILD_TESTING) - IF (NOT BUILD_SHARED_LIBS) + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c) H5_NAMING (h5copygentest) IF (WIN32) @@ -47,7 +47,7 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>) - ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 05aabf69..1342cd2 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5DIFF) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- @@ -39,7 +39,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Add the h5diff and test executables # -------------------------------------------------------------------- - IF (NOT BUILD_SHARED_LIBS) + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c) H5_NAMING (h5diffgentest) IF (WIN32) @@ -53,7 +53,7 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>) - ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index fe6f6fa..1094d0f 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5DUMP) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- @@ -36,7 +36,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Add the h5dump test executable # -------------------------------------------------------------------- - IF (NOT BUILD_SHARED_LIBS) + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) H5_NAMING (h5dumpgentest) IF (WIN32) @@ -50,7 +50,7 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>) - ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory @@ -124,7 +124,7 @@ IF (BUILD_TESTING) tlonglinks.ddl tloop-1.ddl tmulti.ddl - tnamed_dtype_attr.ddl + tnamed_dtype_attr.ddl"/usr/share/CMake/bin/cmake" "-D" "TEST_PROGRAM=/home/abyrne/HDF_Projects/HDF5-C-Trunk/build/bin/h5dump" "-D" "TEST_ARGS:STRING=-X;:;tempty.h5" "-D" "TEST_FOLDER=/home/abyrne/HDF_Projects/HDF5-C-Trunk/build/tools/h5dump" "-D" "TEST_OUTPUT=tempty-nons.h5.out" "-D" "TEST_EXPECT=0" "-D" "TEST_REFERENCE=tempty-nons.h5.ddl" "-P" "/home/abyrne/HDF_Projects/HDF5-C-Trunk/config/cmake/runTest.cmake" tnestcomp-1.ddl tnbit.ddl tnofilename.ddl @@ -341,7 +341,7 @@ IF (BUILD_TESTING) TARGET h5dump POST_BUILD COMMAND ${XLATE_UTILITY} - ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3 + ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ddl_file} ${ddldest} -l3 ) ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES}) @@ -352,7 +352,7 @@ IF (BUILD_TESTING) TARGET h5dump POST_BUILD COMMAND ${XLATE_UTILITY} - ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${xml_file} ${xmldest} -l3 + ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${xml_file} ${xmldest} -l3 ) ENDFOREACH (xml_file ${HDF5_XML_REFERENCE_FILES}) @@ -363,7 +363,7 @@ IF (BUILD_TESTING) TARGET h5dump POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest} ) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) @@ -374,7 +374,7 @@ IF (BUILD_TESTING) TARGET h5dump POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_xml_file} ${dest} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_xml_file} ${dest} ) ENDFOREACH (h5_xml_file ${HDF5_XML_REFERENCE_TEST_FILES}) @@ -389,14 +389,14 @@ IF (BUILD_TESTING) ) IF (WIN32 AND NOT MINGW) - FILE (READ ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbinregR.exp TEST_STREAM) + FILE (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) FILE (WRITE ${PROJECT_BINARY_DIR}/tbinregR.exp "${TEST_STREAM}") ELSE (WIN32 AND NOT MINGW) ADD_CUSTOM_COMMAND ( TARGET h5dump POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/tbinregR.exp + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/tbinregR.exp ) ENDIF (WIN32 AND NOT MINGW) @@ -431,7 +431,7 @@ IF (BUILD_TESTING) TARGET h5dump POST_BUILD COMMAND ${XLATE_UTILITY} - ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ddl_pbits} ${ddldest} -l3 + ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ddl_pbits} ${ddldest} -l3 ) ENDFOREACH (ddl_pbits ${HDF5_REFERENCE_PBITS}) @@ -442,7 +442,7 @@ IF (BUILD_TESTING) TARGET h5dump POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_pbits} ${dest} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_pbits} ${dest} ) ENDFOREACH (h5_pbits ${HDF5_REFERENCE_TEST_PBITS}) @@ -509,7 +509,7 @@ IF (BUILD_TESTING) COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}" ) ELSE (${testtype} STREQUAL "SKIP") - ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) + ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN}) ENDIF (${testtype} STREQUAL "SKIP") ENDMACRO (ADD_XML_SKIP_H5_TEST) diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt index 317456c..3c82492 100644 --- a/tools/h5import/CMakeLists.txt +++ b/tools/h5import/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5IMPORT) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt index 9c1d09d..61b8c84 100644 --- a/tools/h5jam/CMakeLists.txt +++ b/tools/h5jam/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5JAM) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- @@ -83,7 +83,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Add the h5jam test executables # -------------------------------------------------------------------- - IF (NOT BUILD_SHARED_LIBS) + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c) H5_NAMING (h5jamgentest) IF (WIN32) @@ -97,7 +97,7 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>) - ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ############################################################################## ############################################################################## diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt index ff6679c..1d2589a 100644 --- a/tools/h5ls/CMakeLists.txt +++ b/tools/h5ls/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5LS) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) #----------------------------------------------------------------------------- @@ -119,7 +119,7 @@ IF (BUILD_TESTING) TARGET h5ls POST_BUILD COMMAND ${XLATE_UTILITY} - ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3 + ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ls_file} ${lsdest} -l3 ) ENDFOREACH (ls_file ${HDF5_REFERENCE_FILES}) @@ -130,7 +130,7 @@ IF (BUILD_TESTING) TARGET h5ls POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest} ) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 7f7a6fd..b454d85 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -4,8 +4,8 @@ PROJECT (HDF5_TOOLS_H5REPACK) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR}) # -------------------------------------------------------------------- # Add h5Repack executables @@ -19,7 +19,7 @@ SET (REPACK_COMMON_SRCS ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_verify.c ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack.c ) -INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR}) + ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c) H5_NAMING (h5repack) IF (WIN32) @@ -148,7 +148,7 @@ IF (BUILD_TESTING) TARGET h5repack POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5c_file} ${dest} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5c_file} ${dest} ) ENDFOREACH (h5c_file ${HDF5_COMMON_TEST_FILES}) diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt index b5a2808..b900afb 100644 --- a/tools/h5stat/CMakeLists.txt +++ b/tools/h5stat/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5STAT) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- @@ -36,7 +36,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Add the h5stat test executables # -------------------------------------------------------------------- - IF (NOT BUILD_SHARED_LIBS) + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c) H5_NAMING (h5stat_gentest) IF (WIN32) @@ -50,7 +50,7 @@ IF (BUILD_TESTING) TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>) - ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index b05ce35..05fd607 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_LIB) #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- -#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) #INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) SET (H5_TOOLS_LIB_SRCS @@ -61,6 +61,21 @@ INSTALL ( ) #----------------------------------------------------------------------------- +# Because tools are installed into bin/tools we need to make sure the hdf5tools +# library will be installed into the proper location. +#----------------------------------------------------------------------------- +IF (APPLE) + OPTION (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) + IF (HDF5_BUILD_WITH_INSTALL_NAME) + SET_TARGET_PROPERTIES(${HDF5_TOOLS_LIB_TARGET} PROPERTIES + LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" + INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/tools" + BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} + ) + ENDIF (HDF5_BUILD_WITH_INSTALL_NAME) +ENDIF (APPLE) + +#----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- IF (HDF5_EXPORTED_TARGETS) diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 205f603..8e7e6bf 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_MISC) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib) +INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # -------------------------------------------------------------------- @@ -69,7 +69,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- # Add the misc test executables # -------------------------------------------------------------------- - IF (NOT BUILD_SHARED_LIBS) + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c) H5_NAMING (h5repart_gentest) IF (WIN32) @@ -82,7 +82,7 @@ IF (BUILD_TESTING) ENDIF (WIN32) TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) - ENDIF (NOT BUILD_SHARED_LIBS) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c) H5_NAMING (h5repart_test) @@ -129,7 +129,7 @@ IF (BUILD_TESTING) TARGET h5repart POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest} + ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest} ) ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES}) @@ -156,7 +156,6 @@ IF (BUILD_TESTING) ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>) SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} - # h5repart_gentest h5repart_test ) ENDIF (BUILD_TESTING) |