From 6d881fe7755298d1c92c86d153b4f8097b86c483 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 19 Mar 2023 21:23:50 -0700 Subject: Unify cmake and cmake_ext_mod like develop (#2596) --- CMakeInstallation.cmake | 16 +- CMakeLists.txt | 11 +- c++/examples/CMakeTests.cmake | 5 +- c++/test/CMakeTests.cmake | 2 +- c++/test/CMakeVFDTests.cmake | 1 - config/cmake/CTestCustom.cmake | 10 +- config/cmake/ConfigureChecks.cmake | 689 ++++++++++++++++- config/cmake/FindSZIP.cmake | 129 ++++ config/cmake/GetTimeOfDayTest.cpp | 26 + config/cmake/HDFCXXTests.cpp | 46 ++ config/cmake/HDFLibMacros.cmake | 250 ++++++ config/cmake/HDFMacros.cmake | 520 +++++++++++++ config/cmake/HDFTests.c | 383 ++++++++++ config/cmake/HDFUseCXX.cmake | 47 ++ config/cmake/HDFUseFortran.cmake | 223 ++++++ config/cmake/NSIS.InstallOptions.ini.in | 37 + config/cmake/NSIS.template.in | 974 ++++++++++++++++++++++++ config/cmake/grepTest.cmake | 195 +++++ config/cmake/hdf.bmp | Bin 0 -> 1254 bytes config/cmake/hdf.icns | Bin 0 -> 326012 bytes config/cmake/hdf.ico | Bin 0 -> 23558 bytes config/cmake/runTest.cmake | 381 +++++++++ config/cmake/version.plist.in | 17 + config/cmake_ext_mod/CTestCustom.cmake | 17 - config/cmake_ext_mod/ConfigureChecks.cmake | 693 ----------------- config/cmake_ext_mod/FindSZIP.cmake | 129 ---- config/cmake_ext_mod/GetTimeOfDayTest.cpp | 26 - config/cmake_ext_mod/HDFCXXTests.cpp | 46 -- config/cmake_ext_mod/HDFLibMacros.cmake | 250 ------ config/cmake_ext_mod/HDFMacros.cmake | 520 ------------- config/cmake_ext_mod/HDFTests.c | 383 ---------- config/cmake_ext_mod/HDFUseCXX.cmake | 47 -- config/cmake_ext_mod/HDFUseFortran.cmake | 223 ------ config/cmake_ext_mod/NSIS.InstallOptions.ini.in | 37 - config/cmake_ext_mod/NSIS.template.in | 974 ------------------------ config/cmake_ext_mod/grepTest.cmake | 195 ----- config/cmake_ext_mod/hdf.bmp | Bin 1254 -> 0 bytes config/cmake_ext_mod/hdf.icns | Bin 326012 -> 0 bytes config/cmake_ext_mod/hdf.ico | Bin 23558 -> 0 bytes config/cmake_ext_mod/runTest.cmake | 381 --------- config/cmake_ext_mod/version.plist.in | 17 - examples/CMakeTests.cmake | 4 +- fortran/examples/CMakeTests.cmake | 4 +- fortran/test/CMakeTests.cmake | 6 +- hl/c++/examples/CMakeTests.cmake | 2 +- hl/c++/test/CMakeTests.cmake | 2 +- hl/examples/CMakeTests.cmake | 2 +- hl/fortran/examples/CMakeTests.cmake | 2 +- hl/fortran/test/CMakeTests.cmake | 10 +- hl/test/CMakeTests.cmake | 2 +- hl/tools/h5watch/CMakeTests.cmake | 6 +- java/CMakeLists.txt | 2 +- m4/aclocal_cxx.m4 | 10 +- test/CMakeTests.cmake | 24 +- tools/test/h5copy/CMakeTests.cmake | 14 +- tools/test/h5diff/CMakeTests.cmake | 8 +- tools/test/h5dump/CMakeTests.cmake | 22 +- tools/test/h5dump/CMakeTestsPBITS.cmake | 2 +- tools/test/h5dump/CMakeTestsVDS.cmake | 6 +- tools/test/h5dump/CMakeTestsXML.cmake | 2 +- tools/test/h5format_convert/CMakeTests.cmake | 16 +- tools/test/h5import/CMakeTests.cmake | 18 +- tools/test/h5jam/CMakeTests.cmake | 10 +- tools/test/h5ls/CMakeTests.cmake | 6 +- tools/test/h5ls/CMakeTestsVDS.cmake | 4 +- tools/test/h5repack/CMakeTests.cmake | 28 +- tools/test/h5stat/CMakeTests.cmake | 4 +- tools/test/misc/CMakeTestsClear.cmake | 16 +- tools/test/misc/CMakeTestsMkgrp.cmake | 4 +- tools/test/perform/CMakeTests.cmake | 14 +- 70 files changed, 4064 insertions(+), 4086 deletions(-) create mode 100644 config/cmake/FindSZIP.cmake create mode 100644 config/cmake/GetTimeOfDayTest.cpp create mode 100644 config/cmake/HDFCXXTests.cpp create mode 100644 config/cmake/HDFLibMacros.cmake create mode 100644 config/cmake/HDFMacros.cmake create mode 100644 config/cmake/HDFTests.c create mode 100644 config/cmake/HDFUseCXX.cmake create mode 100644 config/cmake/HDFUseFortran.cmake create mode 100644 config/cmake/NSIS.InstallOptions.ini.in create mode 100644 config/cmake/NSIS.template.in create mode 100644 config/cmake/grepTest.cmake create mode 100644 config/cmake/hdf.bmp create mode 100644 config/cmake/hdf.icns create mode 100644 config/cmake/hdf.ico create mode 100644 config/cmake/runTest.cmake create mode 100644 config/cmake/version.plist.in delete mode 100644 config/cmake_ext_mod/CTestCustom.cmake delete mode 100644 config/cmake_ext_mod/ConfigureChecks.cmake delete mode 100644 config/cmake_ext_mod/FindSZIP.cmake delete mode 100644 config/cmake_ext_mod/GetTimeOfDayTest.cpp delete mode 100644 config/cmake_ext_mod/HDFCXXTests.cpp delete mode 100644 config/cmake_ext_mod/HDFLibMacros.cmake delete mode 100644 config/cmake_ext_mod/HDFMacros.cmake delete mode 100644 config/cmake_ext_mod/HDFTests.c delete mode 100644 config/cmake_ext_mod/HDFUseCXX.cmake delete mode 100644 config/cmake_ext_mod/HDFUseFortran.cmake delete mode 100644 config/cmake_ext_mod/NSIS.InstallOptions.ini.in delete mode 100644 config/cmake_ext_mod/NSIS.template.in delete mode 100644 config/cmake_ext_mod/grepTest.cmake delete mode 100644 config/cmake_ext_mod/hdf.bmp delete mode 100644 config/cmake_ext_mod/hdf.icns delete mode 100644 config/cmake_ext_mod/hdf.ico delete mode 100644 config/cmake_ext_mod/runTest.cmake delete mode 100644 config/cmake_ext_mod/version.plist.in diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 018a364..f2978f8 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -269,7 +269,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) else () set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") endif () - set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp") + set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_DIR}/hdf.bmp") set (CPACK_GENERATOR "TGZ") if (WIN32) @@ -292,10 +292,10 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) endif () # set the install/unistall icon used for the installer itself # There is a bug in NSI that does not handle full unix paths properly. - set (CPACK_NSIS_MUI_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico") - set (CPACK_NSIS_MUI_UNIICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico") + set (CPACK_NSIS_MUI_ICON "${HDF_RESOURCES_DIR}\\\\hdf.ico") + set (CPACK_NSIS_MUI_UNIICON "${HDF_RESOURCES_DIR}\\\\hdf.ico") # set the package header icon for MUI - set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.bmp") + set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_DIR}\\\\hdf.bmp") set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}") if (OVERRIDE_INSTALL_VERSION) set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${OVERRIDE_INSTALL_VERSION}") @@ -325,7 +325,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_RESOURCE_FILE_LICENSE "${HDF5_BINARY_DIR}/COPYING.txt") # .. variable:: CPACK_WIX_PRODUCT_ICON # The Icon shown next to the program name in Add/Remove programs. - set(CPACK_WIX_PRODUCT_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico") + set(CPACK_WIX_PRODUCT_ICON "${HDF_RESOURCES_DIR}\\\\hdf.ico") # # .. variable:: CPACK_WIX_UI_BANNER # @@ -356,14 +356,14 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) list (APPEND CPACK_GENERATOR "DragNDrop") set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}") - set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns") + set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_DIR}/hdf.icns") option (HDF5_PACK_MACOSX_FRAMEWORK "Package the HDF5 Library in a Frameworks" OFF) if (HDF5_PACK_MACOSX_FRAMEWORK AND HDF5_BUILD_FRAMEWORKS) set (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}") set (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in / set (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/") - set (CPACK_BUNDLE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns") + set (CPACK_BUNDLE_ICON "${HDF_RESOURCES_DIR}/hdf.icns") set (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist") set (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}") #----------------------------------------------------------------------------- @@ -378,7 +378,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) ${HDF5_BINARY_DIR}/CMakeFiles/PkgInfo @ONLY ) configure_file ( - ${HDF_RESOURCES_EXT_DIR}/version.plist.in + ${HDF_RESOURCES_DIR}/version.plist.in ${HDF5_BINARY_DIR}/CMakeFiles/version.plist @ONLY ) install ( diff --git a/CMakeLists.txt b/CMakeLists.txt index f9b83de..a61532a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,6 @@ set (HDF5_HL_F90_C_LIBSH_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-shared") #----------------------------------------------------------------------------- set (HDF_CONFIG_DIR ${HDF5_SOURCE_DIR}/config) set (HDF_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake) -set (HDF_RESOURCES_EXT_DIR ${HDF5_SOURCE_DIR}/config/cmake_ext_mod) set (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src) set (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test) set (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++) @@ -438,11 +437,11 @@ set (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") #----------------------------------------------------------------------------- # Include some macros for reusable code #----------------------------------------------------------------------------- -include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake) +include (${HDF_RESOURCES_DIR}/HDFMacros.cmake) HDF_DIR_PATHS(${HDF5_PACKAGE_NAME}) -include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake) +include (${HDF_RESOURCES_DIR}/HDFLibMacros.cmake) include (${HDF_RESOURCES_DIR}/HDF5PluginMacros.cmake) include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake) @@ -668,7 +667,7 @@ else () endif () include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) -set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) +set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${CMAKE_MODULE_PATH}) #----------------------------------------------------------------------------- # Option to Enable HDFS @@ -1026,7 +1025,7 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) if (HDF5_BUILD_FORTRAN) - include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) + include (${HDF_RESOURCES_DIR}/HDFUseFortran.cmake) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}") @@ -1085,7 +1084,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") endif () endif () - include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake) + include (${HDF_RESOURCES_DIR}/HDFUseCXX.cmake) include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake) add_subdirectory (c++) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index a7fc9b8..5145254 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -41,7 +41,7 @@ foreach (example ${examples}) -D "TEST_OUTPUT=cpp_ex_${example}.txt" #-D "TEST_REFERENCE=cpp_ex_${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex) @@ -53,7 +53,6 @@ endforeach () #the following dependencies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create) # SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds) - add_test ( NAME CPP_ex_tutr-clear-objects COMMAND ${CMAKE_COMMAND} @@ -80,7 +79,7 @@ foreach (example ${tutr_examples}) -D "TEST_OUTPUT=cpp_ex_${example}.txt" #-D "TEST_REFERENCE=cpp_ex_${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex_tutr) diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 2a0a6be..e34f629 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -43,7 +43,7 @@ else () -D "TEST_OUTPUT=cpp_testhdf5.txt" #-D "TEST_REFERENCE=cpp_testhdf5.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects) diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index ced9b0c..3d6ab74 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -22,7 +22,6 @@ H5_CREATE_VFD_DIR() ### T H E T E S T S M A C R O S ### ############################################################################## ############################################################################## - macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 53d815e..959e262 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -30,9 +30,17 @@ set (CTEST_CUSTOM_WARNING_EXCEPTION "config.cmake.xlatefile.c" "warning.*unknown pragma" "warning.*unrecognized .pragma" - "note: expanded from macro" +# "note: expanded from macro" # HDDFFV-11074 "This directive is not standard" + ".*note.*expected.*void.*but argument is of type.*volatile.*" + ".*src.SZIP.*:[ \t]*warning.*" + ".*src.ZLIB.*:[ \t]*warning.*" + ".*src.JPEG.*:[ \t]*warning.*" + ".*POSIX name for this item is deprecated.*" + ".*disabling jobserver mode.*" + ".*warning.*implicit declaration of function.*" + ".*note: expanded from macro.*" ) set (CTEST_CUSTOM_MEMCHECK_IGNORE diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 27eb93f..dbf395b 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -12,9 +12,693 @@ #----------------------------------------------------------------------------- # Include all the necessary files for macros #----------------------------------------------------------------------------- +include (CheckFunctionExists) +include (CheckIncludeFile) +include (CheckIncludeFiles) +include (CheckLibraryExists) +include (CheckSymbolExists) +include (CheckTypeSize) +include (CheckVariableExists) +include (TestBigEndian) +include (CheckStructHasMember) + set (HDF_PREFIX "H5") -include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) +# Check for Darwin (not just Apple - we also want to catch OpenDarwin) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set (${HDF_PREFIX}_HAVE_DARWIN 1) +endif () + +# Check for Solaris +if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + set (${HDF_PREFIX}_HAVE_SOLARIS 1) +endif () + +#----------------------------------------------------------------------------- +# This MACRO checks IF the symbol exists in the library and IF it +# does, it appends library to the list. +#----------------------------------------------------------------------------- +set (LINK_LIBS "") +macro (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) + CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) + if (${VARIABLE}) + set (LINK_LIBS ${LINK_LIBS} ${LIBRARY}) + endif () +endmacro () + +# ---------------------------------------------------------------------- +# WINDOWS Hard code Values +# ---------------------------------------------------------------------- +set (WINDOWS) + +if (MINGW) + set (${HDF_PREFIX}_HAVE_MINGW 1) + set (WINDOWS 1) # MinGW tries to imitate Windows + set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") + set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) + set (__USE_MINGW_ANSI_STDIO 1) +endif () + +if (WIN32 AND NOT MINGW) + if (NOT UNIX) + set (WINDOWS 1) + set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") + if (MSVC) + set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) + endif () + endif () +endif () + +if (WINDOWS) + set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") + set (${HDF_PREFIX}_HAVE_WIN32_API 1) + set (${HDF_PREFIX}_HAVE_LIBM 1) + set (${HDF_PREFIX}_HAVE_STRDUP 1) + set (${HDF_PREFIX}_HAVE_SYSTEM 1) + set (${HDF_PREFIX}_HAVE_LONGJMP 1) + if (NOT MINGW) + set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) + set (${HDF_PREFIX}_HAVE_FUNCTION 1) + endif () + if (NOT UNIX AND NOT CYGWIN) + set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) + set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) + set (${HDF_PREFIX}_HAVE_TIMEZONE 1) + set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) + set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) + set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) + endif () +endif () + +# ---------------------------------------------------------------------- +# END of WINDOWS Hard code Values +# ---------------------------------------------------------------------- + +if (NOT WINDOWS) + TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN) +endif () + +#----------------------------------------------------------------------------- +# Check IF header file exists and add it to the list. +#----------------------------------------------------------------------------- +macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) + CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) + if (${VARIABLE}) + set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) + endif () +endmacro () + +#----------------------------------------------------------------------------- +# Check for the existence of certain header files +#----------------------------------------------------------------------------- +CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) +CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) +CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) +CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) +CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) +CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) +CHECK_INCLUDE_FILE_CONCAT ("pwd.h" ${HDF_PREFIX}_HAVE_PWD_H) + +# Windows +CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) +if (NOT CYGWIN) + CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) +endif () + +if (CMAKE_SYSTEM_NAME MATCHES "OSF") + CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) + CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) +else () + set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) + set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) +endif () + +CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) +CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) +CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) +CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H) +CHECK_INCLUDE_FILE_CONCAT ("string.h" ${HDF_PREFIX}_HAVE_STRING_H) +CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H) +CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H) +CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H) +CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H) +CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H) +CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H) +CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H) +CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H) +# _Bool type support +CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) + +## Check for non-standard extension quadmath.h + +CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) +if (${C_HAVE_QUADMATH}) + set(${HDF_PREFIX}_HAVE_QUADMATH_H 1) +else () + set(${HDF_PREFIX}_HAVE_QUADMATH_H 0) +endif () + +if (CYGWIN) + set (${HDF_PREFIX}_HAVE_LSEEK64 0) +endif () + +#----------------------------------------------------------------------------- +# Check for the math library "m" +#----------------------------------------------------------------------------- +if (MINGW OR NOT WINDOWS) + CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil ${HDF_PREFIX}_HAVE_LIBM) + CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen ${HDF_PREFIX}_HAVE_LIBDL) + CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup ${HDF_PREFIX}_HAVE_LIBWS2_32) + CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32) +endif () + +# UCB (BSD) compatibility library +CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB) + +# For other tests to use the same libraries +set (HDF5_REQUIRED_LIBRARIES ${HDF5_REQUIRED_LIBRARIES} ${LINK_LIBS}) + +set (USE_INCLUDES "") +if (WINDOWS) + set (USE_INCLUDES ${USE_INCLUDES} "windows.h") +endif () + +# For other specific tests, use this MACRO. +macro (HDF_FUNCTION_TEST OTHER_TEST) + if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) + set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") + + foreach (def + HAVE_SYS_TIME_H + HAVE_UNISTD_H + HAVE_SYS_TYPES_H + HAVE_SYS_SOCKET_H + ) + if ("${${HDF_PREFIX}_${def}}") + set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") + endif () + endforeach () + + if (LARGEFILE) + set (MACRO_CHECK_FUNCTION_DEFINITIONS + "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" + ) + endif () + + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (TRACE "Performing ${OTHER_TEST}") + endif () + try_compile (${OTHER_TEST} + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT + ) + if (${OTHER_TEST}) + set (${HDF_PREFIX}_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Performing Other Test ${OTHER_TEST} - Success") + endif () + else () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Performing Other Test ${OTHER_TEST} - Failed") + endif () + set (${HDF_PREFIX}_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing Other Test ${OTHER_TEST} failed with the following output:\n" + "${OUTPUT}\n" + ) + endif () + endif () +endmacro () + +#----------------------------------------------------------------------------- +# Check for these functions before the time headers are checked +#----------------------------------------------------------------------------- +HDF_FUNCTION_TEST (STDC_HEADERS) + +#----------------------------------------------------------------------------- +# Check for large file support +#----------------------------------------------------------------------------- + +# The linux-lfs option is deprecated. +set (LINUX_LFS 0) + +set (HDF_EXTRA_C_FLAGS) +set (HDF_EXTRA_FLAGS) +if (MINGW OR NOT WINDOWS) + if (CMAKE_SYSTEM_NAME MATCHES "Linux") + # Linux Specific flags + # This was originally defined as _POSIX_SOURCE which was updated to + # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX + # functionality so clock_gettime and CLOCK_MONOTONIC are defined + # correctly. This was later updated to 200112L so that + # posix_memalign() is visible for the direct VFD code on Linux + # systems. + # POSIX feature information can be found in the gcc manual at: + # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html + set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L) + + # Need to add this so that O_DIRECT is visible for the direct + # VFD on Linux systems. + set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE) + + option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) + if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN) + set (msg "Performing TEST_LFS_WORKS") + try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/HDFTests.c + COMPILE_DEFINITIONS "-DTEST_LFS_WORKS" + ) + + # The LARGEFILE definitions were from the transition period + # and are probably no longer needed. The FILE_OFFSET_BITS + # check should be generalized for all POSIX systems as it + # is in the Autotools. + if (TEST_LFS_WORKS_COMPILE) + if (TEST_LFS_WORKS_RUN MATCHES 0) + set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) + set (LARGEFILE 1) + set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "${msg}... yes") + endif () + else () + set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "${msg}... no") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n" + ) + endif () + else () + set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "${msg}... no") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Test TEST_LFS_WORKS Compile failed\n" + ) + endif () + endif () + set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) + endif () +endif () + +#----------------------------------------------------------------------------- +# Check for HAVE_OFF64_T functionality +#----------------------------------------------------------------------------- +if (MINGW OR NOT WINDOWS) + HDF_FUNCTION_TEST (HAVE_OFF64_T) + if (${HDF_PREFIX}_HAVE_OFF64_T) + CHECK_FUNCTION_EXISTS (lseek64 ${HDF_PREFIX}_HAVE_LSEEK64) + endif () + + CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO) + + CHECK_STRUCT_HAS_MEMBER("struct stat64" st_blocks "sys/types.h;sys/stat.h" HAVE_STAT64_STRUCT) + if (HAVE_STAT64_STRUCT) + CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64) + endif () +endif () + +#----------------------------------------------------------------------------- +# Check the size in bytes of all the int and float types +#----------------------------------------------------------------------------- +macro (HDF_CHECK_TYPE_SIZE type var) + set (aType ${type}) + set (aVar ${var}) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (TRACE "Checking size of ${aType} and storing into ${aVar}") + endif () + CHECK_TYPE_SIZE (${aType} ${aVar}) + if (NOT ${aVar}) + set (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (TRACE "Size of ${aType} was NOT Found") + endif () + endif () +endmacro () + +HDF_CHECK_TYPE_SIZE (char ${HDF_PREFIX}_SIZEOF_CHAR) +HDF_CHECK_TYPE_SIZE (short ${HDF_PREFIX}_SIZEOF_SHORT) +HDF_CHECK_TYPE_SIZE (int ${HDF_PREFIX}_SIZEOF_INT) +HDF_CHECK_TYPE_SIZE (unsigned ${HDF_PREFIX}_SIZEOF_UNSIGNED) +if (NOT APPLE) + HDF_CHECK_TYPE_SIZE (long ${HDF_PREFIX}_SIZEOF_LONG) +endif () +HDF_CHECK_TYPE_SIZE ("long long" ${HDF_PREFIX}_SIZEOF_LONG_LONG) +HDF_CHECK_TYPE_SIZE (__int64 ${HDF_PREFIX}_SIZEOF___INT64) +if (NOT ${HDF_PREFIX}_SIZEOF___INT64) + set (${HDF_PREFIX}_SIZEOF___INT64 0) +endif () + +HDF_CHECK_TYPE_SIZE (float ${HDF_PREFIX}_SIZEOF_FLOAT) +HDF_CHECK_TYPE_SIZE (double ${HDF_PREFIX}_SIZEOF_DOUBLE) +HDF_CHECK_TYPE_SIZE ("long double" ${HDF_PREFIX}_SIZEOF_LONG_DOUBLE) + +HDF_CHECK_TYPE_SIZE (int8_t ${HDF_PREFIX}_SIZEOF_INT8_T) +HDF_CHECK_TYPE_SIZE (uint8_t ${HDF_PREFIX}_SIZEOF_UINT8_T) +HDF_CHECK_TYPE_SIZE (int_least8_t ${HDF_PREFIX}_SIZEOF_INT_LEAST8_T) +HDF_CHECK_TYPE_SIZE (uint_least8_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST8_T) +HDF_CHECK_TYPE_SIZE (int_fast8_t ${HDF_PREFIX}_SIZEOF_INT_FAST8_T) +HDF_CHECK_TYPE_SIZE (uint_fast8_t ${HDF_PREFIX}_SIZEOF_UINT_FAST8_T) + +HDF_CHECK_TYPE_SIZE (int16_t ${HDF_PREFIX}_SIZEOF_INT16_T) +HDF_CHECK_TYPE_SIZE (uint16_t ${HDF_PREFIX}_SIZEOF_UINT16_T) +HDF_CHECK_TYPE_SIZE (int_least16_t ${HDF_PREFIX}_SIZEOF_INT_LEAST16_T) +HDF_CHECK_TYPE_SIZE (uint_least16_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST16_T) +HDF_CHECK_TYPE_SIZE (int_fast16_t ${HDF_PREFIX}_SIZEOF_INT_FAST16_T) +HDF_CHECK_TYPE_SIZE (uint_fast16_t ${HDF_PREFIX}_SIZEOF_UINT_FAST16_T) + +HDF_CHECK_TYPE_SIZE (int32_t ${HDF_PREFIX}_SIZEOF_INT32_T) +HDF_CHECK_TYPE_SIZE (uint32_t ${HDF_PREFIX}_SIZEOF_UINT32_T) +HDF_CHECK_TYPE_SIZE (int_least32_t ${HDF_PREFIX}_SIZEOF_INT_LEAST32_T) +HDF_CHECK_TYPE_SIZE (uint_least32_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST32_T) +HDF_CHECK_TYPE_SIZE (int_fast32_t ${HDF_PREFIX}_SIZEOF_INT_FAST32_T) +HDF_CHECK_TYPE_SIZE (uint_fast32_t ${HDF_PREFIX}_SIZEOF_UINT_FAST32_T) + +HDF_CHECK_TYPE_SIZE (int64_t ${HDF_PREFIX}_SIZEOF_INT64_T) +HDF_CHECK_TYPE_SIZE (uint64_t ${HDF_PREFIX}_SIZEOF_UINT64_T) +HDF_CHECK_TYPE_SIZE (int_least64_t ${HDF_PREFIX}_SIZEOF_INT_LEAST64_T) +HDF_CHECK_TYPE_SIZE (uint_least64_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST64_T) +HDF_CHECK_TYPE_SIZE (int_fast64_t ${HDF_PREFIX}_SIZEOF_INT_FAST64_T) +HDF_CHECK_TYPE_SIZE (uint_fast64_t ${HDF_PREFIX}_SIZEOF_UINT_FAST64_T) + +HDF_CHECK_TYPE_SIZE (size_t ${HDF_PREFIX}_SIZEOF_SIZE_T) +HDF_CHECK_TYPE_SIZE (ssize_t ${HDF_PREFIX}_SIZEOF_SSIZE_T) +if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) + set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) +endif () +if (MINGW OR NOT WINDOWS) + HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) +endif () + +HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T) +HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T) +if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) + set (${HDF_PREFIX}_SIZEOF_OFF64_T 0) +endif () +HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) + +#----------------------------------------------------------------------------- +# Extra C99 types +#----------------------------------------------------------------------------- + +# _Bool type support +if (HAVE_STDBOOL_H) + set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) + HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) +else () + HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) +endif () + +if (MINGW OR NOT WINDOWS) + #----------------------------------------------------------------------------- + # Check if the dev_t type is a scalar type + #----------------------------------------------------------------------------- + HDF_FUNCTION_TEST (DEV_T_IS_SCALAR) + + # ---------------------------------------------------------------------- + # Check for MONOTONIC_TIMER support (used in clock_gettime). This has + # to be done after any POSIX/BSD defines to ensure that the test gets + # the correct POSIX level on linux. + CHECK_VARIABLE_EXISTS (CLOCK_MONOTONIC HAVE_CLOCK_MONOTONIC) + + #----------------------------------------------------------------------------- + # Check a bunch of time functions + #----------------------------------------------------------------------------- + CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE_TM_GMTOFF) + CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE___TM_GMTOFF) + CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_TIME_WITH_SYS_TIME) + if (${HDF_PREFIX}_HAVE_SYS_TIME_H) + CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) + else () + CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) + endif () + CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY) + foreach (time_test +# HAVE_TIMEZONE + GETTIMEOFDAY_GIVES_TZ + HAVE_TM_ZONE + HAVE_STRUCT_TM_TM_ZONE + ) + HDF_FUNCTION_TEST (${time_test}) + endforeach () + if (NOT CYGWIN AND NOT MINGW) + HDF_FUNCTION_TEST (HAVE_TIMEZONE) + endif () + + # ---------------------------------------------------------------------- + # Does the struct stat have the st_blocks field? This field is not POSIX. + # + CHECK_STRUCT_HAS_MEMBER("struct stat" st_blocks "sys/types.h;sys/stat.h" ${HDF_PREFIX}_HAVE_STAT_ST_BLOCKS) + + # ---------------------------------------------------------------------- + # How do we figure out the width of a tty in characters? + # + CHECK_FUNCTION_EXISTS (ioctl ${HDF_PREFIX}_HAVE_IOCTL) + CHECK_STRUCT_HAS_MEMBER ("struct videoconfig" numtextcols "" ${HDF_PREFIX}_HAVE_STRUCT_VIDEOCONFIG) + CHECK_STRUCT_HAS_MEMBER ("struct text_info" screenwidth "" ${HDF_PREFIX}_HAVE_STRUCT_TEXT_INFO) + CHECK_FUNCTION_EXISTS (_getvideoconfig ${HDF_PREFIX}_HAVE__GETVIDEOCONFIG) + CHECK_FUNCTION_EXISTS (gettextinfo ${HDF_PREFIX}_HAVE_GETTEXTINFO) + CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) + if (NOT CYGWIN) + CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo ${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO) + endif () + CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ) + CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGETD) + + # ---------------------------------------------------------------------- + # cygwin user credentials are different then on linux + # + if (NOT CYGWIN AND NOT MINGW) + CHECK_FUNCTION_EXISTS (getpwuid ${HDF_PREFIX}_HAVE_GETPWUID) + endif () +endif () + +#----------------------------------------------------------------------------- +# Check for some functions that are used +# +CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM) +CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL) +CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK) +CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK) +CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF) +CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL) + +CHECK_FUNCTION_EXISTS (gethostname ${HDF_PREFIX}_HAVE_GETHOSTNAME) +CHECK_FUNCTION_EXISTS (getrusage ${HDF_PREFIX}_HAVE_GETRUSAGE) +CHECK_FUNCTION_EXISTS (llround ${HDF_PREFIX}_HAVE_LLROUND) +CHECK_FUNCTION_EXISTS (llroundf ${HDF_PREFIX}_HAVE_LLROUNDF) +CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND) +CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF) +CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT) + +CHECK_FUNCTION_EXISTS (pread ${HDF_PREFIX}_HAVE_PREAD) +CHECK_FUNCTION_EXISTS (pwrite ${HDF_PREFIX}_HAVE_PWRITE) +CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) +CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) +CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND) +CHECK_FUNCTION_EXISTS (roundf ${HDF_PREFIX}_HAVE_ROUNDF) +CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO) + +CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL) +CHECK_FUNCTION_EXISTS (longjmp ${HDF_PREFIX}_HAVE_LONGJMP) +CHECK_FUNCTION_EXISTS (setjmp ${HDF_PREFIX}_HAVE_SETJMP) +CHECK_FUNCTION_EXISTS (siglongjmp ${HDF_PREFIX}_HAVE_SIGLONGJMP) +CHECK_FUNCTION_EXISTS (sigsetjmp ${HDF_PREFIX}_HAVE_SIGSETJMP) +CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) + +CHECK_FUNCTION_EXISTS (snprintf ${HDF_PREFIX}_HAVE_SNPRINTF) +CHECK_FUNCTION_EXISTS (srandom ${HDF_PREFIX}_HAVE_SRANDOM) +CHECK_FUNCTION_EXISTS (strdup ${HDF_PREFIX}_HAVE_STRDUP) +CHECK_FUNCTION_EXISTS (strtoll ${HDF_PREFIX}_HAVE_STRTOLL) +CHECK_FUNCTION_EXISTS (strtoull ${HDF_PREFIX}_HAVE_STRTOULL) +CHECK_FUNCTION_EXISTS (symlink ${HDF_PREFIX}_HAVE_SYMLINK) +CHECK_FUNCTION_EXISTS (system ${HDF_PREFIX}_HAVE_SYSTEM) + +CHECK_FUNCTION_EXISTS (tmpfile ${HDF_PREFIX}_HAVE_TMPFILE) +CHECK_FUNCTION_EXISTS (asprintf ${HDF_PREFIX}_HAVE_ASPRINTF) +CHECK_FUNCTION_EXISTS (vasprintf ${HDF_PREFIX}_HAVE_VASPRINTF) +CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) + +CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) +if (MINGW OR NOT WINDOWS) + if (${HDF_PREFIX}_HAVE_VSNPRINTF) + HDF_FUNCTION_TEST (VSNPRINTF_WORKS) + endif () +endif () + +#----------------------------------------------------------------------------- +# sigsetjmp is special; may actually be a macro +#----------------------------------------------------------------------------- +if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) + if (${HDF_PREFIX}_HAVE_SETJMP_H) + CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) + if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) + set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Check a bunch of other functions +#----------------------------------------------------------------------------- +if (MINGW OR NOT WINDOWS) + foreach (other_test + HAVE_ATTRIBUTE + HAVE_C99_FUNC + HAVE_FUNCTION + HAVE_C99_DESIGNATED_INITIALIZER + SYSTEM_SCOPE_THREADS + HAVE_SOCKLEN_T + ) + HDF_FUNCTION_TEST (${other_test}) + endforeach () +endif () + +#----------------------------------------------------------------------------- +# Check if InitOnceExecuteOnce is available +#----------------------------------------------------------------------------- +if (WINDOWS) + if (NOT HDF_NO_IOEO_TEST) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Checking for InitOnceExecuteOnce:") + endif () + if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO) + if (LARGEFILE) + set (CMAKE_REQUIRED_DEFINITIONS + "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" + ) + endif () + set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") + if (CMAKE_REQUIRED_INCLUDES) + set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else () + set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif () + + TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" + CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}" + COMPILE_OUTPUT_VARIABLE OUTPUT + ) + # if it did not compile make the return value fail code of 1 + if (NOT HAVE_IOEO_COMPILED) + set (HAVE_IOEO_EXITCODE 1) + endif () + # if the return value was 0 then it worked + if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) + set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Performing Test InitOnceExecuteOnce - Success") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test InitOnceExecuteOnce succeeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${HAVE_IOEO}\n") + else () + if (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") + set (${HDF_PREFIX}_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") + else () + set (${HDF_PREFIX}_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") + endif () + + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Performing Test InitOnceExecuteOnce - Failed") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing InitOnceExecuteOnce Test failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${HAVE_IOEO_EXITCODE}\n") + endif () + endif () + endif () +endif () + +#----------------------------------------------------------------------------- +# Determine how 'inline' is used +#----------------------------------------------------------------------------- +foreach (inline_test inline __inline__ __inline) + string (TOUPPER ${inline_test} INLINE_TEST_MACRO) + HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO}) +endforeach () + +#----------------------------------------------------------------------------- +# Check how to print a Long Long integer +#----------------------------------------------------------------------------- +if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") + set (PRINT_LL_FOUND 0) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Checking for appropriate format for 64 bit long:") + endif () + set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") + if (${HDF_PREFIX}_SIZEOF_LONG_LONG) + set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") + endif () + TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}" + RUN_OUTPUT_VARIABLE OUTPUT + ) + if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) + if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) + string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") + set (PRINT_LL_FOUND 1) + else () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") + endif () + endif () + else () + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" + ) + endif () + + if (PRINT_LL_FOUND) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") + endif () + else () + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Checking for appropriate format for 64 bit long: not found") + endif () + set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL + "Width for printf for type `long long' or `__int64', us. `ll" + ) + endif () +endif () + +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can handle converting +# denormalized floating-point values. +# (This flag should be set for all machines, except for the Crays, where +# the cache value is set in its config file) +#----------------------------------------------------------------------------- +set (${HDF_PREFIX}_CONVERT_DENORMAL_FLOAT 1) + +# ---------------------------------------------------------------------- +# Set a special flag when using memory sanity checkers like Valgrind. +# This disables the free lists, as the memory reuse scheme they implement +# can hide memory problems. +#----------------------------------------------------------------------------- if (HDF5_ENABLE_USING_MEMCHECKER) set (${HDF_PREFIX}_USING_MEMCHECKER 1) endif () @@ -146,7 +830,7 @@ if (NOT WINDOWS) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DTEST_DIRECT_VFD_WORKS -D_GNU_SOURCE ${CMAKE_REQUIRED_FLAGS}") TRY_RUN (TEST_DIRECT_VFD_WORKS_RUN TEST_DIRECT_VFD_WORKS_COMPILE ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + ${HDF_RESOURCES_DIR}/HDFTests.c CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} OUTPUT_VARIABLE OUTPUT ) @@ -194,7 +878,6 @@ endif () # ---------------------------------------------------------------------- # Check whether we can build the Mirror VFD -# Header-check flags set in config/cmake_ext_mod/ConfigureChecks.cmake # ---------------------------------------------------------------------- option (HDF5_ENABLE_MIRROR_VFD "Build the Mirror Virtual File Driver" OFF) if (HDF5_ENABLE_MIRROR_VFD) diff --git a/config/cmake/FindSZIP.cmake b/config/cmake/FindSZIP.cmake new file mode 100644 index 0000000..846a3d1 --- /dev/null +++ b/config/cmake/FindSZIP.cmake @@ -0,0 +1,129 @@ +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +######################################################################### + +# - Derived from the FindTiff.cmake and FindJPEG.cmake that is included with cmake +# FindSZIP + +# Find the native SZIP includes and library + +# Imported targets +################## + +# This module defines the following :prop_tgt:`IMPORTED` targets: +# +# SZIP::SZIP +# The SZIP library, if found. +# +# Result variables +################### + +# 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. +# SZIP_INCLUDE_DIRS, the directory containing the SZIP headers. +# SZIP_LIBRARIES, libraries to link against to use SZIP. + +# Cache variables +################# + +# The following variables may also be set: + +# SZIP_LIBRARY, where to find the SZIP library. +# SZIP_LIBRARY_DEBUG - Debug version of SZIP library +# SZIP_LIBRARY_RELEASE - Release Version of SZIP library + +# message (STATUS "Finding SZIP library and headers..." ) +######################################################################### + + +find_path(SZIP_INCLUDE_DIR szlib.h) + +set(szip_names ${SZIP_NAMES} sz szip szip-static libsz libszip libszip-static) +foreach(name ${szip_names}) + list (APPEND szip_names_debug "${name}d") +endforeach() + +if(NOT SZIP_LIBRARY) + find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names}) + find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug}) + include(SelectLibraryConfigurations) + select_library_configurations(SZIP) + mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG) +endif() +unset(szip_names) +unset(szip_names_debug) + +if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h") + file(STRINGS "${SZIP_INCLUDE_DIR}/SZconfig.h" szip_version_str + REGEX "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+.*") + + string(REGEX REPLACE "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+([0-9]+).*" + "\\1" SZIP_VERSION "${szip_version_str}") + unset(szip_version_str) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SZIP + REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR + VERSION_VAR SZIP_VERSION) + +if(SZIP_FOUND) + set(SZIP_LIBRARIES ${SZIP_LIBRARY}) + set(SZIP_INCLUDE_DIRS "${SZIP_INCLUDE_DIR}") + + if(NOT TARGET SZIP::SZIP) + add_library(SZIP::SZIP UNKNOWN IMPORTED) + if(SZIP_INCLUDE_DIRS) + set_target_properties(SZIP::SZIP PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIRS}") + endif() + if(EXISTS "${SZIP_LIBRARY}") + set_target_properties(SZIP::SZIP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${SZIP_LIBRARY}") + endif() + if(EXISTS "${SZIP_LIBRARY_RELEASE}") + set_property(TARGET SZIP::SZIP APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(SZIP::SZIP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${SZIP_LIBRARY_RELEASE}") + endif() + if(EXISTS "${SZIP_LIBRARY_DEBUG}") + set_property(TARGET SZIP::SZIP APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(SZIP::SZIP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${SZIP_LIBRARY_DEBUG}") + endif() + endif() +endif() + +mark_as_advanced(SZIP_LIBRARY SZIP_INCLUDE_DIR) + +# Report the results. +if (NOT SZIP_FOUND) + set (SZIP_DIR_MESSAGE + "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable." + ) + if (NOT SZIP_FIND_QUIETLY) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "${SZIP_DIR_MESSAGE}") + endif () + else () + if (SZIP_FIND_REQUIRED) + message (FATAL_ERROR "SZip was NOT found and is Required by this project") + endif () + endif () +endif () diff --git a/config/cmake/GetTimeOfDayTest.cpp b/config/cmake/GetTimeOfDayTest.cpp new file mode 100644 index 0000000..b35efa5 --- /dev/null +++ b/config/cmake/GetTimeOfDayTest.cpp @@ -0,0 +1,26 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#if defined (TRY_SYS_TIME_H) +#include +/* #include */ +#endif + + +#if defined (TRY_TIME_H) +#include +#endif + +int main(int argc, char **argv) { + struct timeval t1; + gettimeofday(&t1, 0x00); + return 0; +} diff --git a/config/cmake/HDFCXXTests.cpp b/config/cmake/HDFCXXTests.cpp new file mode 100644 index 0000000..08ccb34 --- /dev/null +++ b/config/cmake/HDFCXXTests.cpp @@ -0,0 +1,46 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifdef CXX_HAVE_OFFSETOF + +#include +#include + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus +extern "C" +# endif +int FC_DUMMY_MAIN() +{ return 1;} +#endif +#endif +int +main () +{ + + struct index_st + { + unsigned char type; + unsigned char num; + unsigned int len; + }; + typedef struct index_st index_t; + int x,y; + x = offsetof(struct index_st, len); + y = offsetof(index_t, num) + + ; + return 0; +} + +#endif diff --git a/config/cmake/HDFLibMacros.cmake b/config/cmake/HDFLibMacros.cmake new file mode 100644 index 0000000..d2f2660 --- /dev/null +++ b/config/cmake/HDFLibMacros.cmake @@ -0,0 +1,250 @@ +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +#------------------------------------------------------------------------------- +macro (ORIGINAL_ZLIB_LIBRARY compress_type) + if (${compress_type} MATCHES "GIT") + FetchContent_Declare (HDF5_ZLIB + GIT_REPOSITORY ${ZLIB_URL} + GIT_TAG ${ZLIB_BRANCH} + ) + elseif (${compress_type} MATCHES "TGZ") + FetchContent_Declare (HDF5_ZLIB + URL ${ZLIB_URL} + URL_HASH "" + ) + endif () + FetchContent_GetProperties(HDF5_ZLIB) + if(NOT zlib_POPULATED) + FetchContent_Populate(HDF5_ZLIB) + + # Copy an additional/replacement files into the populated source + file(COPY ${HDF_RESOURCES_DIR}/ZLIB/CMakeLists.txt DESTINATION ${hdf5_zlib_SOURCE_DIR}) + + add_subdirectory(${hdf5_zlib_SOURCE_DIR} ${hdf5_zlib_BINARY_DIR}) + endif() + + add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) + set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") + set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) + + set (ZLIB_INCLUDE_DIR_GEN "${hdf5_zlib_BINARY_DIR}") + set (ZLIB_INCLUDE_DIR "${hdf5_zlib_SOURCE_DIR}") + set (ZLIB_FOUND 1) + set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) +endmacro () + +#------------------------------------------------------------------------------- +macro (ORIGINAL_SZIP_LIBRARY compress_type encoding) + # Only libaec library is usable + if (${compress_type} MATCHES "GIT") + FetchContent_Declare (SZIP + GIT_REPOSITORY ${SZIP_URL} + GIT_TAG ${SZIP_BRANCH} + ) + elseif (${compress_type} MATCHES "TGZ") + FetchContent_Declare (SZIP + URL ${SZIP_URL} + URL_HASH "" + ) + endif () + FetchContent_GetProperties(SZIP) + if(NOT szip_POPULATED) + FetchContent_Populate(SZIP) + + # Copy an additional/replacement files into the populated source + file(COPY ${HDF_RESOURCES_DIR}/LIBAEC/CMakeLists.txt DESTINATION ${szip_SOURCE_DIR}) + + add_subdirectory(${szip_SOURCE_DIR} ${szip_BINARY_DIR}) + endif() + + set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) + add_library (${HDF_PACKAGE_NAMESPACE}szaec-static ALIAS szaec-static) + add_library (${HDF_PACKAGE_NAMESPACE}aec-static ALIAS aec-static) + set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") + set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) + + set (SZIP_INCLUDE_DIR_GEN "${szip_BINARY_DIR}") + set (SZIP_INCLUDE_DIR "${szip_SOURCE_DIR}/include") + set (SZIP_FOUND 1) + set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) +endmacro () + +#------------------------------------------------------------------------------- +macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) + if (${compress_type} MATCHES "GIT") + EXTERNALPROJECT_ADD (SZIP + GIT_REPOSITORY ${SZIP_URL} + GIT_TAG ${SZIP_BRANCH} + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=OFF + -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} + -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} + -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} + -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} + ) + elseif (${compress_type} MATCHES "TGZ") + EXTERNALPROJECT_ADD (SZIP + URL ${SZIP_URL} + URL_MD5 "" + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=OFF + -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} + -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} + -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} + -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} + ) + endif () + externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) +# +##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) +# Create imported target szip-static + if (USE_LIBAEC) + add_library(${HDF_PACKAGE_NAMESPACE}szaec-static STATIC IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szaec-static "szaec" STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}szaec-static SZIP) + add_library(${HDF_PACKAGE_NAMESPACE}aec-static STATIC IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}aec-static "aec" STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}aec-static SZIP) + set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") + else () + add_library(${HDF_PACKAGE_NAMESPACE}szip-static STATIC IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-static "szip" STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-static SZIP) + set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-static") + endif () + set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) + + set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") + if (USE_LIBAEC) + set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/include") + else () + set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") + endif () + set (SZIP_FOUND 1) + set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) +endmacro () + +#------------------------------------------------------------------------------- +macro (PACKAGE_SZIP_LIBRARY compress_type) + set (SZIP_HDR "SZconfig") + if (USE_LIBAEC) + set (SZIP_HDR "aec_config") + else () + set (SZIP_HDR "libaec_Export") + endif () + add_custom_target (SZIP-GenHeader-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/${SZIP_HDR}.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/${SZIP_HDR}.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_HDR}.h) + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") + add_dependencies (SZIP-GenHeader-Copy SZIP) + endif () +endmacro () + +#------------------------------------------------------------------------------- +macro (EXTERNAL_ZLIB_LIBRARY compress_type) + if (${compress_type} MATCHES "GIT") + EXTERNALPROJECT_ADD (HDF5_ZLIB + GIT_REPOSITORY ${ZLIB_URL} + GIT_TAG ${ZLIB_BRANCH} + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=OFF + -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} + -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} + -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} + -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} + ) + elseif (${compress_type} MATCHES "TGZ") + EXTERNALPROJECT_ADD (HDF5_ZLIB + URL ${ZLIB_URL} + URL_MD5 "" + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=OFF + -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} + -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} + -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} + -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} + -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} + -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} + ) + endif () + externalproject_get_property (HDF5_ZLIB BINARY_DIR SOURCE_DIR) + + if (NOT ZLIB_LIB_NAME) + set (ZLIB_LIB_NAME "z") + endif () +##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) +# Create imported target zlib-static + add_library(${HDF_PACKAGE_NAMESPACE}zlib-static STATIC IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-static ${ZLIB_LIB_NAME} STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-static HDF5_ZLIB) + set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") + set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) + + set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}") + set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}") + set (ZLIB_FOUND 1) + set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) +endmacro () + +#------------------------------------------------------------------------------- +macro (PACKAGE_ZLIB_LIBRARY compress_type) + add_custom_target (ZLIB-GenHeader-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") + add_dependencies (ZLIB-GenHeader-Copy HDF5_ZLIB) + endif () +endmacro () diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake new file mode 100644 index 0000000..7483f3c --- /dev/null +++ b/config/cmake/HDFMacros.cmake @@ -0,0 +1,520 @@ +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +#------------------------------------------------------------------------------- +macro (SET_HDF_BUILD_TYPE) + get_property (_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if (_isMultiConfig) + set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) + set (HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR}) + set (HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) + else () + set (HDF_CFG_BUILD_TYPE ".") + if (CMAKE_BUILD_TYPE) + set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) + set (HDF_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + else () + set (HDF_CFG_NAME "Release") + set (HDF_BUILD_TYPE "Release") + endif () + endif () + if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Setting build type to 'RelWithDebInfo' as none was specified.") + endif() + 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" + "MinSizeRel" "RelWithDebInfo") + endif () +endmacro () + +#------------------------------------------------------------------------------- +macro (SET_GLOBAL_VARIABLE name value) + set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE) +endmacro () + +#------------------------------------------------------------------------------- +macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) + #set (source_group_path "Source/AIM/${NAME}") + string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}) + source_group (${source_group_path} FILES ${HEADERS} ${SOURCES}) + + #-- The following is needed if we ever start to use OS X Frameworks but only + #-- works on CMake 2.6 and greater + #set_property (SOURCE ${HEADERS} + # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} + #) +endmacro () + +#------------------------------------------------------------------------------- +macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) + # install (FILES ${HEADERS} + # DESTINATION include/R3D/${NAME} + # COMPONENT Headers + # ) + + string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH} ) + source_group (${source_group_path} FILES ${HEADERS} ${SOURCES}) + + #-- The following is needed if we ever start to use OS X Frameworks but only + #-- works on CMake 2.6 and greater + #set_property (SOURCE ${HEADERS} + # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} + #) +endmacro () + +#------------------------------------------------------------------------------- +macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) + if (WIN32 AND MSVC AND NOT DISABLE_PDB_FILES) + get_target_property (target_type ${libtarget} TYPE) + if (${libtype} MATCHES "SHARED") + set (targetfilename $) + else () + get_property (target_name TARGET ${libtarget} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (targetfilename $/${target_name}.pdb) + endif () + install ( + FILES ${targetfilename} + DESTINATION ${targetdestination} + CONFIGURATIONS Debug RelWithDebInfo + COMPONENT ${targetcomponent} + OPTIONAL + ) + endif () +endmacro () + +#------------------------------------------------------------------------------- +macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) + if (WIN32 AND MSVC) + install ( + FILES $ + DESTINATION ${targetdestination} + CONFIGURATIONS Debug RelWithDebInfo + COMPONENT ${targetcomponent} + OPTIONAL + ) + endif () +endmacro () + +#------------------------------------------------------------------------------- +macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) + if (${libtype} MATCHES "SHARED") + set (LIB_RELEASE_NAME "${libname}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") + else () + if (WIN32 AND NOT MINGW) + set (LIB_RELEASE_NAME "lib${libname}") + set (LIB_DEBUG_NAME "lib${libname}${CMAKE_DEBUG_POSTFIX}") + else () + set (LIB_RELEASE_NAME "${libname}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") + endif () + endif () + + set_target_properties (${libtarget} PROPERTIES + OUTPUT_NAME ${LIB_RELEASE_NAME} +# OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} + OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} + OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} + OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} + ) + + if (${libtype} MATCHES "STATIC") + if (WIN32) + set_target_properties (${libtarget} PROPERTIES + COMPILE_PDB_NAME_DEBUG ${LIB_DEBUG_NAME} + COMPILE_PDB_NAME_RELEASE ${LIB_RELEASE_NAME} + COMPILE_PDB_NAME_MINSIZEREL ${LIB_RELEASE_NAME} + COMPILE_PDB_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" + ) + endif () + endif () + + option (HDF5_MSVC_NAMING_CONVENTION "Use MSVC Naming conventions for Shared Libraries" OFF) + if (HDF5_MSVC_NAMING_CONVENTION AND MINGW AND ${libtype} MATCHES "SHARED") + set_target_properties (${libtarget} PROPERTIES + IMPORT_SUFFIX ".lib" + IMPORT_PREFIX "" + PREFIX "" + ) + endif () +endmacro () + +#------------------------------------------------------------------------------- +macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) + HDF_SET_LIB_OPTIONS (${libtarget} ${libname} ${libtype}) + + if (${importtype} MATCHES "IMPORT") + set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") + endif () + if (${HDF_CFG_NAME} MATCHES "Debug") + set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) + else () + set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) + endif () + + if (${libtype} MATCHES "SHARED") + if (WIN32) + if (MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + else () + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + endif () + else () + if (MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + elseif (CYGWIN) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + else () + set_target_properties (${libtarget} PROPERTIES + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${libversion}" + SOVERSION "${libversion}" + ) + endif () + endif () + else () + if (WIN32 AND NOT MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + else () + set_target_properties (${libtarget} PROPERTIES + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif () + endif () +endmacro () + +#------------------------------------------------------------------------------- +macro (TARGET_C_PROPERTIES wintarget libtype) + target_compile_options(${wintarget} PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + $<$:${WIN_COMPILE_FLAGS}> + ) + if(MSVC) + set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}") + endif() +endmacro () + +#----------------------------------------------------------------------------- +# Configure the README.md file for the binary package +#----------------------------------------------------------------------------- +macro (HDF_README_PROPERTIES target_fortran) + set (BINARY_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) + set (BINARY_PLATFORM "${CMAKE_SYSTEM_NAME}") + if (WIN32) + set (BINARY_EXAMPLE_ENDING "zip") + set (BINARY_INSTALL_ENDING "msi") + if (CMAKE_CL_64) + set (BINARY_SYSTEM_NAME "win64") + else () + set (BINARY_SYSTEM_NAME "win32") + endif () + if (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") + set (BINARY_PLATFORM "${BINARY_PLATFORM} 7") + elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2") + set (BINARY_PLATFORM "${BINARY_PLATFORM} 8") + elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.3") + set (BINARY_PLATFORM "${BINARY_PLATFORM} 10") + endif () + if (CMAKE_C_COMPILER_ID MATCHES "Intel") + set (BINARY_PLATFORM "${BINARY_PLATFORM} Intel") + if (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 17") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 18") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 19") + else () + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel ${CMAKE_C_COMPILER_VERSION}") + endif () + elseif (CMAKE_C_COMPILER_ID MATCHES "MSVC") + set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}") + if (${CMAKE_C_COMPILER_VERSION} MATCHES "^16.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2010") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^15.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2008") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2012") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2013") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") + if (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.0.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.1.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.2.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2019") + elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.3.*") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2022") + else () + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ???") + endif () + else () + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") + endif () + endif () + elseif (APPLE) + set (BINARY_EXAMPLE_ENDING "tar.gz") + set (BINARY_INSTALL_ENDING "sh") # if packaging changes - use dmg + set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") + else () + set (BINARY_EXAMPLE_ENDING "tar.gz") + set (BINARY_INSTALL_ENDING "sh") + set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") + set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") + endif () + + if (target_fortran) + set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") + endif () + + if (ONLY_SHARED_LIBS) + set (LIB_TYPE "Shared") + elseif (BUILD_SHARED_LIBS) + set (LIB_TYPE "Static and Shared") + else () + set (LIB_TYPE "Static") + endif () + + configure_file ( + ${HDF_RESOURCES_DIR}/README.md.cmake.in + ${CMAKE_BINARY_DIR}/README.md @ONLY + ) +endmacro () + +macro (HDFTEST_COPY_FILE src dest target) + add_custom_command( + OUTPUT "${dest}" + COMMAND "${CMAKE_COMMAND}" + ARGS -E copy_if_different "${src}" "${dest}" + DEPENDS "${src}" + ) + list (APPEND ${target}_list "${dest}") +endmacro () + +macro (HDF_DIR_PATHS package_prefix) + option (HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + if (HDF5_USE_GNU_DIRS) + include(GNUInstallDirs) + if (NOT ${package_prefix}_INSTALL_BIN_DIR) + set (${package_prefix}_INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR}) + endif () + if (NOT ${package_prefix}_INSTALL_LIB_DIR) + set (${package_prefix}_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR}) + endif () + if (NOT ${package_prefix}_INSTALL_JAR_DIR) + set (${package_prefix}_INSTALL_JAR_DIR ${CMAKE_INSTALL_LIBDIR}) + endif () + if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR) + set (${package_prefix}_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR}) + endif () + if (NOT ${package_prefix}_INSTALL_MODULE_DIR) + set (${package_prefix}_INSTALL_MODULE_DIR ${CMAKE_INSTALL_INCLUDEDIR}/mod) + endif () + if (NOT ${package_prefix}_INSTALL_DATA_DIR) + set (${package_prefix}_INSTALL_DATA_DIR ${CMAKE_INSTALL_DATADIR}) + endif () + if (NOT ${package_prefix}_INSTALL_CMAKE_DIR) + set (${package_prefix}_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake) + endif () + if (NOT ${package_prefix}_INSTALL_DOC_DIR) + set (${package_prefix}_INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}) + endif () + message(STATUS "GNU: ${${package_prefix}_INSTALL_DOC_DIR}") + endif () + + if (APPLE) + option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + endif () + + if (NOT ${package_prefix}_INSTALL_BIN_DIR) + set (${package_prefix}_INSTALL_BIN_DIR bin) + endif () + if (NOT ${package_prefix}_INSTALL_LIB_DIR) + if (APPLE) + if (${package_prefix}_BUILD_FRAMEWORKS) + set (${package_prefix}_INSTALL_JAR_DIR ../Java) + else () + set (${package_prefix}_INSTALL_JAR_DIR lib) + endif () + set (${package_prefix}_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) + else () + set (${package_prefix}_INSTALL_JAR_DIR lib) + endif () + set (${package_prefix}_INSTALL_LIB_DIR lib) + endif () + if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR) + set (${package_prefix}_INSTALL_INCLUDE_DIR include) + endif () + if (NOT ${package_prefix}_INSTALL_MODULE_DIR) + set (${package_prefix}_INSTALL_MODULE_DIR mod) + endif () + if (NOT ${package_prefix}_INSTALL_DATA_DIR) + if (NOT MSVC) + if (APPLE) + if (${package_prefix}_BUILD_FRAMEWORKS) + set (${package_prefix}_INSTALL_EXTRA_DIR ../SharedSupport) + else () + set (${package_prefix}_INSTALL_EXTRA_DIR share) + endif () + set (${package_prefix}_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) + endif () + set (${package_prefix}_INSTALL_DATA_DIR share) + else () + set (${package_prefix}_INSTALL_DATA_DIR ".") + endif () + endif () + if (NOT ${package_prefix}_INSTALL_CMAKE_DIR) + set (${package_prefix}_INSTALL_CMAKE_DIR cmake) + endif () + if (NOT ${package_prefix}_INSTALL_DOC_DIR) + set (${package_prefix}_INSTALL_DOC_DIR ${${package_prefix}_INSTALL_DATA_DIR}) + endif () + message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") + + # Always use full RPATH, i.e. don't skip the full RPATH for the build tree + set (CMAKE_SKIP_BUILD_RPATH FALSE) + # when building, don't use the install RPATH already + # (but later on when installing) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH + set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) + if (APPLE) + set (CMAKE_INSTALL_NAME_DIR "@rpath") + set (CMAKE_INSTALL_RPATH + "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}" + "@executable_path/" + "@loader_path/../${${package_prefix}_INSTALL_LIB_DIR}" + "@loader_path/" + ) + else () + set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}:\$ORIGIN/") + endif () + + if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") + set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) + endif () + + #set the default debug suffix for all library targets + if(NOT CMAKE_DEBUG_POSTFIX) + if (WIN32) + set (CMAKE_DEBUG_POSTFIX "_D") + else () + set (CMAKE_DEBUG_POSTFIX "_debug") + endif () + endif () + + SET_HDF_BUILD_TYPE() + +#----------------------------------------------------------------------------- +# Setup output Directories +#----------------------------------------------------------------------------- + if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables." + ) + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries" + ) + set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries." + ) + set (CMAKE_Fortran_MODULE_DIRECTORY + ${PROJECT_BINARY_DIR}/mod CACHE PATH "Single Directory for all fortran modules." + ) + get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(_isMultiConfig) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) + set (CMAKE_PDB_OUTPUT_DIRECTORY + ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." + ) + else () + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + endif () + else () + # if we are externally configured, but the project uses old cmake scripts + # this may not be set and utilities like H5detect will fail + if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) + endif () + endif () + + if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + if (CMAKE_HOST_UNIX) + set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" + CACHE PATH "Install path prefix, prepended onto install directories." FORCE) + else () + GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) + set (CMAKE_INSTALL_PREFIX + "${CMAKE_GENERIC_PROGRAM_FILES}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" + CACHE PATH "Install path prefix, prepended onto install directories." FORCE) + set (CMAKE_GENERIC_PROGRAM_FILES) + endif () + set (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0 CACHE PATH "" FORCE) + endif () + + include (FetchContent) +#----------------------------------------------------------------------------- +# Setup pre-3.14 FetchContent +#----------------------------------------------------------------------------- + if(${CMAKE_VERSION} VERSION_LESS 3.14) + macro(FetchContent_MakeAvailable NAME) + FetchContent_GetProperties(${NAME}) + if(NOT ${NAME}_POPULATED) + FetchContent_Populate(${NAME}) + add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) + endif() + endmacro() + endif() +endmacro () + +macro (ADD_H5_FLAGS h5_flag_var infile) + file (STRINGS ${infile} TEST_FLAG_STREAM) + #message (TRACE "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") + list (LENGTH TEST_FLAG_STREAM len_flag) + if (len_flag GREATER 0) + math (EXPR _FP_LEN "${len_flag} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET TEST_FLAG_STREAM ${line} str_flag) + string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") + #message (TRACE "str_flag=${str_flag}") + if (NOT HDF5_ENABLE_WARNINGS_AS_ERRORS) + string (REGEX REPLACE "-Werror=" "-W" str_flag "${str_flag}") + endif () + if (str_flag) + list (APPEND ${h5_flag_var} "${str_flag}") + endif () + endforeach () + endif () + #message (TRACE "h5_flag_var=${${h5_flag_var}}") +endmacro () + diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c new file mode 100644 index 0000000..2d7e1b4 --- /dev/null +++ b/config/cmake/HDFTests.c @@ -0,0 +1,383 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#define SIMPLE_TEST(x) int main(){ x; return 0; } + +#ifdef HAVE_C99_DESIGNATED_INITIALIZER + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus +extern "C" +# endif +int FC_DUMMY_MAIN() +{ return 1;} +#endif +#endif +int +main () +{ + + typedef struct + { + int x; + union + { + int i; + double d; + }u; + }di_struct_t; + di_struct_t x = + { 0, + { .d = 0.0}}; + ; + return 0; +} + +#endif + +#ifdef HAVE_C99_FUNC + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ + const char *fname = __func__; + ; + return 0; +} + +#endif + +#ifdef VSNPRINTF_WORKS +#include +#include +#include + +int test_vsnprintf(const char *fmt,...) +{ + va_list ap; + char *s = malloc(16); + int ret; + + va_start(ap, fmt); + ret=vsnprintf(s,16,"%s",ap); + va_end(ap); + + return(ret!=42 ? 1 : 0); +} + +int main(void) +{ + return(test_vsnprintf("%s","A string that is longer than 16 characters")); +} +#endif + +#ifdef STDC_HEADERS +#include +#include +#include +#include +int main() { return 0; } +#endif /* STDC_HEADERS */ + + +#ifdef HAVE_ATTRIBUTE + +#if 0 +static void test int __attribute((unused)) var) +{ + int __attribute__((unused)) x = var; +} + +int main(void) +{ + test(19); +} + +#else +int +main () +{ +int __attribute__((unused)) x + ; + return 0; +} +#endif + + +#endif /* HAVE_ATTRIBUTE */ + +#ifdef HAVE_FUNCTION + +#ifdef FC_DUMMY_MAIN +#ifndef FC_DUMMY_MAIN_EQ_F77 +# ifdef __cplusplus + extern "C" +# endif + int FC_DUMMY_MAIN() { return 1; } +#endif +#endif +int +main () +{ +(void)__FUNCTION__ + ; + return 0; +} + +#endif /* HAVE_FUNCTION */ + +#ifdef HAVE_TIMEZONE + +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +SIMPLE_TEST(timezone=0); + +#endif /* HAVE_TIMEZONE */ + +#ifdef PRINTF_LL_WIDTH + +#ifdef HAVE_LONG_LONG +# define LL_TYPE long long +#else /* HAVE_LONG_LONG */ +# define LL_TYPE __int64 +#endif /* HAVE_LONG_LONG */ + +#include +#include +#include + +#if defined(_MSC_VER) && defined(_DEBUG) +# include +int DebugReport(int reportType, char* message, int* returnValue) +{ + (void)reportType; + (void)message; + (void)returnValue; + return 1; /* no further handling required */ +} +#endif + +int main(void) +{ + char *llwidthArgs[] = { "I64", "l64", "ll", "l", "L", "q", NULL }; + char *s = malloc(128); + char **currentArg = NULL; + LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; + #if defined(_MSC_VER) && defined(_DEBUG) + _CrtSetReportHook(DebugReport); + #endif + for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) + { + char formatString[64]; + sprintf(formatString, "%%%sd", *currentArg); + sprintf(s, formatString, x); + if (strcmp(s, "1099511627776") == 0) + { + printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); + return 0; + } + } + return 1; +} + +#endif /* PRINTF_LL_WIDTH */ + +#ifdef SYSTEM_SCOPE_THREADS +#include +#include + +int main(void) +{ + pthread_attr_t attribute; + int ret; + + pthread_attr_init(&attribute); + ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); + if (ret==0) + return 0; + return 1; +} + +#endif /* SYSTEM_SCOPE_THREADS */ + +#ifdef HAVE_SOCKLEN_T + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +SIMPLE_TEST(socklen_t foo); + +#endif /* HAVE_SOCKLEN_T */ + +#ifdef DEV_T_IS_SCALAR + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +int main () +{ + dev_t d1, d2; + if(d1==d2) + return 0; + return 1; +} + +#endif /* DEV_T_IS_SCALAR */ + +#ifdef HAVE_OFF64_T +#include +int main() +{ + off64_t n = 0; + return (int)n; +} +#endif + +#ifdef TEST_DIRECT_VFD_WORKS +#include +#include +#include +int main(void) +{ + int fid; + if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0) + return 1; + close(fid); + remove("tst_file"); + return 0; +} +#endif + +#ifdef HAVE_DIRECT + SIMPLE_TEST(posix_memalign()); +#endif + +#ifdef HAVE_DEFAULT_SOURCE +/* check default source */ +#include + +int +main(void) +{ +#ifdef __GLIBC_PREREQ + return __GLIBC_PREREQ(2,19); +#else + return 0; +#endif /* defined(__GLIBC_PREREQ) */ +} +#endif + +#ifdef TEST_LFS_WORKS +/* Return 0 when LFS is available and 1 otherwise. */ +#define _LARGEFILE_SOURCE +#define _LARGEFILE64_SOURCE +#define _LARGE_FILES +#define _FILE_OFFSET_BITS 64 +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + /* check that off_t can hold 2^63 - 1 and perform basic operations... */ +#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + if (OFF_T_64 % 2147483647 != 1) + return 1; + + /* stat breaks on SCO OpenServer */ + struct stat buf; + stat( argv[0], &buf ); + if (!S_ISREG(buf.st_mode)) + return 2; + + FILE *file = fopen( argv[0], "r" ); + off_t offset = ftello( file ); + fseek( file, offset, SEEK_CUR ); + fclose( file ); + return 0; +} +#endif + +#ifdef GETTIMEOFDAY_GIVES_TZ +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +int main(void) +{ + struct timeval tv; + struct timezone tz; + tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ + tz.tz_dsttime = 7; + gettimeofday(&tv, &tz); + /* Check whether the function returned any value at all */ + if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) + return 1; + else return 0; +} +#endif + +#ifdef HAVE_IOEO + +#include +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); +int main () +{ + PGNSI pGNSI; + pGNSI = (PGNSI) GetProcAddress( + GetModuleHandle(TEXT("kernel32.dll")), + "InitOnceExecuteOnce"); + if(NULL == pGNSI) + return 1; + else + return 0; +} + +#endif /* HAVE_IOEO */ + +#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) +#ifndef __cplusplus +#if defined( HAVE_INLINE ) +# define INLINE_KW inline +#elif defined ( HAVE___INLINE__ ) +# define INLINE_KW __inline__ +#elif defined ( HAVE___INLINE ) +# define INLINE_KW __inline +#endif /* HAVE_INLINE */ +typedef int foo_t; +static INLINE_KW foo_t static_foo () { return 0; } +INLINE_KW foo_t foo () {return 0; } +int main(void) { return 0; } +#endif /* __cplusplus */ +#endif /* defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) */ + diff --git a/config/cmake/HDFUseCXX.cmake b/config/cmake/HDFUseCXX.cmake new file mode 100644 index 0000000..6788773 --- /dev/null +++ b/config/cmake/HDFUseCXX.cmake @@ -0,0 +1,47 @@ +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# +# This file provides functions for C++ support. +# +#------------------------------------------------------------------------------- +ENABLE_LANGUAGE (CXX) +set (HDF_PREFIX "H5") + +#------------------------------------------------------------------------------- +# Fix CXX flags if we are compiling statically on Windows using +# Windows_MT.cmake from config/cmake/UserMacros +#------------------------------------------------------------------------------- +if (BUILD_STATIC_CRT_LIBS) + TARGET_STATIC_CRT_FLAGS () +endif () + +#----------------------------------------------------------------------------- +# Configure Checks which require CXX compilation must go in here +# not in the main ConfigureChecks.cmake files, because if the user has +# no CXX compiler, problems arise. +#----------------------------------------------------------------------------- +include (CheckIncludeFileCXX) +include (TestForSTDNamespace) + +# IF the c compiler found stdint, check the C++ as well. On some systems this +# file will be found by C but not C++, only do this test IF the C++ compiler +# has been initialized (e.g. the project also includes some c++) +if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) + CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX) + if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) + set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") + set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") + endif () +endif () + +#Always define +set (${HDF_PREFIX}_CXX_HAVE_OFFSETOF 1) diff --git a/config/cmake/HDFUseFortran.cmake b/config/cmake/HDFUseFortran.cmake new file mode 100644 index 0000000..c96298f --- /dev/null +++ b/config/cmake/HDFUseFortran.cmake @@ -0,0 +1,223 @@ +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# +# This file provides functions for Fortran support. +# +#------------------------------------------------------------------------------- +enable_language (Fortran) +set (HDF_PREFIX "H5") + +if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") + include (CheckFortranSourceRuns) + include (CheckFortranSourceCompiles) +endif () + +#------------------------------------------------------------------------------- +# Fix Fortran flags if we are compiling statically on Windows using +# Windows_MT.cmake from config/cmake/UserMacros +#------------------------------------------------------------------------------- +if (BUILD_STATIC_CRT_LIBS) + TARGET_STATIC_CRT_FLAGS () +endif () + +#----------------------------------------------------------------------------- +# Detect name mangling convention used between Fortran and C +#----------------------------------------------------------------------------- +include (FortranCInterface) +FortranCInterface_HEADER ( + ${CMAKE_BINARY_DIR}/FCMangle.h + MACRO_NAMESPACE "H5_FC_" + SYMBOL_NAMESPACE "H5_FC_" +) + +file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)") +string (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) +set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}") + +file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)") +string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) +set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}") + +#test code source +set (SIZEOF_CODE + " + PROGRAM main + i = sizeof(x) + END PROGRAM + " +) +set (C_SIZEOF_CODE + " + PROGRAM main + USE ISO_C_BINDING + INTEGER(C_INT) :: a + INTEGER(C_SIZE_T) :: result + result = c_sizeof(a) + END PROGRAM + " +) +set (STORAGE_SIZE_CODE + " + PROGRAM main + INTEGER :: a + INTEGER :: result + result = storage_size(a) + END PROGRAM + " +) +set (ISO_FORTRAN_ENV_CODE + " + PROGRAM main + USE, INTRINSIC :: ISO_FORTRAN_ENV + END PROGRAM + " +) +set (REALISNOTDOUBLE_CODE + " + MODULE type_mod + INTERFACE h5t + MODULE PROCEDURE h5t_real + MODULE PROCEDURE h5t_dble + END INTERFACE + CONTAINS + SUBROUTINE h5t_real(r) + REAL :: r + END SUBROUTINE h5t_real + SUBROUTINE h5t_dble(d) + DOUBLE PRECISION :: d + END SUBROUTINE h5t_dble + END MODULE type_mod + PROGRAM main + USE type_mod + REAL :: r + DOUBLE PRECISION :: d + CALL h5t(r) + CALL h5t(d) + END PROGRAM main + " +) +set (ISO_C_BINDING_CODE + " + PROGRAM main + USE iso_c_binding + IMPLICIT NONE + TYPE(C_PTR) :: ptr + TYPE(C_FUNPTR) :: funptr + INTEGER(C_INT64_T) :: c_int64_type + CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr + ptr = C_LOC(ichr(1:1)) + END PROGRAM + " +) + +if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") + if (HDF5_REQUIRED_LIBRARIES) + set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}") + endif () + check_fortran_source_compiles (${SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF SRC_EXT f90) + check_fortran_source_compiles (${C_SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF SRC_EXT f90) + check_fortran_source_compiles (${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE SRC_EXT f90) + check_fortran_source_compiles (${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV SRC_EXT f90) + check_fortran_source_compiles (${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE SRC_EXT f90) + check_fortran_source_compiles (${ISO_C_BINDING_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING SRC_EXT f90) +else () + #----------------------------------------------------------------------------- + # The provided CMake Fortran macros don't provide a general check function + # so this one is used for a sizeof test. + #----------------------------------------------------------------------------- + macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Testing Fortran ${FUNCTION}") + endif () + if (HDF5_REQUIRED_LIBRARIES) + set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") + else () + set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) + endif () + file (WRITE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90 + "${CODE}" + ) + TRY_COMPILE (RESULT_VAR + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90 + CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT + ) + + # if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + # message (TRACE "Test result ${OUTPUT}") + # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + # endif () + + if (${RESULT_VAR}) + set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (VERBOSE "Testing Fortran ${FUNCTION} - OK") + endif () + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" + "${OUTPUT}\n\n" + ) + else () + message (STATUS "Testing Fortran ${FUNCTION} - Fail") + set (${VARIABLE} 0 CACHE INTERNAL "Have Fortran function ${FUNCTION}") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" + "${OUTPUT}\n\n") + endif () + endmacro () + + #----------------------------------------------------------------------------- + # Configure Checks which require Fortran compilation must go in here + # not in the main ConfigureChecks.cmake files, because if the user has + # no Fortran compiler, problems arise. + # + # Be careful with leading spaces here, do not remove them. + #----------------------------------------------------------------------------- + + # Check for Non-standard extension intrinsic function SIZEOF + set (${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF FALSE) + CHECK_FORTRAN_FEATURE(sizeof_code ${SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF) + + # Check for F2008 standard intrinsic function C_SIZEOF + set (${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF FALSE) + CHECK_FORTRAN_FEATURE(c_sizeof_code ${C_SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF) + + # Check for F2008 standard intrinsic function STORAGE_SIZE + CHECK_FORTRAN_FEATURE(storage_size_code ${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE) + + # Check for F2008 standard intrinsic module "ISO_FORTRAN_ENV" + set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV FALSE) + CHECK_FORTRAN_FEATURE(iso_fortran_env_code ${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV) + + set (${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) + CHECK_FORTRAN_FEATURE(realisnotdouble_code ${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE) + + #----------------------------------------------------------------------------- + # Checks if the ISO_C_BINDING module meets all the requirements + #----------------------------------------------------------------------------- + set (${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING FALSE) + CHECK_FORTRAN_FEATURE(iso_c_binding_code ${ISO_C_BINDING_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING) +endif () + +#----------------------------------------------------------------------------- +# Add debug information (intel Fortran : JB) +#----------------------------------------------------------------------------- +if (CMAKE_Fortran_COMPILER MATCHES ifort) + if (WIN32 AND NOT MINGW) + set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE STRING "flags" FORCE) + set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "flags" FORCE) + endif () +endif () diff --git a/config/cmake/NSIS.InstallOptions.ini.in b/config/cmake/NSIS.InstallOptions.ini.in new file mode 100644 index 0000000..9954f28 --- /dev/null +++ b/config/cmake/NSIS.InstallOptions.ini.in @@ -0,0 +1,37 @@ +[Settings] +NumFields=5 + +[Field 1] +Type=label +Text=By default the @CPACK_PACKAGE_NAME@ bin directory is added to the system PATH. This allows shared library (dll) discovery (if installed) and running HDF5 tools from the command line. +Left=0 +Right=-1 +Top=0 +Bottom=20 + +[Field 2] +Type=radiobutton +Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH +Left=0 +Right=-1 +Top=30 +Bottom=40 +State=0 + +[Field 3] +Type=radiobutton +Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users +Left=0 +Right=-1 +Top=40 +Bottom=50 +State=1 + +[Field 4] +Type=radiobutton +Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user +Left=0 +Right=-1 +Top=50 +Bottom=60 +State=0 diff --git a/config/cmake/NSIS.template.in b/config/cmake/NSIS.template.in new file mode 100644 index 0000000..db79466 --- /dev/null +++ b/config/cmake/NSIS.template.in @@ -0,0 +1,974 @@ +; CPack install script designed for a nmake build + +;-------------------------------- +; You must define these values + + !define VERSION "@CPACK_PACKAGE_VERSION@" + !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@" + !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" + +;-------------------------------- +;Variables + + Var MUI_TEMP + Var STARTMENU_FOLDER + Var SV_ALLUSERS + Var START_MENU + Var DO_NOT_ADD_TO_PATH + Var ADD_TO_PATH_ALL_USERS + Var ADD_TO_PATH_CURRENT_USER + Var INSTALL_DESKTOP + Var IS_DEFAULT_INSTALLDIR +;-------------------------------- +;Include Modern UI + + !include "MUI.nsh" + + ;Default installation folder + InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + +;-------------------------------- +;General + + ;Name and file + Name "@CPACK_NSIS_PACKAGE_NAME@" + OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" + + ;Set compression + SetCompressor @CPACK_NSIS_COMPRESSOR@ + +@CPACK_NSIS_DEFINES@ + + !include Sections.nsh + +;--- Component support macros: --- +; The code for the add/remove functionality is from: +; http://nsis.sourceforge.net/Add/Remove_Functionality +; It has been modified slightly and extended to provide +; inter-component dependencies. +Var AR_SecFlags +Var AR_RegFlags +@CPACK_NSIS_SECTION_SELECTED_VARS@ + +; Loads the "selected" flag for the section named SecName into the +; variable VarName. +!macro LoadSectionSelectedIntoVar SecName VarName + SectionGetFlags ${${SecName}} $${VarName} + IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits +!macroend + +; Loads the value of a variable... can we get around this? +!macro LoadVar VarName + IntOp $R0 0 + $${VarName} +!macroend + +; Sets the value of a variable +!macro StoreVar VarName IntValue + IntOp $${VarName} 0 + ${IntValue} +!macroend + +!macro InitSection SecName + ; This macro reads component installed flag from the registry and + ;changes checked state of the section on the components page. + ;Input: section index constant name specified in Section command. + + ClearErrors + ;Reading component status from registry + ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed" + IfErrors "default_${SecName}" + ;Status will stay default if registry value not found + ;(component was never installed) + IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags + IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off + IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit + + ; Note whether this component was installed before + !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags + IntOp $R0 $AR_RegFlags & $AR_RegFlags + + ;Writing modified flags + SectionSetFlags ${${SecName}} $AR_SecFlags + + "default_${SecName}:" + !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected +!macroend + +!macro FinishSection SecName + ; This macro reads section flag set by user and removes the section + ;if it is not selected. + ;Then it writes component installed flag to registry + ;Input: section index constant name specified in Section command. + + SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags + ;Checking lowest bit: + IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} + IntCmp $AR_SecFlags 1 "leave_${SecName}" + ;Section is not selected: + ;Calling Section uninstall macro and writing zero installed flag + !insertmacro "Remove_${${SecName}}" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ + "Installed" 0 + Goto "exit_${SecName}" + + "leave_${SecName}:" + ;Section is selected: + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ + "Installed" 1 + + "exit_${SecName}:" +!macroend + +!macro RemoveSection_CPack SecName + ; This macro is used to call section's Remove_... macro + ;from the uninstaller. + ;Input: section index constant name specified in Section command. + + !insertmacro "Remove_${${SecName}}" +!macroend + +; Determine whether the selection of SecName changed +!macro MaybeSelectionChanged SecName + !insertmacro LoadVar ${SecName}_selected + SectionGetFlags ${${SecName}} $R1 + IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits + + ; See if the status has changed: + IntCmp $R0 $R1 "${SecName}_unchanged" + !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected + + IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" + !insertmacro "Deselect_required_by_${SecName}" + goto "${SecName}_unchanged" + + "${SecName}_was_selected:" + !insertmacro "Select_${SecName}_depends" + + "${SecName}_unchanged:" +!macroend +;--- End of Add/Remove macros --- + +;-------------------------------- +;Interface Settings + + !define MUI_HEADERIMAGE + !define MUI_ABORTWARNING + +;-------------------------------- +; path functions + +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 + +;---------------------------------------- +; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" +;---------------------------------------- +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 +;==================================================== +; get_NT_environment +; Returns: the selected environment +; Output : head of the stack +;==================================================== +!macro select_NT_profile UN +Function ${UN}select_NT_profile + StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single + DetailPrint "Selected environment for all users" + Push "all" + Return + environment_single: + DetailPrint "Selected environment for current user only." + Push "current" + Return +FunctionEnd +!macroend +!insertmacro select_NT_profile "" +!insertmacro select_NT_profile "un." +;---------------------------------------------------- +!define NT_current_env 'HKCU "Environment"' +!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + +!ifndef WriteEnvStr_RegKey + !ifdef ALL_USERS + !define WriteEnvStr_RegKey \ + 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + !else + !define WriteEnvStr_RegKey 'HKCU "Environment"' + !endif +!endif + +; AddToPath - Adds the given dir to the search path. +; Input - head of the stack +; Note - Win9x systems requires reboot + +Function AddToPath + Exch $0 + Push $1 + Push $2 + Push $3 + + # don't add if the path doesn't exist + IfFileExists "$0\*.*" "" AddToPath_done + + ReadEnvStr $1 PATH + ; if the path is too long for a NSIS variable NSIS will return a 0 + ; length string. If we find that, then warn and skip any path + ; modification as it will trash the existing path. + StrLen $2 $1 + IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done + CheckPathLength_ShowPathWarning: + Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" + Goto AddToPath_done + CheckPathLength_Done: + Push "$1;" + Push "$0;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$0\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + GetFullPathName /SHORT $3 $0 + Push "$1;" + Push "$3;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + Push "$1;" + Push "$3\;" + Call StrStr + Pop $2 + StrCmp $2 "" "" AddToPath_done + + Call IsNT + Pop $1 + StrCmp $1 1 AddToPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" a + FileSeek $1 -1 END + FileReadByte $1 $2 + IntCmp $2 26 0 +2 +2 # DOS EOF + FileSeek $1 -1 END # write over EOF + FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" + FileClose $1 + SetRebootFlag true + Goto AddToPath_done + + AddToPath_NT: + StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey + ReadRegStr $1 ${NT_current_env} "PATH" + Goto DoTrim + ReadAllKey: + ReadRegStr $1 ${NT_all_env} "PATH" + DoTrim: + StrCmp $1 "" AddToPath_NTdoIt + Push $1 + Call Trim + Pop $1 + StrCpy $0 "$1;$0" + AddToPath_NTdoIt: + StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey + WriteRegExpandStr ${NT_current_env} "PATH" $0 + Goto DoSend + WriteAllKey: + WriteRegExpandStr ${NT_all_env} "PATH" $0 + DoSend: + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + AddToPath_done: + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + + +; RemoveFromPath - Remove a given dir from the path +; Input: head of the stack + +Function un.RemoveFromPath + Exch $0 + Push $1 + Push $2 + Push $3 + Push $4 + Push $5 + Push $6 + + IntFmt $6 "%c" 26 # DOS EOF + + Call un.IsNT + Pop $1 + StrCmp $1 1 unRemoveFromPath_NT + ; Not on NT + StrCpy $1 $WINDIR 2 + FileOpen $1 "$1\autoexec.bat" r + GetTempFileName $4 + FileOpen $2 $4 w + GetFullPathName /SHORT $0 $0 + StrCpy $0 "SET PATH=%PATH%;$0" + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoop: + FileRead $1 $3 + StrCpy $5 $3 1 -1 # read last char + StrCmp $5 $6 0 +2 # if DOS EOF + StrCpy $3 $3 -1 # remove DOS EOF so we can compare + StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine + StrCmp $3 "" unRemoveFromPath_dosLoopEnd + FileWrite $2 $3 + Goto unRemoveFromPath_dosLoop + unRemoveFromPath_dosLoopRemoveLine: + SetRebootFlag true + Goto unRemoveFromPath_dosLoop + + unRemoveFromPath_dosLoopEnd: + FileClose $2 + FileClose $1 + StrCpy $1 $WINDIR 2 + Delete "$1\autoexec.bat" + CopyFiles /SILENT $4 "$1\autoexec.bat" + Delete $4 + Goto unRemoveFromPath_done + + unRemoveFromPath_NT: + StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey + ReadRegStr $1 ${NT_current_env} "PATH" + Goto unDoTrim + unReadAllKey: + ReadRegStr $1 ${NT_all_env} "PATH" + unDoTrim: + StrCpy $5 $1 1 -1 # copy last char + StrCmp $5 ";" +2 # if last char != ; + StrCpy $1 "$1;" # append ; + Push $1 + Push "$0;" + Call un.StrStr ; Find `$0;` in $1 + Pop $2 ; pos of our dir + StrCmp $2 "" unRemoveFromPath_done + ; else, it is in path + # $0 - path to add + # $1 - path var + StrLen $3 "$0;" + StrLen $4 $2 + StrCpy $5 $1 -$4 # $5 is now the part before the path to remove + StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove + StrCpy $3 $5$6 + + StrCpy $5 $3 1 -1 # copy last char + StrCmp $5 ";" 0 +2 # if last char == ; + StrCpy $3 $3 -1 # remove last char + + StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey + WriteRegExpandStr ${NT_current_env} "PATH" $3 + Goto unDoSend + unWriteAllKey: + WriteRegExpandStr ${NT_all_env} "PATH" $3 + unDoSend: + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + unRemoveFromPath_done: + Pop $6 + Pop $5 + Pop $4 + Pop $3 + Pop $2 + Pop $1 + Pop $0 +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Uninstall sutff +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +########################################### +# Utility Functions # +########################################### + +;==================================================== +; IsNT - Returns 1 if the current system is NT, 0 +; otherwise. +; Output: head of the stack +;==================================================== +; IsNT +; no input +; output, top of the stack = 1 if NT or 0 if not +; +; Usage: +; Call IsNT +; Pop $R0 +; ($R0 at this point is 1 or 0) + +!macro IsNT un +Function ${un}IsNT + Push $0 + ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + StrCmp $0 "" 0 IsNT_yes + ; we are not NT. + Pop $0 + Push 0 + Return + + IsNT_yes: + ; NT!!! + Pop $0 + Push 1 +FunctionEnd +!macroend +!insertmacro IsNT "" +!insertmacro IsNT "un." + +; StrStr +; input, top of stack = string to search for +; top of stack-1 = string to search in +; output, top of stack (replaces with the portion of the string remaining) +; modifies no other variables. +; +; Usage: +; Push "this is a long ass string" +; Push "ass" +; Call StrStr +; Pop $R0 +; ($R0 at this point is "ass string") + +!macro StrStr un +Function ${un}StrStr +Exch $R1 ; st=haystack,old$R1, $R1=needle + Exch ; st=old$R1,haystack + Exch $R2 ; st=old$R1,old$R2, $R2=haystack + Push $R3 + Push $R4 + Push $R5 + StrLen $R3 $R1 + StrCpy $R4 0 + ; $R1=needle + ; $R2=haystack + ; $R3=len(needle) + ; $R4=cnt + ; $R5=tmp + loop: + StrCpy $R5 $R2 $R3 $R4 + StrCmp $R5 $R1 done + StrCmp $R5 "" done + IntOp $R4 $R4 + 1 + Goto loop +done: + StrCpy $R1 $R2 "" $R4 + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Exch $R1 +FunctionEnd +!macroend +!insertmacro StrStr "" +!insertmacro StrStr "un." + +Function Trim ; Added by Pelaca + Exch $R1 + Push $R2 +Loop: + StrCpy $R2 "$R1" 1 -1 + StrCmp "$R2" " " RTrim + StrCmp "$R2" "$\n" RTrim + StrCmp "$R2" "$\r" RTrim + StrCmp "$R2" ";" RTrim + GoTo Done +RTrim: + StrCpy $R1 "$R1" -1 + Goto Loop +Done: + Pop $R2 + Exch $R1 +FunctionEnd + +Function ConditionalAddToRegisty + Pop $0 + Pop $1 + StrCmp "$0" "" ConditionalAddToRegisty_EmptyString + WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ + "$1" "$0" + ;MessageBox MB_OK "Set Registry: '$1' to '$0'" + DetailPrint "Set install registry entry: '$1' to '$0'" + ConditionalAddToRegisty_EmptyString: +FunctionEnd + +;-------------------------------- + +!ifdef CPACK_USES_DOWNLOAD +Function DownloadFile + IfFileExists $INSTDIR\* +2 + CreateDirectory $INSTDIR + Pop $0 + + ; Skip if already downloaded + IfFileExists $INSTDIR\$0 0 +2 + Return + + StrCpy $1 "@CPACK_DOWNLOAD_SITE@" + + try_again: + NSISdl::download "$1/$0" "$INSTDIR\$0" + + Pop $1 + StrCmp $1 "success" success + StrCmp $1 "Cancelled" cancel + MessageBox MB_OK "Download failed: $1" + cancel: + Return + success: +FunctionEnd +!endif + +;-------------------------------- +; Installation types +@CPACK_NSIS_INSTALLATION_TYPES@ + +;-------------------------------- +; Component sections +@CPACK_NSIS_COMPONENT_SECTIONS@ + +;-------------------------------- +; Define some macro setting for the gui +@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ +@CPACK_NSIS_INSTALLER_ICON_CODE@ +@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ +@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ + +;-------------------------------- +;Pages + !insertmacro MUI_PAGE_WELCOME + + !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" + Page custom InstallOptionsPage + !insertmacro MUI_PAGE_DIRECTORY + + ;Start Menu Folder Page Configuration + !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" + !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER + + @CPACK_NSIS_PAGE_COMPONENTS@ + + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" ;first language is the default language + !insertmacro MUI_LANGUAGE "Albanian" + !insertmacro MUI_LANGUAGE "Arabic" + !insertmacro MUI_LANGUAGE "Basque" + !insertmacro MUI_LANGUAGE "Belarusian" + !insertmacro MUI_LANGUAGE "Bosnian" + !insertmacro MUI_LANGUAGE "Breton" + !insertmacro MUI_LANGUAGE "Bulgarian" + !insertmacro MUI_LANGUAGE "Croatian" + !insertmacro MUI_LANGUAGE "Czech" + !insertmacro MUI_LANGUAGE "Danish" + !insertmacro MUI_LANGUAGE "Dutch" + !insertmacro MUI_LANGUAGE "Estonian" + !insertmacro MUI_LANGUAGE "Farsi" + !insertmacro MUI_LANGUAGE "Finnish" + !insertmacro MUI_LANGUAGE "French" + !insertmacro MUI_LANGUAGE "German" + !insertmacro MUI_LANGUAGE "Greek" + !insertmacro MUI_LANGUAGE "Hebrew" + !insertmacro MUI_LANGUAGE "Hungarian" + !insertmacro MUI_LANGUAGE "Icelandic" + !insertmacro MUI_LANGUAGE "Indonesian" + !insertmacro MUI_LANGUAGE "Irish" + !insertmacro MUI_LANGUAGE "Italian" + !insertmacro MUI_LANGUAGE "Japanese" + !insertmacro MUI_LANGUAGE "Korean" + !insertmacro MUI_LANGUAGE "Kurdish" + !insertmacro MUI_LANGUAGE "Latvian" + !insertmacro MUI_LANGUAGE "Lithuanian" + !insertmacro MUI_LANGUAGE "Luxembourgish" + !insertmacro MUI_LANGUAGE "Macedonian" + !insertmacro MUI_LANGUAGE "Malay" + !insertmacro MUI_LANGUAGE "Mongolian" + !insertmacro MUI_LANGUAGE "Norwegian" + !insertmacro MUI_LANGUAGE "Polish" + !insertmacro MUI_LANGUAGE "Portuguese" + !insertmacro MUI_LANGUAGE "PortugueseBR" + !insertmacro MUI_LANGUAGE "Romanian" + !insertmacro MUI_LANGUAGE "Russian" + !insertmacro MUI_LANGUAGE "Serbian" + !insertmacro MUI_LANGUAGE "SerbianLatin" + !insertmacro MUI_LANGUAGE "SimpChinese" + !insertmacro MUI_LANGUAGE "Slovak" + !insertmacro MUI_LANGUAGE "Slovenian" + !insertmacro MUI_LANGUAGE "Spanish" + !insertmacro MUI_LANGUAGE "Swedish" + !insertmacro MUI_LANGUAGE "Thai" + !insertmacro MUI_LANGUAGE "TradChinese" + !insertmacro MUI_LANGUAGE "Turkish" + !insertmacro MUI_LANGUAGE "Ukrainian" + !insertmacro MUI_LANGUAGE "Welsh" + + +;-------------------------------- +;Reserve Files + + ;These files should be inserted before other files in the data block + ;Keep these lines before any File command + ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) + + ReserveFile "NSIS.InstallOptions.ini" + !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS + +;-------------------------------- +;Installer Sections + +Section "-Core installation" + ;Use the entire tree produced by the INSTALL target. Keep the + ;list of directories here in sync with the RMDir commands below. + SetOutPath "$INSTDIR" + @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@ + @CPACK_NSIS_FULL_INSTALL@ + + ;Store installation folder + WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR + + ;Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" + Push "DisplayName" + Push "@CPACK_NSIS_DISPLAY_NAME@" + Call ConditionalAddToRegisty + Push "DisplayVersion" + Push "@CPACK_PACKAGE_VERSION@" + Call ConditionalAddToRegisty + Push "Publisher" + Push "@CPACK_PACKAGE_VENDOR@" + Call ConditionalAddToRegisty + Push "UninstallString" + Push "$INSTDIR\Uninstall.exe" + Call ConditionalAddToRegisty + Push "NoRepair" + Push "1" + Call ConditionalAddToRegisty + + !ifdef CPACK_NSIS_ADD_REMOVE + ;Create add/remove functionality + Push "ModifyPath" + Push "$INSTDIR\AddRemove.exe" + Call ConditionalAddToRegisty + !else + Push "NoModify" + Push "1" + Call ConditionalAddToRegisty + !endif + + ; Optional registration + Push "DisplayIcon" + Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" + Call ConditionalAddToRegisty + Push "HelpLink" + Push "@CPACK_NSIS_HELP_LINK@" + Call ConditionalAddToRegisty + Push "URLInfoAbout" + Push "@CPACK_NSIS_URL_INFO_ABOUT@" + Call ConditionalAddToRegisty + Push "Contact" + Push "@CPACK_NSIS_CONTACT@" + Call ConditionalAddToRegisty + !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + + ;Create shortcuts + CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" +@CPACK_NSIS_CREATE_ICONS@ +@CPACK_NSIS_CREATE_ICONS_EXTRA@ + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + + ;Read a value from an InstallOptions INI file + !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" + + ; Write special uninstall registry entries + Push "StartMenu" + Push "$STARTMENU_FOLDER" + Call ConditionalAddToRegisty + Push "DoNotAddToPath" + Push "$DO_NOT_ADD_TO_PATH" + Call ConditionalAddToRegisty + Push "AddToPathAllUsers" + Push "$ADD_TO_PATH_ALL_USERS" + Call ConditionalAddToRegisty + Push "AddToPathCurrentUser" + Push "$ADD_TO_PATH_CURRENT_USER" + Call ConditionalAddToRegisty + Push "InstallToDesktop" + Push "$INSTALL_DESKTOP" + Call ConditionalAddToRegisty + + !insertmacro MUI_STARTMENU_WRITE_END + +@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ + +SectionEnd + +Section "-Add to path" + Push $INSTDIR\bin + StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath + StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 + Call AddToPath + doNotAddToPath: +SectionEnd + +;-------------------------------- +; Create custom pages +Function InstallOptionsPage + !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" + +FunctionEnd + +;-------------------------------- +; determine admin versus local install +Function un.onInit + + ClearErrors + UserInfo::GetName + IfErrors noLM + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Admin group' + Goto done + StrCmp $1 "Power" 0 +3 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Power Users group' + Goto done + + noLM: + ;Get installation folder from registry if available + + done: + +FunctionEnd + +;--- Add/Remove callback functions: --- +!macro SectionList MacroName + ;This macro used to perform operation on multiple sections. + ;List all of your components in following manner here. +@CPACK_NSIS_COMPONENT_SECTION_LIST@ +!macroend + +Section -FinishComponents + ;Removes unselected components and writes component status to registry + !insertmacro SectionList "FinishSection" + +!ifdef CPACK_NSIS_ADD_REMOVE + ; Get the name of the installer executable + System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' + StrCpy $R3 $R0 + + ; Strip off the last 13 characters, to see if we have AddRemove.exe + StrLen $R1 $R0 + IntOp $R1 $R0 - 13 + StrCpy $R2 $R0 13 $R1 + StrCmp $R2 "AddRemove.exe" addremove_installed + + ; We're not running AddRemove.exe, so install it + CopyFiles $R3 $INSTDIR\AddRemove.exe + + addremove_installed: +!endif +SectionEnd +;--- End of Add/Remove callback functions --- + +;-------------------------------- +; Component dependencies +Function .onSelChange + !insertmacro SectionList MaybeSelectionChanged +FunctionEnd + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + ReadRegStr $START_MENU SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu" + ;MessageBox MB_OK "Start menu is in: $START_MENU" + ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath" + ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers" + ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser" + ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" + ReadRegStr $INSTALL_DESKTOP SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop" + ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " + +@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ + + ;Remove files we installed. + ;Keep the list of directories here in sync with the File commands above. +@CPACK_NSIS_DELETE_FILES@ +@CPACK_NSIS_DELETE_DIRECTORIES@ + +!ifdef CPACK_NSIS_ADD_REMOVE + ;Remove the add/remove program + Delete "$INSTDIR\AddRemove.exe" +!endif + + ;Remove the uninstaller itself. + Delete "$INSTDIR\Uninstall.exe" + DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + + ;Remove the installation directory if it is empty. + RMDir "$INSTDIR" + + ; Remove the registry entries. + DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + + ; Removes all optional components + !insertmacro SectionList "RemoveSection_CPack" + + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" +@CPACK_NSIS_DELETE_ICONS@ +@CPACK_NSIS_DELETE_ICONS_EXTRA@ + + ;Delete empty start menu parent directories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + + startMenuDeleteLoop: + ClearErrors + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + + IfErrors startMenuDeleteLoopDone + + StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop + startMenuDeleteLoopDone: + + ; If the user changed the shortcut, then untinstall may not work. This should + ; try to fix it. + StrCpy $MUI_TEMP "$START_MENU" + Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" +@CPACK_NSIS_DELETE_ICONS_EXTRA@ + + ;Delete empty start menu parent directories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + + secondStartMenuDeleteLoop: + ClearErrors + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + + IfErrors secondStartMenuDeleteLoopDone + + StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop + secondStartMenuDeleteLoopDone: + + DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" + + Push $INSTDIR\bin + StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 + Call un.RemoveFromPath + doNotRemoveFromPath: +SectionEnd + +;-------------------------------- +; determine admin versus local install +; Is install for "AllUsers" or "JustMe"? +; Default to "JustMe" - set to "AllUsers" if admin or on Win9x +; This function is used for the very first "custom page" of the installer. +; This custom page does not show up visibly, but it executes prior to the +; first visible page and sets up $INSTDIR properly... +; Choose different default installation folder based on SV_ALLUSERS... +; "Program Files" for AllUsers, "My Documents" for JustMe... + +Function .onInit + StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst + + ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString" + StrCmp $0 "" inst + + MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ + "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \ + IDYES uninst IDNO inst + Abort + +;Run the uninstaller +uninst: + ClearErrors + StrLen $2 "\Uninstall.exe" + StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path + ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file + + IfErrors uninst_failed inst +uninst_failed: + MessageBox MB_OK|MB_ICONSTOP "Uninstall failed." + Abort + + +inst: + ; Reads components status for registry + !insertmacro SectionList "InitSection" + + ; check to see if /D has been used to change + ; the install directory by comparing it to the + ; install directory that is expected to be the + ; default + StrCpy $IS_DEFAULT_INSTALLDIR 0 + StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 + StrCpy $IS_DEFAULT_INSTALLDIR 1 + + StrCpy $SV_ALLUSERS "JustMe" + ; if default install dir then change the default + ; if it is installed for JustMe + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + + ClearErrors + UserInfo::GetName + IfErrors noLM + Pop $0 + UserInfo::GetAccountType + Pop $1 + StrCmp $1 "Admin" 0 +4 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Admin group' + StrCpy $SV_ALLUSERS "AllUsers" + Goto done + StrCmp $1 "Power" 0 +4 + SetShellVarContext all + ;MessageBox MB_OK 'User "$0" is in the Power Users group' + StrCpy $SV_ALLUSERS "AllUsers" + Goto done + + noLM: + StrCpy $SV_ALLUSERS "AllUsers" + ;Get installation folder from registry if available + + done: + StrCmp $SV_ALLUSERS "AllUsers" 0 +3 + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + + StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage + !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" + + noOptionsPage: +FunctionEnd diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake new file mode 100644 index 0000000..631fca6 --- /dev/null +++ b/config/cmake/grepTest.cmake @@ -0,0 +1,195 @@ +# +# 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://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# grepTest.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. + +# arguments checking +if (NOT TEST_PROGRAM) + message (FATAL_ERROR "Require TEST_PROGRAM to be defined") +endif () +if (NOT TEST_FOLDER) + message (FATAL_ERROR "Require TEST_FOLDER to be defined") +endif () +if (NOT TEST_OUTPUT) + message (FATAL_ERROR "Require TEST_OUTPUT to be defined") +endif () +if (NOT TEST_FILTER) + message (STATUS "Optional TEST_FILTER to be defined") +endif () +if (NOT TEST_REFERENCE) + message (FATAL_ERROR "Require TEST_REFERENCE to be defined") +endif () + +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + +message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") + +if (TEST_LIBRARY_DIRECTORY) + if (WIN32) + set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") + else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") + endif () +endif () + +if (TEST_ENV_VAR) + set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") + message (TRACE "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") + endif () +endif () + +# run the test program, capture the stdout/stderr and the result var +execute_process ( + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT + ERROR_VARIABLE TEST_ERROR +) + +message (STATUS "COMMAND Result: ${TEST_RESULT}") + +message (STATUS "COMMAND Error: ${TEST_ERROR}") + +# remove special output +file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) +string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}") +if (TEST_FIND_RESULT GREATER 0) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +endif () + +# if the TEST_ERRREF exists grep the error output with the error reference +set (TEST_ERRREF_RESULT 0) +if (TEST_ERRREF) + # if the .err file exists grep the error output with the error reference before comparing stdout + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM) + list (LENGTH TEST_ERR_STREAM test_len) + if (test_len GREATER 0) + # TEST_ERRREF should always be matched + string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM}) + string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_ERRREF_RESULT) + if (NOT TEST_ERRREF_RESULT) + message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}") + endif () + endif () + endif () + + #always compare output file to reference unless this must be skipped + set (TEST_COMPARE_RESULT 0) + if (NOT TEST_SKIP_COMPARE) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + list (LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_COMPARE_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_COMPARE_RESULT 1) + endif () + endif () + + if (TEST_COMPARE_RESULT) + set (TEST_COMPARE_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_COMPARE_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + endif () + endif () + if (NOT len_act EQUAL len_ref) + set (TEST_COMPARE_RESULT 1) + endif () + endif () + endif () + + message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") + + # again, if return value is !=0 scream and shout + if (TEST_COMPARE_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif () + endif () + endif () +else () + # else grep the output with the reference + set (TEST_GREP_RESULT 0) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) + if (NOT TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif () +endif () + + +if (TEST_FILTER) + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match + string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) + if (TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif () + endif () +endif () + +# everything went fine... +message (STATUS "Passed: The output of ${TEST_PROGRAM} matched") + diff --git a/config/cmake/hdf.bmp b/config/cmake/hdf.bmp new file mode 100644 index 0000000..9e9e4aa Binary files /dev/null and b/config/cmake/hdf.bmp differ diff --git a/config/cmake/hdf.icns b/config/cmake/hdf.icns new file mode 100644 index 0000000..66f025d Binary files /dev/null and b/config/cmake/hdf.icns differ diff --git a/config/cmake/hdf.ico b/config/cmake/hdf.ico new file mode 100644 index 0000000..26abc96 Binary files /dev/null and b/config/cmake/hdf.ico differ diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake new file mode 100644 index 0000000..b373fe4 --- /dev/null +++ b/config/cmake/runTest.cmake @@ -0,0 +1,381 @@ +# +# 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://www.hdfgroup.org/licenses. +# 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 +# against a reference file. Exit status of command can also be compared. +cmake_policy(SET CMP0007 NEW) + +# arguments checking +if (NOT TEST_PROGRAM) + message (FATAL_ERROR "Require TEST_PROGRAM to be defined") +endif () +if (NOT TEST_FOLDER) + message (FATAL_ERROR "Require TEST_FOLDER to be defined") +endif () +if (NOT TEST_OUTPUT) + message (FATAL_ERROR "Require TEST_OUTPUT to be defined") +endif () +if (NOT TEST_EXPECT) + message (STATUS "Require TEST_EXPECT to be defined") +endif () + +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + +message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") + +if (TEST_LIBRARY_DIRECTORY) + if (WIN32) + set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") + else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") + endif () +endif () + +if (TEST_ENV_VAR) + set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") + #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") +endif () + +if (NOT TEST_INPUT) + # run the test program, capture the stdout/stderr and the result var + execute_process ( + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT + ERROR_VARIABLE TEST_ERROR + ) +else () + # run the test program with stdin, capture the stdout/stderr and the result var + execute_process ( + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + INPUT_FILE ${TEST_INPUT} + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT + ERROR_VARIABLE TEST_ERROR + ) +endif () + +if (TEST_REGEX) + # TEST_REGEX should always be matched + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) + if (NOT REGEX_RESULT) + message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") + endif () +endif () + +message (STATUS "COMMAND Result: ${TEST_RESULT}") + +# if the .err file exists and ERRROR_APPEND is enabled +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + list (LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (TEST_MASK_FILE) + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + endif () + # remove special output + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + + if (NOT ERROR_APPEND) + # write back to original .err file + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + else () + # append error output to the stdout output file + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif () + endif () +endif () + +# append the test result status with a predefined text +if (TEST_APPEND) + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") +endif () + +# if the return value is !=${TEST_EXPECT} bail out +if (NOT TEST_RESULT EQUAL TEST_EXPECT) + if (NOT TEST_NOERRDISPLAY) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + message (STATUS "Output :\n${TEST_STREAM}") + endif () + endif () + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") +endif () + +message (STATUS "COMMAND Error: ${TEST_ERROR}") + +# remove special output +file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) +string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) +if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +endif () + +# remove special error output +if (NOT TEST_ERRREF) + # the error stack has been appended to the output file + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) +else () + # the error stack remains in the .err file + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) +endif () +string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + # write back the changes to the original files + if (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else () + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif () +endif () + +# if the output file needs Storage text removed +if (TEST_MASK) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (REGEX REPLACE "Storage:[^\n]+\n" "Storage:
\n" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") +endif () + +# if the output file needs Modified text removed +if (TEST_MASK_MOD) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") +endif () + +# if the output file or the .err file needs to mask out error stack info +if (TEST_MASK_ERROR) + if (NOT TEST_ERRREF) + # the error stack has been appended to the output file + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + else () + # the error stack remains in the .err file + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + endif () + string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + # write back the changes to the original files + if (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else () + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif () +endif () + +# remove text from the output file +if (TEST_FILTER) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (REGEX REPLACE "${TEST_FILTER}" "${TEST_FILTER_REPLACE}" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") +endif () + +if (TEST_REF_FILTER) + #message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + string (REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") +endif () + +# compare output files to references unless this must be skipped +set (TEST_COMPARE_RESULT 0) +if (NOT TEST_SKIP_COMPARE) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + list (LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () + + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_COMPARE_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set (TEST_COMPARE_RESULT 1) + endif () + endif () + + if (TEST_COMPARE_RESULT) + set (TEST_COMPARE_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT len_act EQUAL len_ref) + set (TEST_COMPARE_RESULT 1) + endif () + if (len_act GREATER 0 AND len_ref GREATER 0) + if (TEST_SORT_COMPARE) + list (SORT test_act) + list (SORT test_ref) + endif () + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_COMPARE_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + endif () + endif () + endif () + endif () + + message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") + + # again, if return value is !=0 scream and shout + if (TEST_COMPARE_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif () + endif () + + # now compare the .err file with the error reference, if supplied + set (TEST_ERRREF_RESULT 0) + if (TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + list (LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + if (WIN32) + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + if (EXISTS "${TEST_FOLDER}/${TEST_ERRREF}.tmp") + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + endif () + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + endif () + + # now compare the error output with the error reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} + RESULT_VARIABLE TEST_ERRREF_RESULT + ) + if (TEST_ERRREF_RESULT) + set (TEST_ERRREF_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) + math (EXPR _FP_LEN "${len_ref} - 1") + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_ERRREF_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") + endif () + endif () + if (NOT len_act EQUAL len_ref) + set (TEST_ERRREF_RESULT 1) + endif () + endif () + endif () + + message (STATUS "COMPARE Result: ${TEST_ERRREF_RESULT}") + + # again, if return value is !=0 scream and shout + if (TEST_ERRREF_RESULT) + message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") + endif () + endif () +endif () + +set (TEST_GREP_RESULT 0) +if (TEST_GREP_COMPARE) + # now grep the output with the reference + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + list (LENGTH TEST_STREAM test_len) + if (test_len GREATER 0) + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) + if (NOT TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif () + + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match + string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) + if (TEST_GREP_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif () + endif () + endif () +endif () + +# dump the output unless nodisplay option is set +if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + execute_process ( + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_STREAM} + RESULT_VARIABLE TEST_RESULT + ) +endif () + +# everything went fine... +message (STATUS "${TEST_PROGRAM} Passed") + diff --git a/config/cmake/version.plist.in b/config/cmake/version.plist.in new file mode 100644 index 0000000..817d89e --- /dev/null +++ b/config/cmake/version.plist.in @@ -0,0 +1,17 @@ + + + + + + BuildVersion + @CPACK_PACKAGE_VERSION_MAJOR@ + CFBundleShortVersionString + @CPACK_APPLE_GUI_SHORT_VERSION_STRING@ + CFBundleVersion + @CPACK_APPLE_GUI_SHORT_VERSION_STRING@ + ProjectName + @CPACK_APPLE_GUI_BUNDLE_NAME@ + SourceVersion + @CPACK_PACKAGE_VERSION_MINOR@ + + diff --git a/config/cmake_ext_mod/CTestCustom.cmake b/config/cmake_ext_mod/CTestCustom.cmake deleted file mode 100644 index 2d72e8d..0000000 --- a/config/cmake_ext_mod/CTestCustom.cmake +++ /dev/null @@ -1,17 +0,0 @@ -set (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 3000) - -set (CTEST_CUSTOM_WARNING_EXCEPTION - ${CTEST_CUSTOM_WARNING_EXCEPTION} - ".*note.*expected.*void.*but argument is of type.*volatile.*" - ".*src.SZIP.*:[ \t]*warning.*" - ".*src.ZLIB.*:[ \t]*warning.*" - ".*src.JPEG.*:[ \t]*warning.*" - ".*POSIX name for this item is deprecated.*" - ".*disabling jobserver mode.*" - ".*warning.*implicit declaration of function.*" - ".*note: expanded from macro.*" -) - -set (CTEST_CUSTOM_MEMCHECK_IGNORE - ${CTEST_CUSTOM_MEMCHECK_IGNORE} -) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake deleted file mode 100644 index 41f53e1..0000000 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ /dev/null @@ -1,693 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -#----------------------------------------------------------------------------- -# Include all the necessary files for macros -#----------------------------------------------------------------------------- -include (CheckFunctionExists) -include (CheckIncludeFile) -include (CheckIncludeFiles) -include (CheckLibraryExists) -include (CheckSymbolExists) -include (CheckTypeSize) -include (CheckVariableExists) -include (TestBigEndian) -include (CheckStructHasMember) - -# Check for Darwin (not just Apple - we also want to catch OpenDarwin) -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set (${HDF_PREFIX}_HAVE_DARWIN 1) -endif () - -# Check for Solaris -if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (${HDF_PREFIX}_HAVE_SOLARIS 1) -endif () - -#----------------------------------------------------------------------------- -# This MACRO checks IF the symbol exists in the library and IF it -# does, it appends library to the list. -#----------------------------------------------------------------------------- -set (LINK_LIBS "") -macro (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) - CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE}) - if (${VARIABLE}) - set (LINK_LIBS ${LINK_LIBS} ${LIBRARY}) - endif () -endmacro () - -# ---------------------------------------------------------------------- -# WINDOWS Hard code Values -# ---------------------------------------------------------------------- -set (WINDOWS) - -if (MINGW) - set (${HDF_PREFIX}_HAVE_MINGW 1) - set (WINDOWS 1) # MinGW tries to imitate Windows - set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) - set (__USE_MINGW_ANSI_STDIO 1) -endif () - -if (WIN32 AND NOT MINGW) - if (NOT UNIX) - set (WINDOWS 1) - set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") - if (MSVC) - set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) - endif () - endif () -endif () - -if (WINDOWS) - set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") - set (${HDF_PREFIX}_HAVE_WIN32_API 1) - set (${HDF_PREFIX}_HAVE_LIBM 1) - set (${HDF_PREFIX}_HAVE_STRDUP 1) - set (${HDF_PREFIX}_HAVE_SYSTEM 1) - set (${HDF_PREFIX}_HAVE_LONGJMP 1) - if (NOT MINGW) - set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) - set (${HDF_PREFIX}_HAVE_FUNCTION 1) - endif () - if (NOT UNIX AND NOT CYGWIN) - set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) - set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) - set (${HDF_PREFIX}_HAVE_TIMEZONE 1) - set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) - set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) - set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) - endif () -endif () - -# ---------------------------------------------------------------------- -# END of WINDOWS Hard code Values -# ---------------------------------------------------------------------- - -if (NOT WINDOWS) - TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN) -endif () - -#----------------------------------------------------------------------------- -# Check IF header file exists and add it to the list. -#----------------------------------------------------------------------------- -macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) - CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE}) - if (${VARIABLE}) - set (USE_INCLUDES ${USE_INCLUDES} ${FILE}) - endif () -endmacro () - -#----------------------------------------------------------------------------- -# Check for the existence of certain header files -#----------------------------------------------------------------------------- -CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) -CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) -CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) -CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) -CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) -CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) -CHECK_INCLUDE_FILE_CONCAT ("pwd.h" ${HDF_PREFIX}_HAVE_PWD_H) - -# Windows -CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H) -if (NOT CYGWIN) - CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) -endif () - -if (CMAKE_SYSTEM_NAME MATCHES "OSF") - CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H) - CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H) -else () - set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE) - set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE) -endif () - -CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) -CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) -CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) -CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H) -CHECK_INCLUDE_FILE_CONCAT ("string.h" ${HDF_PREFIX}_HAVE_STRING_H) -CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H) -CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H) -CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H) -CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H) -CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H) -CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H) -CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H) -# _Bool type support -CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H) - -## Check for non-standard extension quadmath.h - -CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) -if (${C_HAVE_QUADMATH}) - set(${HDF_PREFIX}_HAVE_QUADMATH_H 1) -else () - set(${HDF_PREFIX}_HAVE_QUADMATH_H 0) -endif () - -if (CYGWIN) - set (${HDF_PREFIX}_HAVE_LSEEK64 0) -endif () - -#----------------------------------------------------------------------------- -# Check for the math library "m" -#----------------------------------------------------------------------------- -if (MINGW OR NOT WINDOWS) - CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil ${HDF_PREFIX}_HAVE_LIBM) - CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen ${HDF_PREFIX}_HAVE_LIBDL) - CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup ${HDF_PREFIX}_HAVE_LIBWS2_32) - CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32) -endif () - -# UCB (BSD) compatibility library -CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB) - -# For other tests to use the same libraries -set (HDF5_REQUIRED_LIBRARIES ${HDF5_REQUIRED_LIBRARIES} ${LINK_LIBS}) - -set (USE_INCLUDES "") -if (WINDOWS) - set (USE_INCLUDES ${USE_INCLUDES} "windows.h") -endif () - -# For other specific tests, use this MACRO. -macro (HDF_FUNCTION_TEST OTHER_TEST) - if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - - foreach (def - HAVE_SYS_TIME_H - HAVE_UNISTD_H - HAVE_SYS_TYPES_H - HAVE_SYS_SOCKET_H - ) - if ("${${HDF_PREFIX}_${def}}") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif () - endforeach () - - if (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif () - - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (TRACE "Performing ${OTHER_TEST}") - endif () - try_compile (${OTHER_TEST} - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" - LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (${OTHER_TEST}) - set (${HDF_PREFIX}_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing Other Test ${OTHER_TEST} - Success") - endif () - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing Other Test ${OTHER_TEST} - Failed") - endif () - set (${HDF_PREFIX}_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing Other Test ${OTHER_TEST} failed with the following output:\n" - "${OUTPUT}\n" - ) - endif () - endif () -endmacro () - -#----------------------------------------------------------------------------- -# Check for these functions before the time headers are checked -#----------------------------------------------------------------------------- -HDF_FUNCTION_TEST (STDC_HEADERS) - -#----------------------------------------------------------------------------- -# Check for large file support -#----------------------------------------------------------------------------- - -# The linux-lfs option is deprecated. -set (LINUX_LFS 0) - -set (HDF_EXTRA_C_FLAGS) -set (HDF_EXTRA_FLAGS) -if (MINGW OR NOT WINDOWS) - if (CMAKE_SYSTEM_NAME MATCHES "Linux") - # Linux Specific flags - # This was originally defined as _POSIX_SOURCE which was updated to - # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX - # functionality so clock_gettime and CLOCK_MONOTONIC are defined - # correctly. This was later updated to 200112L so that - # posix_memalign() is visible for the direct VFD code on Linux - # systems. - # POSIX feature information can be found in the gcc manual at: - # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L) - - # Need to add this so that O_DIRECT is visible for the direct - # VFD on Linux systems. - set (HDF_EXTRA_C_FLAGS ${HDF_EXTRA_C_FLAGS} -D_GNU_SOURCE) - - option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) - if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN) - set (msg "Performing TEST_LFS_WORKS") - try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS "-DTEST_LFS_WORKS" - ) - - # The LARGEFILE definitions were from the transition period - # and are probably no longer needed. The FILE_OFFSET_BITS - # check should be generalized for all POSIX systems as it - # is in the Autotools. - if (TEST_LFS_WORKS_COMPILE) - if (TEST_LFS_WORKS_RUN MATCHES 0) - set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg}) - set (LARGEFILE 1) - set (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "${msg}... yes") - endif () - else () - set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "${msg}... no") - endif () - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Run failed with the following exit code:\n ${TEST_LFS_WORKS_RUN}\n" - ) - endif () - else () - set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "${msg}... no") - endif () - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Compile failed\n" - ) - endif () - endif () - set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS}) - endif () -endif () - -#----------------------------------------------------------------------------- -# Check for HAVE_OFF64_T functionality -#----------------------------------------------------------------------------- -if (MINGW OR NOT WINDOWS) - HDF_FUNCTION_TEST (HAVE_OFF64_T) - if (${HDF_PREFIX}_HAVE_OFF64_T) - CHECK_FUNCTION_EXISTS (lseek64 ${HDF_PREFIX}_HAVE_LSEEK64) - endif () - - CHECK_FUNCTION_EXISTS (fseeko ${HDF_PREFIX}_HAVE_FSEEKO) - - CHECK_STRUCT_HAS_MEMBER("struct stat64" st_blocks "sys/types.h;sys/stat.h" HAVE_STAT64_STRUCT) - if (HAVE_STAT64_STRUCT) - CHECK_FUNCTION_EXISTS (stat64 ${HDF_PREFIX}_HAVE_STAT64) - endif () -endif () - -#----------------------------------------------------------------------------- -# Check the size in bytes of all the int and float types -#----------------------------------------------------------------------------- -macro (HDF_CHECK_TYPE_SIZE type var) - set (aType ${type}) - set (aVar ${var}) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (TRACE "Checking size of ${aType} and storing into ${aVar}") - endif () - CHECK_TYPE_SIZE (${aType} ${aVar}) - if (NOT ${aVar}) - set (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (TRACE "Size of ${aType} was NOT Found") - endif () - endif () -endmacro () - -HDF_CHECK_TYPE_SIZE (char ${HDF_PREFIX}_SIZEOF_CHAR) -HDF_CHECK_TYPE_SIZE (short ${HDF_PREFIX}_SIZEOF_SHORT) -HDF_CHECK_TYPE_SIZE (int ${HDF_PREFIX}_SIZEOF_INT) -HDF_CHECK_TYPE_SIZE (unsigned ${HDF_PREFIX}_SIZEOF_UNSIGNED) -if (NOT APPLE) - HDF_CHECK_TYPE_SIZE (long ${HDF_PREFIX}_SIZEOF_LONG) -endif () -HDF_CHECK_TYPE_SIZE ("long long" ${HDF_PREFIX}_SIZEOF_LONG_LONG) -HDF_CHECK_TYPE_SIZE (__int64 ${HDF_PREFIX}_SIZEOF___INT64) -if (NOT ${HDF_PREFIX}_SIZEOF___INT64) - set (${HDF_PREFIX}_SIZEOF___INT64 0) -endif () - -HDF_CHECK_TYPE_SIZE (float ${HDF_PREFIX}_SIZEOF_FLOAT) -HDF_CHECK_TYPE_SIZE (double ${HDF_PREFIX}_SIZEOF_DOUBLE) -HDF_CHECK_TYPE_SIZE ("long double" ${HDF_PREFIX}_SIZEOF_LONG_DOUBLE) - -HDF_CHECK_TYPE_SIZE (int8_t ${HDF_PREFIX}_SIZEOF_INT8_T) -HDF_CHECK_TYPE_SIZE (uint8_t ${HDF_PREFIX}_SIZEOF_UINT8_T) -HDF_CHECK_TYPE_SIZE (int_least8_t ${HDF_PREFIX}_SIZEOF_INT_LEAST8_T) -HDF_CHECK_TYPE_SIZE (uint_least8_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST8_T) -HDF_CHECK_TYPE_SIZE (int_fast8_t ${HDF_PREFIX}_SIZEOF_INT_FAST8_T) -HDF_CHECK_TYPE_SIZE (uint_fast8_t ${HDF_PREFIX}_SIZEOF_UINT_FAST8_T) - -HDF_CHECK_TYPE_SIZE (int16_t ${HDF_PREFIX}_SIZEOF_INT16_T) -HDF_CHECK_TYPE_SIZE (uint16_t ${HDF_PREFIX}_SIZEOF_UINT16_T) -HDF_CHECK_TYPE_SIZE (int_least16_t ${HDF_PREFIX}_SIZEOF_INT_LEAST16_T) -HDF_CHECK_TYPE_SIZE (uint_least16_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST16_T) -HDF_CHECK_TYPE_SIZE (int_fast16_t ${HDF_PREFIX}_SIZEOF_INT_FAST16_T) -HDF_CHECK_TYPE_SIZE (uint_fast16_t ${HDF_PREFIX}_SIZEOF_UINT_FAST16_T) - -HDF_CHECK_TYPE_SIZE (int32_t ${HDF_PREFIX}_SIZEOF_INT32_T) -HDF_CHECK_TYPE_SIZE (uint32_t ${HDF_PREFIX}_SIZEOF_UINT32_T) -HDF_CHECK_TYPE_SIZE (int_least32_t ${HDF_PREFIX}_SIZEOF_INT_LEAST32_T) -HDF_CHECK_TYPE_SIZE (uint_least32_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST32_T) -HDF_CHECK_TYPE_SIZE (int_fast32_t ${HDF_PREFIX}_SIZEOF_INT_FAST32_T) -HDF_CHECK_TYPE_SIZE (uint_fast32_t ${HDF_PREFIX}_SIZEOF_UINT_FAST32_T) - -HDF_CHECK_TYPE_SIZE (int64_t ${HDF_PREFIX}_SIZEOF_INT64_T) -HDF_CHECK_TYPE_SIZE (uint64_t ${HDF_PREFIX}_SIZEOF_UINT64_T) -HDF_CHECK_TYPE_SIZE (int_least64_t ${HDF_PREFIX}_SIZEOF_INT_LEAST64_T) -HDF_CHECK_TYPE_SIZE (uint_least64_t ${HDF_PREFIX}_SIZEOF_UINT_LEAST64_T) -HDF_CHECK_TYPE_SIZE (int_fast64_t ${HDF_PREFIX}_SIZEOF_INT_FAST64_T) -HDF_CHECK_TYPE_SIZE (uint_fast64_t ${HDF_PREFIX}_SIZEOF_UINT_FAST64_T) - -HDF_CHECK_TYPE_SIZE (size_t ${HDF_PREFIX}_SIZEOF_SIZE_T) -HDF_CHECK_TYPE_SIZE (ssize_t ${HDF_PREFIX}_SIZEOF_SSIZE_T) -if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) - set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) -endif () -if (MINGW OR NOT WINDOWS) - HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) -endif () - -HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T) -HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T) -if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T) - set (${HDF_PREFIX}_SIZEOF_OFF64_T 0) -endif () -HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) - -#----------------------------------------------------------------------------- -# Extra C99 types -#----------------------------------------------------------------------------- - -# _Bool type support -if (HAVE_STDBOOL_H) - set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h) - HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL) -else () - HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) -endif () - -if (MINGW OR NOT WINDOWS) - #----------------------------------------------------------------------------- - # Check if the dev_t type is a scalar type - #----------------------------------------------------------------------------- - HDF_FUNCTION_TEST (DEV_T_IS_SCALAR) - - # ---------------------------------------------------------------------- - # Check for MONOTONIC_TIMER support (used in clock_gettime). This has - # to be done after any POSIX/BSD defines to ensure that the test gets - # the correct POSIX level on linux. - CHECK_VARIABLE_EXISTS (CLOCK_MONOTONIC HAVE_CLOCK_MONOTONIC) - - #----------------------------------------------------------------------------- - # Check a bunch of time functions - #----------------------------------------------------------------------------- - CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE_TM_GMTOFF) - CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" ${HDF_PREFIX}_HAVE___TM_GMTOFF) - CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_TIME_WITH_SYS_TIME) - if (${HDF_PREFIX}_HAVE_SYS_TIME_H) - CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;sys/time.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) - else () - CHECK_STRUCT_HAS_MEMBER("struct tm" tz_minuteswest "sys/types.h;time.h" ${HDF_PREFIX}_HAVE_STRUCT_TIMEZONE) - endif () - CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY) - foreach (time_test -# HAVE_TIMEZONE - GETTIMEOFDAY_GIVES_TZ - HAVE_TM_ZONE - HAVE_STRUCT_TM_TM_ZONE - ) - HDF_FUNCTION_TEST (${time_test}) - endforeach () - if (NOT CYGWIN AND NOT MINGW) - HDF_FUNCTION_TEST (HAVE_TIMEZONE) - endif () - - # ---------------------------------------------------------------------- - # Does the struct stat have the st_blocks field? This field is not Posix. - # - CHECK_STRUCT_HAS_MEMBER("struct stat" st_blocks "sys/types.h;sys/stat.h" ${HDF_PREFIX}_HAVE_STAT_ST_BLOCKS) - - # ---------------------------------------------------------------------- - # How do we figure out the width of a tty in characters? - # - CHECK_FUNCTION_EXISTS (ioctl ${HDF_PREFIX}_HAVE_IOCTL) - CHECK_STRUCT_HAS_MEMBER ("struct videoconfig" numtextcols "" ${HDF_PREFIX}_HAVE_STRUCT_VIDEOCONFIG) - CHECK_STRUCT_HAS_MEMBER ("struct text_info" screenwidth "" ${HDF_PREFIX}_HAVE_STRUCT_TEXT_INFO) - CHECK_FUNCTION_EXISTS (_getvideoconfig ${HDF_PREFIX}_HAVE__GETVIDEOCONFIG) - CHECK_FUNCTION_EXISTS (gettextinfo ${HDF_PREFIX}_HAVE_GETTEXTINFO) - CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) - if (NOT CYGWIN) - CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo ${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO) - endif () - CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ) - CHECK_SYMBOL_EXISTS (TIOCGETD "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGETD) - - # ---------------------------------------------------------------------- - # cygwin user credentials are different then on linux - # - if (NOT CYGWIN AND NOT MINGW) - CHECK_FUNCTION_EXISTS (getpwuid ${HDF_PREFIX}_HAVE_GETPWUID) - endif () -endif () - -#----------------------------------------------------------------------------- -# Check for some functions that are used -# -CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM) -CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL) -CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK) -CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK) -CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF) -CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL) - -CHECK_FUNCTION_EXISTS (gethostname ${HDF_PREFIX}_HAVE_GETHOSTNAME) -CHECK_FUNCTION_EXISTS (getrusage ${HDF_PREFIX}_HAVE_GETRUSAGE) -CHECK_FUNCTION_EXISTS (llround ${HDF_PREFIX}_HAVE_LLROUND) -CHECK_FUNCTION_EXISTS (llroundf ${HDF_PREFIX}_HAVE_LLROUNDF) -CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND) -CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF) -CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT) - -CHECK_FUNCTION_EXISTS (pread ${HDF_PREFIX}_HAVE_PREAD) -CHECK_FUNCTION_EXISTS (pwrite ${HDF_PREFIX}_HAVE_PWRITE) -CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) -CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) -CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND) -CHECK_FUNCTION_EXISTS (roundf ${HDF_PREFIX}_HAVE_ROUNDF) -CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO) - -CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL) -CHECK_FUNCTION_EXISTS (longjmp ${HDF_PREFIX}_HAVE_LONGJMP) -CHECK_FUNCTION_EXISTS (setjmp ${HDF_PREFIX}_HAVE_SETJMP) -CHECK_FUNCTION_EXISTS (siglongjmp ${HDF_PREFIX}_HAVE_SIGLONGJMP) -CHECK_FUNCTION_EXISTS (sigsetjmp ${HDF_PREFIX}_HAVE_SIGSETJMP) -CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) - -CHECK_FUNCTION_EXISTS (snprintf ${HDF_PREFIX}_HAVE_SNPRINTF) -CHECK_FUNCTION_EXISTS (srandom ${HDF_PREFIX}_HAVE_SRANDOM) -CHECK_FUNCTION_EXISTS (strdup ${HDF_PREFIX}_HAVE_STRDUP) -CHECK_FUNCTION_EXISTS (strtoll ${HDF_PREFIX}_HAVE_STRTOLL) -CHECK_FUNCTION_EXISTS (strtoull ${HDF_PREFIX}_HAVE_STRTOULL) -CHECK_FUNCTION_EXISTS (symlink ${HDF_PREFIX}_HAVE_SYMLINK) -CHECK_FUNCTION_EXISTS (system ${HDF_PREFIX}_HAVE_SYSTEM) - -CHECK_FUNCTION_EXISTS (tmpfile ${HDF_PREFIX}_HAVE_TMPFILE) -CHECK_FUNCTION_EXISTS (asprintf ${HDF_PREFIX}_HAVE_ASPRINTF) -CHECK_FUNCTION_EXISTS (vasprintf ${HDF_PREFIX}_HAVE_VASPRINTF) -CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) - -CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) -if (MINGW OR NOT WINDOWS) - if (${HDF_PREFIX}_HAVE_VSNPRINTF) - HDF_FUNCTION_TEST (VSNPRINTF_WORKS) - endif () -endif () - -#----------------------------------------------------------------------------- -# sigsetjmp is special; may actually be a macro -#----------------------------------------------------------------------------- -if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) - if (${HDF_PREFIX}_HAVE_SETJMP_H) - CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Check a bunch of other functions -#----------------------------------------------------------------------------- -if (MINGW OR NOT WINDOWS) - foreach (other_test - HAVE_ATTRIBUTE - HAVE_C99_FUNC - HAVE_FUNCTION - HAVE_C99_DESIGNATED_INITIALIZER - SYSTEM_SCOPE_THREADS - HAVE_SOCKLEN_T - ) - HDF_FUNCTION_TEST (${other_test}) - endforeach () -endif () - -#----------------------------------------------------------------------------- -# Check if InitOnceExecuteOnce is available -#----------------------------------------------------------------------------- -if (WINDOWS) - if (NOT HDF_NO_IOEO_TEST) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for InitOnceExecuteOnce:") - endif () - if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO) - if (LARGEFILE) - set (CMAKE_REQUIRED_DEFINITIONS - "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif () - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") - if (CMAKE_REQUIRED_INCLUDES) - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else () - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif () - - TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" - LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" - CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}" - COMPILE_OUTPUT_VARIABLE OUTPUT - ) - # if it did not compile make the return value fail code of 1 - if (NOT HAVE_IOEO_COMPILED) - set (HAVE_IOEO_EXITCODE 1) - endif () - # if the return value was 0 then it worked - if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing Test InitOnceExecuteOnce - Success") - endif () - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test InitOnceExecuteOnce succeeded with the following output:\n" - "${OUTPUT}\n" - "Return value: ${HAVE_IOEO}\n") - else () - if (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") - set (${HDF_PREFIX}_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") - else () - set (${HDF_PREFIX}_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") - endif () - - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing Test InitOnceExecuteOnce - Failed") - endif () - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing InitOnceExecuteOnce Test failed with the following output:\n" - "${OUTPUT}\n" - "Return value: ${HAVE_IOEO_EXITCODE}\n") - endif () - endif () - endif () -endif () - -#----------------------------------------------------------------------------- -# Determine how 'inline' is used -#----------------------------------------------------------------------------- -foreach (inline_test inline __inline__ __inline) - string (TOUPPER ${inline_test} INLINE_TEST_MACRO) - HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO}) -endforeach () - -#----------------------------------------------------------------------------- -# Check how to print a Long Long integer -#----------------------------------------------------------------------------- -if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown") - set (PRINT_LL_FOUND 0) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long:") - endif () - set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH") - if (${HDF_PREFIX}_SIZEOF_LONG_LONG) - set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG") - endif () - TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - COMPILE_DEFINITIONS "${CURRENT_TEST_DEFINITIONS}" - RUN_OUTPUT_VARIABLE OUTPUT - ) - if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE) - if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0) - string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}") - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") - set (PRINT_LL_FOUND 1) - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") - endif () - endif () - else () - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" - ) - endif () - - if (PRINT_LL_FOUND) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}") - endif () - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Checking for appropriate format for 64 bit long: not found") - endif () - set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL - "Width for printf for type `long long' or `__int64', us. `ll" - ) - endif () -endif () - -# ---------------------------------------------------------------------- -# Set the flag to indicate that the machine can handle converting -# denormalized floating-point values. -# (This flag should be set for all machines, except for the Crays, where -# the cache value is set in it's config file) -# -set (${HDF_PREFIX}_CONVERT_DENORMAL_FLOAT 1) diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake deleted file mode 100644 index 846a3d1..0000000 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ /dev/null @@ -1,129 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -######################################################################### - -# - Derived from the FindTiff.cmake and FindJPEG.cmake that is included with cmake -# FindSZIP - -# Find the native SZIP includes and library - -# Imported targets -################## - -# This module defines the following :prop_tgt:`IMPORTED` targets: -# -# SZIP::SZIP -# The SZIP library, if found. -# -# Result variables -################### - -# 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. -# SZIP_INCLUDE_DIRS, the directory containing the SZIP headers. -# SZIP_LIBRARIES, libraries to link against to use SZIP. - -# Cache variables -################# - -# The following variables may also be set: - -# SZIP_LIBRARY, where to find the SZIP library. -# SZIP_LIBRARY_DEBUG - Debug version of SZIP library -# SZIP_LIBRARY_RELEASE - Release Version of SZIP library - -# message (STATUS "Finding SZIP library and headers..." ) -######################################################################### - - -find_path(SZIP_INCLUDE_DIR szlib.h) - -set(szip_names ${SZIP_NAMES} sz szip szip-static libsz libszip libszip-static) -foreach(name ${szip_names}) - list (APPEND szip_names_debug "${name}d") -endforeach() - -if(NOT SZIP_LIBRARY) - find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names}) - find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug}) - include(SelectLibraryConfigurations) - select_library_configurations(SZIP) - mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG) -endif() -unset(szip_names) -unset(szip_names_debug) - -if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h") - file(STRINGS "${SZIP_INCLUDE_DIR}/SZconfig.h" szip_version_str - REGEX "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+.*") - - string(REGEX REPLACE "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+([0-9]+).*" - "\\1" SZIP_VERSION "${szip_version_str}") - unset(szip_version_str) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SZIP - REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR - VERSION_VAR SZIP_VERSION) - -if(SZIP_FOUND) - set(SZIP_LIBRARIES ${SZIP_LIBRARY}) - set(SZIP_INCLUDE_DIRS "${SZIP_INCLUDE_DIR}") - - if(NOT TARGET SZIP::SZIP) - add_library(SZIP::SZIP UNKNOWN IMPORTED) - if(SZIP_INCLUDE_DIRS) - set_target_properties(SZIP::SZIP PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIRS}") - endif() - if(EXISTS "${SZIP_LIBRARY}") - set_target_properties(SZIP::SZIP PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${SZIP_LIBRARY}") - endif() - if(EXISTS "${SZIP_LIBRARY_RELEASE}") - set_property(TARGET SZIP::SZIP APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(SZIP::SZIP PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" - IMPORTED_LOCATION_RELEASE "${SZIP_LIBRARY_RELEASE}") - endif() - if(EXISTS "${SZIP_LIBRARY_DEBUG}") - set_property(TARGET SZIP::SZIP APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(SZIP::SZIP PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" - IMPORTED_LOCATION_DEBUG "${SZIP_LIBRARY_DEBUG}") - endif() - endif() -endif() - -mark_as_advanced(SZIP_LIBRARY SZIP_INCLUDE_DIR) - -# Report the results. -if (NOT SZIP_FOUND) - set (SZIP_DIR_MESSAGE - "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable." - ) - if (NOT SZIP_FIND_QUIETLY) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "${SZIP_DIR_MESSAGE}") - endif () - else () - if (SZIP_FIND_REQUIRED) - message (FATAL_ERROR "SZip was NOT found and is Required by this project") - endif () - endif () -endif () diff --git a/config/cmake_ext_mod/GetTimeOfDayTest.cpp b/config/cmake_ext_mod/GetTimeOfDayTest.cpp deleted file mode 100644 index b35efa5..0000000 --- a/config/cmake_ext_mod/GetTimeOfDayTest.cpp +++ /dev/null @@ -1,26 +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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#if defined (TRY_SYS_TIME_H) -#include -/* #include */ -#endif - - -#if defined (TRY_TIME_H) -#include -#endif - -int main(int argc, char **argv) { - struct timeval t1; - gettimeofday(&t1, 0x00); - return 0; -} diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp deleted file mode 100644 index 08ccb34..0000000 --- a/config/cmake_ext_mod/HDFCXXTests.cpp +++ /dev/null @@ -1,46 +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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifdef CXX_HAVE_OFFSETOF - -#include -#include - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - struct index_st - { - unsigned char type; - unsigned char num; - unsigned int len; - }; - typedef struct index_st index_t; - int x,y; - x = offsetof(struct index_st, len); - y = offsetof(index_t, num) - - ; - return 0; -} - -#endif diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake deleted file mode 100644 index d2f2660..0000000 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ /dev/null @@ -1,250 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -#------------------------------------------------------------------------------- -macro (ORIGINAL_ZLIB_LIBRARY compress_type) - if (${compress_type} MATCHES "GIT") - FetchContent_Declare (HDF5_ZLIB - GIT_REPOSITORY ${ZLIB_URL} - GIT_TAG ${ZLIB_BRANCH} - ) - elseif (${compress_type} MATCHES "TGZ") - FetchContent_Declare (HDF5_ZLIB - URL ${ZLIB_URL} - URL_HASH "" - ) - endif () - FetchContent_GetProperties(HDF5_ZLIB) - if(NOT zlib_POPULATED) - FetchContent_Populate(HDF5_ZLIB) - - # Copy an additional/replacement files into the populated source - file(COPY ${HDF_RESOURCES_DIR}/ZLIB/CMakeLists.txt DESTINATION ${hdf5_zlib_SOURCE_DIR}) - - add_subdirectory(${hdf5_zlib_SOURCE_DIR} ${hdf5_zlib_BINARY_DIR}) - endif() - - add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) - set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") - set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) - - set (ZLIB_INCLUDE_DIR_GEN "${hdf5_zlib_BINARY_DIR}") - set (ZLIB_INCLUDE_DIR "${hdf5_zlib_SOURCE_DIR}") - set (ZLIB_FOUND 1) - set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) -endmacro () - -#------------------------------------------------------------------------------- -macro (ORIGINAL_SZIP_LIBRARY compress_type encoding) - # Only libaec library is usable - if (${compress_type} MATCHES "GIT") - FetchContent_Declare (SZIP - GIT_REPOSITORY ${SZIP_URL} - GIT_TAG ${SZIP_BRANCH} - ) - elseif (${compress_type} MATCHES "TGZ") - FetchContent_Declare (SZIP - URL ${SZIP_URL} - URL_HASH "" - ) - endif () - FetchContent_GetProperties(SZIP) - if(NOT szip_POPULATED) - FetchContent_Populate(SZIP) - - # Copy an additional/replacement files into the populated source - file(COPY ${HDF_RESOURCES_DIR}/LIBAEC/CMakeLists.txt DESTINATION ${szip_SOURCE_DIR}) - - add_subdirectory(${szip_SOURCE_DIR} ${szip_BINARY_DIR}) - endif() - - set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) - add_library (${HDF_PACKAGE_NAMESPACE}szaec-static ALIAS szaec-static) - add_library (${HDF_PACKAGE_NAMESPACE}aec-static ALIAS aec-static) - set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") - set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) - - set (SZIP_INCLUDE_DIR_GEN "${szip_BINARY_DIR}") - set (SZIP_INCLUDE_DIR "${szip_SOURCE_DIR}/include") - set (SZIP_FOUND 1) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) -endmacro () - -#------------------------------------------------------------------------------- -macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) - if (${compress_type} MATCHES "GIT") - EXTERNALPROJECT_ADD (SZIP - GIT_REPOSITORY ${SZIP_URL} - GIT_TAG ${SZIP_BRANCH} - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} - ) - elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (SZIP - URL ${SZIP_URL} - URL_MD5 "" - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} - ) - endif () - externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) -# -##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) -# Create imported target szip-static - if (USE_LIBAEC) - add_library(${HDF_PACKAGE_NAMESPACE}szaec-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szaec-static "szaec" STATIC "") - add_dependencies (${HDF_PACKAGE_NAMESPACE}szaec-static SZIP) - add_library(${HDF_PACKAGE_NAMESPACE}aec-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}aec-static "aec" STATIC "") - add_dependencies (${HDF_PACKAGE_NAMESPACE}aec-static SZIP) - set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szaec-static;${HDF_PACKAGE_NAMESPACE}aec-static") - else () - add_library(${HDF_PACKAGE_NAMESPACE}szip-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-static "szip" STATIC "") - add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-static SZIP) - set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-static") - endif () - set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) - - set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}") - if (USE_LIBAEC) - set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/include") - else () - set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src") - endif () - set (SZIP_FOUND 1) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR}) -endmacro () - -#------------------------------------------------------------------------------- -macro (PACKAGE_SZIP_LIBRARY compress_type) - set (SZIP_HDR "SZconfig") - if (USE_LIBAEC) - set (SZIP_HDR "aec_config") - else () - set (SZIP_HDR "libaec_Export") - endif () - add_custom_target (SZIP-GenHeader-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/${SZIP_HDR}.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ - COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/${SZIP_HDR}.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_HDR}.h) - if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") - add_dependencies (SZIP-GenHeader-Copy SZIP) - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (EXTERNAL_ZLIB_LIBRARY compress_type) - if (${compress_type} MATCHES "GIT") - EXTERNALPROJECT_ADD (HDF5_ZLIB - GIT_REPOSITORY ${ZLIB_URL} - GIT_TAG ${ZLIB_BRANCH} - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} - ) - elseif (${compress_type} MATCHES "TGZ") - EXTERNALPROJECT_ADD (HDF5_ZLIB - URL ${ZLIB_URL} - URL_MD5 "" - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DHDF_USE_GNU_DIRS:STRING=${HDF5_USE_GNU_DIRS} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} - ) - endif () - externalproject_get_property (HDF5_ZLIB BINARY_DIR SOURCE_DIR) - - if (NOT ZLIB_LIB_NAME) - set (ZLIB_LIB_NAME "z") - endif () -##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) -# Create imported target zlib-static - add_library(${HDF_PACKAGE_NAMESPACE}zlib-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-static ${ZLIB_LIB_NAME} STATIC "") - add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-static HDF5_ZLIB) - set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") - set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) - - set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}") - set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}") - set (ZLIB_FOUND 1) - set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR}) -endmacro () - -#------------------------------------------------------------------------------- -macro (PACKAGE_ZLIB_LIBRARY compress_type) - add_custom_target (ZLIB-GenHeader-Copy ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ - COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" - ) - set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) - if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") - add_dependencies (ZLIB-GenHeader-Copy HDF5_ZLIB) - endif () -endmacro () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake deleted file mode 100644 index 7483f3c..0000000 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ /dev/null @@ -1,520 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# - -#------------------------------------------------------------------------------- -macro (SET_HDF_BUILD_TYPE) - get_property (_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if (_isMultiConfig) - set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) - set (HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR}) - set (HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) - else () - set (HDF_CFG_BUILD_TYPE ".") - if (CMAKE_BUILD_TYPE) - set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) - set (HDF_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - else () - set (HDF_CFG_NAME "Release") - set (HDF_BUILD_TYPE "Release") - endif () - endif () - if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Setting build type to 'RelWithDebInfo' as none was specified.") - endif() - 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" - "MinSizeRel" "RelWithDebInfo") - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (SET_GLOBAL_VARIABLE name value) - set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE) -endmacro () - -#------------------------------------------------------------------------------- -macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES) - #set (source_group_path "Source/AIM/${NAME}") - string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}) - source_group (${source_group_path} FILES ${HEADERS} ${SOURCES}) - - #-- The following is needed if we ever start to use OS X Frameworks but only - #-- works on CMake 2.6 and greater - #set_property (SOURCE ${HEADERS} - # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} - #) -endmacro () - -#------------------------------------------------------------------------------- -macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES) - # install (FILES ${HEADERS} - # DESTINATION include/R3D/${NAME} - # COMPONENT Headers - # ) - - string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH} ) - source_group (${source_group_path} FILES ${HEADERS} ${SOURCES}) - - #-- The following is needed if we ever start to use OS X Frameworks but only - #-- works on CMake 2.6 and greater - #set_property (SOURCE ${HEADERS} - # PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME} - #) -endmacro () - -#------------------------------------------------------------------------------- -macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) - if (WIN32 AND MSVC AND NOT DISABLE_PDB_FILES) - get_target_property (target_type ${libtarget} TYPE) - if (${libtype} MATCHES "SHARED") - set (targetfilename $) - else () - get_property (target_name TARGET ${libtarget} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (targetfilename $/${target_name}.pdb) - endif () - install ( - FILES ${targetfilename} - DESTINATION ${targetdestination} - CONFIGURATIONS Debug RelWithDebInfo - COMPONENT ${targetcomponent} - OPTIONAL - ) - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) - if (WIN32 AND MSVC) - install ( - FILES $ - DESTINATION ${targetdestination} - CONFIGURATIONS Debug RelWithDebInfo - COMPONENT ${targetcomponent} - OPTIONAL - ) - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) - if (${libtype} MATCHES "SHARED") - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") - else () - if (WIN32 AND NOT MINGW) - set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}${CMAKE_DEBUG_POSTFIX}") - else () - set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") - endif () - endif () - - set_target_properties (${libtarget} PROPERTIES - OUTPUT_NAME ${LIB_RELEASE_NAME} -# OUTPUT_NAME_DEBUG ${LIB_DEBUG_NAME} - OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} - OUTPUT_NAME_MINSIZEREL ${LIB_RELEASE_NAME} - OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} - ) - - if (${libtype} MATCHES "STATIC") - if (WIN32) - set_target_properties (${libtarget} PROPERTIES - COMPILE_PDB_NAME_DEBUG ${LIB_DEBUG_NAME} - COMPILE_PDB_NAME_RELEASE ${LIB_RELEASE_NAME} - COMPILE_PDB_NAME_MINSIZEREL ${LIB_RELEASE_NAME} - COMPILE_PDB_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} - COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" - ) - endif () - endif () - - option (HDF5_MSVC_NAMING_CONVENTION "Use MSVC Naming conventions for Shared Libraries" OFF) - if (HDF5_MSVC_NAMING_CONVENTION AND MINGW AND ${libtype} MATCHES "SHARED") - set_target_properties (${libtarget} PROPERTIES - IMPORT_SUFFIX ".lib" - IMPORT_PREFIX "" - PREFIX "" - ) - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) - HDF_SET_LIB_OPTIONS (${libtarget} ${libname} ${libtype}) - - if (${importtype} MATCHES "IMPORT") - set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}") - endif () - if (${HDF_CFG_NAME} MATCHES "Debug") - set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME}) - else () - set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME}) - endif () - - if (${libtype} MATCHES "SHARED") - if (WIN32) - if (MINGW) - set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else () - set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - endif () - else () - if (MINGW) - set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - elseif (CYGWIN) - set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - else () - set_target_properties (${libtarget} PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" - IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${libversion}" - SOVERSION "${libversion}" - ) - endif () - endif () - else () - if (WIN32 AND NOT MINGW) - set_target_properties (${libtarget} PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - else () - set_target_properties (${libtarget} PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif () - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (TARGET_C_PROPERTIES wintarget libtype) - target_compile_options(${wintarget} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> - $<$:${WIN_COMPILE_FLAGS}> - ) - if(MSVC) - set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}") - endif() -endmacro () - -#----------------------------------------------------------------------------- -# Configure the README.md file for the binary package -#----------------------------------------------------------------------------- -macro (HDF_README_PROPERTIES target_fortran) - set (BINARY_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) - set (BINARY_PLATFORM "${CMAKE_SYSTEM_NAME}") - if (WIN32) - set (BINARY_EXAMPLE_ENDING "zip") - set (BINARY_INSTALL_ENDING "msi") - if (CMAKE_CL_64) - set (BINARY_SYSTEM_NAME "win64") - else () - set (BINARY_SYSTEM_NAME "win32") - endif () - if (${CMAKE_SYSTEM_VERSION} MATCHES "6.1") - set (BINARY_PLATFORM "${BINARY_PLATFORM} 7") - elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2") - set (BINARY_PLATFORM "${BINARY_PLATFORM} 8") - elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.3") - set (BINARY_PLATFORM "${BINARY_PLATFORM} 10") - endif () - if (CMAKE_C_COMPILER_ID MATCHES "Intel") - set (BINARY_PLATFORM "${BINARY_PLATFORM} Intel") - if (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 17") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 18") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel 19") - else () - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using Intel ${CMAKE_C_COMPILER_VERSION}") - endif () - elseif (CMAKE_C_COMPILER_ID MATCHES "MSVC") - set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}") - if (${CMAKE_C_COMPILER_VERSION} MATCHES "^16.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2010") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^15.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2008") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^17.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2012") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^18.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2013") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.*") - if (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.0.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.1.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.2.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2019") - elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "^19.3.*") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2022") - else () - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ???") - endif () - else () - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}") - endif () - endif () - elseif (APPLE) - set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "sh") # if packaging changes - use dmg - set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") - else () - set (BINARY_EXAMPLE_ENDING "tar.gz") - set (BINARY_INSTALL_ENDING "sh") - set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}") - set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}") - endif () - - if (target_fortran) - set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") - endif () - - if (ONLY_SHARED_LIBS) - set (LIB_TYPE "Shared") - elseif (BUILD_SHARED_LIBS) - set (LIB_TYPE "Static and Shared") - else () - set (LIB_TYPE "Static") - endif () - - configure_file ( - ${HDF_RESOURCES_DIR}/README.md.cmake.in - ${CMAKE_BINARY_DIR}/README.md @ONLY - ) -endmacro () - -macro (HDFTEST_COPY_FILE src dest target) - add_custom_command( - OUTPUT "${dest}" - COMMAND "${CMAKE_COMMAND}" - ARGS -E copy_if_different "${src}" "${dest}" - DEPENDS "${src}" - ) - list (APPEND ${target}_list "${dest}") -endmacro () - -macro (HDF_DIR_PATHS package_prefix) - option (HDF5_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) - if (HDF5_USE_GNU_DIRS) - include(GNUInstallDirs) - if (NOT ${package_prefix}_INSTALL_BIN_DIR) - set (${package_prefix}_INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR}) - endif () - if (NOT ${package_prefix}_INSTALL_LIB_DIR) - set (${package_prefix}_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR}) - endif () - if (NOT ${package_prefix}_INSTALL_JAR_DIR) - set (${package_prefix}_INSTALL_JAR_DIR ${CMAKE_INSTALL_LIBDIR}) - endif () - if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR) - set (${package_prefix}_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR}) - endif () - if (NOT ${package_prefix}_INSTALL_MODULE_DIR) - set (${package_prefix}_INSTALL_MODULE_DIR ${CMAKE_INSTALL_INCLUDEDIR}/mod) - endif () - if (NOT ${package_prefix}_INSTALL_DATA_DIR) - set (${package_prefix}_INSTALL_DATA_DIR ${CMAKE_INSTALL_DATADIR}) - endif () - if (NOT ${package_prefix}_INSTALL_CMAKE_DIR) - set (${package_prefix}_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake) - endif () - if (NOT ${package_prefix}_INSTALL_DOC_DIR) - set (${package_prefix}_INSTALL_DOC_DIR ${CMAKE_INSTALL_DOCDIR}) - endif () - message(STATUS "GNU: ${${package_prefix}_INSTALL_DOC_DIR}") - endif () - - if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) - endif () - - if (NOT ${package_prefix}_INSTALL_BIN_DIR) - set (${package_prefix}_INSTALL_BIN_DIR bin) - endif () - if (NOT ${package_prefix}_INSTALL_LIB_DIR) - if (APPLE) - if (${package_prefix}_BUILD_FRAMEWORKS) - set (${package_prefix}_INSTALL_JAR_DIR ../Java) - else () - set (${package_prefix}_INSTALL_JAR_DIR lib) - endif () - set (${package_prefix}_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) - else () - set (${package_prefix}_INSTALL_JAR_DIR lib) - endif () - set (${package_prefix}_INSTALL_LIB_DIR lib) - endif () - if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR) - set (${package_prefix}_INSTALL_INCLUDE_DIR include) - endif () - if (NOT ${package_prefix}_INSTALL_MODULE_DIR) - set (${package_prefix}_INSTALL_MODULE_DIR mod) - endif () - if (NOT ${package_prefix}_INSTALL_DATA_DIR) - if (NOT MSVC) - if (APPLE) - if (${package_prefix}_BUILD_FRAMEWORKS) - set (${package_prefix}_INSTALL_EXTRA_DIR ../SharedSupport) - else () - set (${package_prefix}_INSTALL_EXTRA_DIR share) - endif () - set (${package_prefix}_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) - endif () - set (${package_prefix}_INSTALL_DATA_DIR share) - else () - set (${package_prefix}_INSTALL_DATA_DIR ".") - endif () - endif () - if (NOT ${package_prefix}_INSTALL_CMAKE_DIR) - set (${package_prefix}_INSTALL_CMAKE_DIR cmake) - endif () - if (NOT ${package_prefix}_INSTALL_DOC_DIR) - set (${package_prefix}_INSTALL_DOC_DIR ${${package_prefix}_INSTALL_DATA_DIR}) - endif () - message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") - - # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) - # when building, don't use the install RPATH already - # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) - # add the automatically determined parts of the RPATH - # which point to directories outside the build tree to the install RPATH - set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) - if (APPLE) - set (CMAKE_INSTALL_NAME_DIR "@rpath") - set (CMAKE_INSTALL_RPATH - "@executable_path/../${${package_prefix}_INSTALL_LIB_DIR}" - "@executable_path/" - "@loader_path/../${${package_prefix}_INSTALL_LIB_DIR}" - "@loader_path/" - ) - else () - set (CMAKE_INSTALL_RPATH "\$ORIGIN/../${${package_prefix}_INSTALL_LIB_DIR}:\$ORIGIN/") - endif () - - if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}") - set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) - endif () - - #set the default debug suffix for all library targets - if(NOT CMAKE_DEBUG_POSTFIX) - if (WIN32) - set (CMAKE_DEBUG_POSTFIX "_D") - else () - set (CMAKE_DEBUG_POSTFIX "_debug") - endif () - endif () - - SET_HDF_BUILD_TYPE() - -#----------------------------------------------------------------------------- -# Setup output Directories -#----------------------------------------------------------------------------- - if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables." - ) - set (CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries" - ) - set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries." - ) - set (CMAKE_Fortran_MODULE_DIRECTORY - ${PROJECT_BINARY_DIR}/mod CACHE PATH "Single Directory for all fortran modules." - ) - get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if(_isMultiConfig) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) - set (CMAKE_PDB_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." - ) - else () - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - endif () - else () - # if we are externally configured, but the project uses old cmake scripts - # this may not be set and utilities like H5detect will fail - if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) - endif () - endif () - - if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - if (CMAKE_HOST_UNIX) - set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" - CACHE PATH "Install path prefix, prepended onto install directories." FORCE) - else () - GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) - set (CMAKE_INSTALL_PREFIX - "${CMAKE_GENERIC_PROGRAM_FILES}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}" - CACHE PATH "Install path prefix, prepended onto install directories." FORCE) - set (CMAKE_GENERIC_PROGRAM_FILES) - endif () - set (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 0 CACHE PATH "" FORCE) - endif () - - include (FetchContent) -#----------------------------------------------------------------------------- -# Setup pre-3.14 FetchContent -#----------------------------------------------------------------------------- - if(${CMAKE_VERSION} VERSION_LESS 3.14) - macro(FetchContent_MakeAvailable NAME) - FetchContent_GetProperties(${NAME}) - if(NOT ${NAME}_POPULATED) - FetchContent_Populate(${NAME}) - add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) - endif() - endmacro() - endif() -endmacro () - -macro (ADD_H5_FLAGS h5_flag_var infile) - file (STRINGS ${infile} TEST_FLAG_STREAM) - #message (TRACE "TEST_FLAG_STREAM=${TEST_FLAG_STREAM}") - list (LENGTH TEST_FLAG_STREAM len_flag) - if (len_flag GREATER 0) - math (EXPR _FP_LEN "${len_flag} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET TEST_FLAG_STREAM ${line} str_flag) - string (REGEX REPLACE "^#.*" "" str_flag "${str_flag}") - #message (TRACE "str_flag=${str_flag}") - if (NOT HDF5_ENABLE_WARNINGS_AS_ERRORS) - string (REGEX REPLACE "-Werror=" "-W" str_flag "${str_flag}") - endif () - if (str_flag) - list (APPEND ${h5_flag_var} "${str_flag}") - endif () - endforeach () - endif () - #message (TRACE "h5_flag_var=${${h5_flag_var}}") -endmacro () - diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c deleted file mode 100644 index 2d7e1b4..0000000 --- a/config/cmake_ext_mod/HDFTests.c +++ /dev/null @@ -1,383 +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://www.hdfgroup.org/licenses. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define SIMPLE_TEST(x) int main(){ x; return 0; } - -#ifdef HAVE_C99_DESIGNATED_INITIALIZER - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus -extern "C" -# endif -int FC_DUMMY_MAIN() -{ return 1;} -#endif -#endif -int -main () -{ - - typedef struct - { - int x; - union - { - int i; - double d; - }u; - }di_struct_t; - di_struct_t x = - { 0, - { .d = 0.0}}; - ; - return 0; -} - -#endif - -#ifdef HAVE_C99_FUNC - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ - const char *fname = __func__; - ; - return 0; -} - -#endif - -#ifdef VSNPRINTF_WORKS -#include -#include -#include - -int test_vsnprintf(const char *fmt,...) -{ - va_list ap; - char *s = malloc(16); - int ret; - - va_start(ap, fmt); - ret=vsnprintf(s,16,"%s",ap); - va_end(ap); - - return(ret!=42 ? 1 : 0); -} - -int main(void) -{ - return(test_vsnprintf("%s","A string that is longer than 16 characters")); -} -#endif - -#ifdef STDC_HEADERS -#include -#include -#include -#include -int main() { return 0; } -#endif /* STDC_HEADERS */ - - -#ifdef HAVE_ATTRIBUTE - -#if 0 -static void test int __attribute((unused)) var) -{ - int __attribute__((unused)) x = var; -} - -int main(void) -{ - test(19); -} - -#else -int -main () -{ -int __attribute__((unused)) x - ; - return 0; -} -#endif - - -#endif /* HAVE_ATTRIBUTE */ - -#ifdef HAVE_FUNCTION - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -(void)__FUNCTION__ - ; - return 0; -} - -#endif /* HAVE_FUNCTION */ - -#ifdef HAVE_TIMEZONE - -#ifdef HAVE_SYS_TIME_H -#include -#endif -#include -SIMPLE_TEST(timezone=0); - -#endif /* HAVE_TIMEZONE */ - -#ifdef PRINTF_LL_WIDTH - -#ifdef HAVE_LONG_LONG -# define LL_TYPE long long -#else /* HAVE_LONG_LONG */ -# define LL_TYPE __int64 -#endif /* HAVE_LONG_LONG */ - -#include -#include -#include - -#if defined(_MSC_VER) && defined(_DEBUG) -# include -int DebugReport(int reportType, char* message, int* returnValue) -{ - (void)reportType; - (void)message; - (void)returnValue; - return 1; /* no further handling required */ -} -#endif - -int main(void) -{ - char *llwidthArgs[] = { "I64", "l64", "ll", "l", "L", "q", NULL }; - char *s = malloc(128); - char **currentArg = NULL; - LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; - #if defined(_MSC_VER) && defined(_DEBUG) - _CrtSetReportHook(DebugReport); - #endif - for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++) - { - char formatString[64]; - sprintf(formatString, "%%%sd", *currentArg); - sprintf(s, formatString, x); - if (strcmp(s, "1099511627776") == 0) - { - printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg); - return 0; - } - } - return 1; -} - -#endif /* PRINTF_LL_WIDTH */ - -#ifdef SYSTEM_SCOPE_THREADS -#include -#include - -int main(void) -{ - pthread_attr_t attribute; - int ret; - - pthread_attr_init(&attribute); - ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); - if (ret==0) - return 0; - return 1; -} - -#endif /* SYSTEM_SCOPE_THREADS */ - -#ifdef HAVE_SOCKLEN_T - -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -SIMPLE_TEST(socklen_t foo); - -#endif /* HAVE_SOCKLEN_T */ - -#ifdef DEV_T_IS_SCALAR - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -int main () -{ - dev_t d1, d2; - if(d1==d2) - return 0; - return 1; -} - -#endif /* DEV_T_IS_SCALAR */ - -#ifdef HAVE_OFF64_T -#include -int main() -{ - off64_t n = 0; - return (int)n; -} -#endif - -#ifdef TEST_DIRECT_VFD_WORKS -#include -#include -#include -int main(void) -{ - int fid; - if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0) - return 1; - close(fid); - remove("tst_file"); - return 0; -} -#endif - -#ifdef HAVE_DIRECT - SIMPLE_TEST(posix_memalign()); -#endif - -#ifdef HAVE_DEFAULT_SOURCE -/* check default source */ -#include - -int -main(void) -{ -#ifdef __GLIBC_PREREQ - return __GLIBC_PREREQ(2,19); -#else - return 0; -#endif /* defined(__GLIBC_PREREQ) */ -} -#endif - -#ifdef TEST_LFS_WORKS -/* Return 0 when LFS is available and 1 otherwise. */ -#define _LARGEFILE_SOURCE -#define _LARGEFILE64_SOURCE -#define _LARGE_FILES -#define _FILE_OFFSET_BITS 64 -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - /* check that off_t can hold 2^63 - 1 and perform basic operations... */ -#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - if (OFF_T_64 % 2147483647 != 1) - return 1; - - /* stat breaks on SCO OpenServer */ - struct stat buf; - stat( argv[0], &buf ); - if (!S_ISREG(buf.st_mode)) - return 2; - - FILE *file = fopen( argv[0], "r" ); - off_t offset = ftello( file ); - fseek( file, offset, SEEK_CUR ); - fclose( file ); - return 0; -} -#endif - -#ifdef GETTIMEOFDAY_GIVES_TZ -#include -#ifdef HAVE_SYS_TIME_H -#include -#endif -int main(void) -{ - struct timeval tv; - struct timezone tz; - tz.tz_minuteswest = 7777; /* Initialize to an unreasonable number */ - tz.tz_dsttime = 7; - gettimeofday(&tv, &tz); - /* Check whether the function returned any value at all */ - if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7) - return 1; - else return 0; -} -#endif - -#ifdef HAVE_IOEO - -#include -typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); -int main () -{ - PGNSI pGNSI; - pGNSI = (PGNSI) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "InitOnceExecuteOnce"); - if(NULL == pGNSI) - return 1; - else - return 0; -} - -#endif /* HAVE_IOEO */ - -#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) -#ifndef __cplusplus -#if defined( HAVE_INLINE ) -# define INLINE_KW inline -#elif defined ( HAVE___INLINE__ ) -# define INLINE_KW __inline__ -#elif defined ( HAVE___INLINE ) -# define INLINE_KW __inline -#endif /* HAVE_INLINE */ -typedef int foo_t; -static INLINE_KW foo_t static_foo () { return 0; } -INLINE_KW foo_t foo () {return 0; } -int main(void) { return 0; } -#endif /* __cplusplus */ -#endif /* defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) */ - diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake deleted file mode 100644 index 6788773..0000000 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ /dev/null @@ -1,47 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# -# This file provides functions for C++ support. -# -#------------------------------------------------------------------------------- -ENABLE_LANGUAGE (CXX) -set (HDF_PREFIX "H5") - -#------------------------------------------------------------------------------- -# Fix CXX flags if we are compiling statically on Windows using -# Windows_MT.cmake from config/cmake/UserMacros -#------------------------------------------------------------------------------- -if (BUILD_STATIC_CRT_LIBS) - TARGET_STATIC_CRT_FLAGS () -endif () - -#----------------------------------------------------------------------------- -# Configure Checks which require CXX compilation must go in here -# not in the main ConfigureChecks.cmake files, because if the user has -# no CXX compiler, problems arise. -#----------------------------------------------------------------------------- -include (CheckIncludeFileCXX) -include (TestForSTDNamespace) - -# IF the c compiler found stdint, check the C++ as well. On some systems this -# file will be found by C but not C++, only do this test IF the C++ compiler -# has been initialized (e.g. the project also includes some c++) -if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) - CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX) - if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) - set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") - set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") - endif () -endif () - -#Always define -set (${HDF_PREFIX}_CXX_HAVE_OFFSETOF 1) diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake deleted file mode 100644 index c96298f..0000000 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ /dev/null @@ -1,223 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# -# This file provides functions for Fortran support. -# -#------------------------------------------------------------------------------- -enable_language (Fortran) -set (HDF_PREFIX "H5") - -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - include (CheckFortranSourceRuns) - include (CheckFortranSourceCompiles) -endif () - -#------------------------------------------------------------------------------- -# Fix Fortran flags if we are compiling statically on Windows using -# Windows_MT.cmake from config/cmake/UserMacros -#------------------------------------------------------------------------------- -if (BUILD_STATIC_CRT_LIBS) - TARGET_STATIC_CRT_FLAGS () -endif () - -#----------------------------------------------------------------------------- -# Detect name mangling convention used between Fortran and C -#----------------------------------------------------------------------------- -include (FortranCInterface) -FortranCInterface_HEADER ( - ${CMAKE_BINARY_DIR}/FCMangle.h - MACRO_NAMESPACE "H5_FC_" - SYMBOL_NAMESPACE "H5_FC_" -) - -file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)") -string (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) -set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}") - -file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)") -string (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS}) -set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}") - -#test code source -set (SIZEOF_CODE - " - PROGRAM main - i = sizeof(x) - END PROGRAM - " -) -set (C_SIZEOF_CODE - " - PROGRAM main - USE ISO_C_BINDING - INTEGER(C_INT) :: a - INTEGER(C_SIZE_T) :: result - result = c_sizeof(a) - END PROGRAM - " -) -set (STORAGE_SIZE_CODE - " - PROGRAM main - INTEGER :: a - INTEGER :: result - result = storage_size(a) - END PROGRAM - " -) -set (ISO_FORTRAN_ENV_CODE - " - PROGRAM main - USE, INTRINSIC :: ISO_FORTRAN_ENV - END PROGRAM - " -) -set (REALISNOTDOUBLE_CODE - " - MODULE type_mod - INTERFACE h5t - MODULE PROCEDURE h5t_real - MODULE PROCEDURE h5t_dble - END INTERFACE - CONTAINS - SUBROUTINE h5t_real(r) - REAL :: r - END SUBROUTINE h5t_real - SUBROUTINE h5t_dble(d) - DOUBLE PRECISION :: d - END SUBROUTINE h5t_dble - END MODULE type_mod - PROGRAM main - USE type_mod - REAL :: r - DOUBLE PRECISION :: d - CALL h5t(r) - CALL h5t(d) - END PROGRAM main - " -) -set (ISO_C_BINDING_CODE - " - PROGRAM main - USE iso_c_binding - IMPLICIT NONE - TYPE(C_PTR) :: ptr - TYPE(C_FUNPTR) :: funptr - INTEGER(C_INT64_T) :: c_int64_type - CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr - ptr = C_LOC(ichr(1:1)) - END PROGRAM - " -) - -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - if (HDF5_REQUIRED_LIBRARIES) - set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}") - endif () - check_fortran_source_compiles (${SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF SRC_EXT f90) - check_fortran_source_compiles (${C_SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF SRC_EXT f90) - check_fortran_source_compiles (${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE SRC_EXT f90) - check_fortran_source_compiles (${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV SRC_EXT f90) - check_fortran_source_compiles (${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE SRC_EXT f90) - check_fortran_source_compiles (${ISO_C_BINDING_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING SRC_EXT f90) -else () - #----------------------------------------------------------------------------- - # The provided CMake Fortran macros don't provide a general check function - # so this one is used for a sizeof test. - #----------------------------------------------------------------------------- - macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Testing Fortran ${FUNCTION}") - endif () - if (HDF5_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") - else () - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif () - file (WRITE - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90 - "${CODE}" - ) - TRY_COMPILE (RESULT_VAR - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90 - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - - # if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - # message (TRACE "Test result ${OUTPUT}") - # message (TRACE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - # endif () - - if (${RESULT_VAR}) - set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Testing Fortran ${FUNCTION} - OK") - endif () - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" - ) - else () - message (STATUS "Testing Fortran ${FUNCTION} - Fail") - set (${VARIABLE} 0 CACHE INTERNAL "Have Fortran function ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") - endif () - endmacro () - - #----------------------------------------------------------------------------- - # Configure Checks which require Fortran compilation must go in here - # not in the main ConfigureChecks.cmake files, because if the user has - # no Fortran compiler, problems arise. - # - # Be careful with leading spaces here, do not remove them. - #----------------------------------------------------------------------------- - - # Check for Non-standard extension intrinsic function SIZEOF - set (${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF FALSE) - CHECK_FORTRAN_FEATURE(sizeof_code ${SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF) - - # Check for F2008 standard intrinsic function C_SIZEOF - set (${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF FALSE) - CHECK_FORTRAN_FEATURE(c_sizeof_code ${C_SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF) - - # Check for F2008 standard intrinsic function STORAGE_SIZE - CHECK_FORTRAN_FEATURE(storage_size_code ${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE) - - # Check for F2008 standard intrinsic module "ISO_FORTRAN_ENV" - set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV FALSE) - CHECK_FORTRAN_FEATURE(iso_fortran_env_code ${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV) - - set (${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) - CHECK_FORTRAN_FEATURE(realisnotdouble_code ${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE) - - #----------------------------------------------------------------------------- - # Checks if the ISO_C_BINDING module meets all the requirements - #----------------------------------------------------------------------------- - set (${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING FALSE) - CHECK_FORTRAN_FEATURE(iso_c_binding_code ${ISO_C_BINDING_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING) -endif () - -#----------------------------------------------------------------------------- -# Add debug information (intel Fortran : JB) -#----------------------------------------------------------------------------- -if (CMAKE_Fortran_COMPILER MATCHES ifort) - if (WIN32 AND NOT MINGW) - set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE STRING "flags" FORCE) - set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "flags" FORCE) - endif () -endif () diff --git a/config/cmake_ext_mod/NSIS.InstallOptions.ini.in b/config/cmake_ext_mod/NSIS.InstallOptions.ini.in deleted file mode 100644 index 9954f28..0000000 --- a/config/cmake_ext_mod/NSIS.InstallOptions.ini.in +++ /dev/null @@ -1,37 +0,0 @@ -[Settings] -NumFields=5 - -[Field 1] -Type=label -Text=By default the @CPACK_PACKAGE_NAME@ bin directory is added to the system PATH. This allows shared library (dll) discovery (if installed) and running HDF5 tools from the command line. -Left=0 -Right=-1 -Top=0 -Bottom=20 - -[Field 2] -Type=radiobutton -Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH -Left=0 -Right=-1 -Top=30 -Bottom=40 -State=0 - -[Field 3] -Type=radiobutton -Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users -Left=0 -Right=-1 -Top=40 -Bottom=50 -State=1 - -[Field 4] -Type=radiobutton -Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user -Left=0 -Right=-1 -Top=50 -Bottom=60 -State=0 diff --git a/config/cmake_ext_mod/NSIS.template.in b/config/cmake_ext_mod/NSIS.template.in deleted file mode 100644 index db79466..0000000 --- a/config/cmake_ext_mod/NSIS.template.in +++ /dev/null @@ -1,974 +0,0 @@ -; CPack install script designed for a nmake build - -;-------------------------------- -; You must define these values - - !define VERSION "@CPACK_PACKAGE_VERSION@" - !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@" - !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" - -;-------------------------------- -;Variables - - Var MUI_TEMP - Var STARTMENU_FOLDER - Var SV_ALLUSERS - Var START_MENU - Var DO_NOT_ADD_TO_PATH - Var ADD_TO_PATH_ALL_USERS - Var ADD_TO_PATH_CURRENT_USER - Var INSTALL_DESKTOP - Var IS_DEFAULT_INSTALLDIR -;-------------------------------- -;Include Modern UI - - !include "MUI.nsh" - - ;Default installation folder - InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - -;-------------------------------- -;General - - ;Name and file - Name "@CPACK_NSIS_PACKAGE_NAME@" - OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" - - ;Set compression - SetCompressor @CPACK_NSIS_COMPRESSOR@ - -@CPACK_NSIS_DEFINES@ - - !include Sections.nsh - -;--- Component support macros: --- -; The code for the add/remove functionality is from: -; http://nsis.sourceforge.net/Add/Remove_Functionality -; It has been modified slightly and extended to provide -; inter-component dependencies. -Var AR_SecFlags -Var AR_RegFlags -@CPACK_NSIS_SECTION_SELECTED_VARS@ - -; Loads the "selected" flag for the section named SecName into the -; variable VarName. -!macro LoadSectionSelectedIntoVar SecName VarName - SectionGetFlags ${${SecName}} $${VarName} - IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits -!macroend - -; Loads the value of a variable... can we get around this? -!macro LoadVar VarName - IntOp $R0 0 + $${VarName} -!macroend - -; Sets the value of a variable -!macro StoreVar VarName IntValue - IntOp $${VarName} 0 + ${IntValue} -!macroend - -!macro InitSection SecName - ; This macro reads component installed flag from the registry and - ;changes checked state of the section on the components page. - ;Input: section index constant name specified in Section command. - - ClearErrors - ;Reading component status from registry - ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed" - IfErrors "default_${SecName}" - ;Status will stay default if registry value not found - ;(component was never installed) - IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags - IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off - IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit - - ; Note whether this component was installed before - !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags - IntOp $R0 $AR_RegFlags & $AR_RegFlags - - ;Writing modified flags - SectionSetFlags ${${SecName}} $AR_SecFlags - - "default_${SecName}:" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected -!macroend - -!macro FinishSection SecName - ; This macro reads section flag set by user and removes the section - ;if it is not selected. - ;Then it writes component installed flag to registry - ;Input: section index constant name specified in Section command. - - SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags - ;Checking lowest bit: - IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED} - IntCmp $AR_SecFlags 1 "leave_${SecName}" - ;Section is not selected: - ;Calling Section uninstall macro and writing zero installed flag - !insertmacro "Remove_${${SecName}}" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ - "Installed" 0 - Goto "exit_${SecName}" - - "leave_${SecName}:" - ;Section is selected: - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \ - "Installed" 1 - - "exit_${SecName}:" -!macroend - -!macro RemoveSection_CPack SecName - ; This macro is used to call section's Remove_... macro - ;from the uninstaller. - ;Input: section index constant name specified in Section command. - - !insertmacro "Remove_${${SecName}}" -!macroend - -; Determine whether the selection of SecName changed -!macro MaybeSelectionChanged SecName - !insertmacro LoadVar ${SecName}_selected - SectionGetFlags ${${SecName}} $R1 - IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits - - ; See if the status has changed: - IntCmp $R0 $R1 "${SecName}_unchanged" - !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected - - IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected" - !insertmacro "Deselect_required_by_${SecName}" - goto "${SecName}_unchanged" - - "${SecName}_was_selected:" - !insertmacro "Select_${SecName}_depends" - - "${SecName}_unchanged:" -!macroend -;--- End of Add/Remove macros --- - -;-------------------------------- -;Interface Settings - - !define MUI_HEADERIMAGE - !define MUI_ABORTWARNING - -;-------------------------------- -; path functions - -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 - -;---------------------------------------- -; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02" -;---------------------------------------- -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 -;==================================================== -; get_NT_environment -; Returns: the selected environment -; Output : head of the stack -;==================================================== -!macro select_NT_profile UN -Function ${UN}select_NT_profile - StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single - DetailPrint "Selected environment for all users" - Push "all" - Return - environment_single: - DetailPrint "Selected environment for current user only." - Push "current" - Return -FunctionEnd -!macroend -!insertmacro select_NT_profile "" -!insertmacro select_NT_profile "un." -;---------------------------------------------------- -!define NT_current_env 'HKCU "Environment"' -!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - -!ifndef WriteEnvStr_RegKey - !ifdef ALL_USERS - !define WriteEnvStr_RegKey \ - 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' - !else - !define WriteEnvStr_RegKey 'HKCU "Environment"' - !endif -!endif - -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot - -Function AddToPath - Exch $0 - Push $1 - Push $2 - Push $3 - - # don't add if the path doesn't exist - IfFileExists "$0\*.*" "" AddToPath_done - - ReadEnvStr $1 PATH - ; if the path is too long for a NSIS variable NSIS will return a 0 - ; length string. If we find that, then warn and skip any path - ; modification as it will trash the existing path. - StrLen $2 $1 - IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done - CheckPathLength_ShowPathWarning: - Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" - Goto AddToPath_done - CheckPathLength_Done: - Push "$1;" - Push "$0;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$0\;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - GetFullPathName /SHORT $3 $0 - Push "$1;" - Push "$3;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - Push "$1;" - Push "$3\;" - Call StrStr - Pop $2 - StrCmp $2 "" "" AddToPath_done - - Call IsNT - Pop $1 - StrCmp $1 1 AddToPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" a - FileSeek $1 -1 END - FileReadByte $1 $2 - IntCmp $2 26 0 +2 +2 # DOS EOF - FileSeek $1 -1 END # write over EOF - FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n" - FileClose $1 - SetRebootFlag true - Goto AddToPath_done - - AddToPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto DoTrim - ReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - DoTrim: - StrCmp $1 "" AddToPath_NTdoIt - Push $1 - Call Trim - Pop $1 - StrCpy $0 "$1;$0" - AddToPath_NTdoIt: - StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $0 - Goto DoSend - WriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $0 - DoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - AddToPath_done: - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - - -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack - -Function un.RemoveFromPath - Exch $0 - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - Push $6 - - IntFmt $6 "%c" 26 # DOS EOF - - Call un.IsNT - Pop $1 - StrCmp $1 1 unRemoveFromPath_NT - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - GetFullPathName /SHORT $0 $0 - StrCpy $0 "SET PATH=%PATH%;$0" - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoop: - FileRead $1 $3 - StrCpy $5 $3 1 -1 # read last char - StrCmp $5 $6 0 +2 # if DOS EOF - StrCpy $3 $3 -1 # remove DOS EOF so we can compare - StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine - StrCmp $3 "" unRemoveFromPath_dosLoopEnd - FileWrite $2 $3 - Goto unRemoveFromPath_dosLoop - unRemoveFromPath_dosLoopRemoveLine: - SetRebootFlag true - Goto unRemoveFromPath_dosLoop - - unRemoveFromPath_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Goto unRemoveFromPath_done - - unRemoveFromPath_NT: - StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey - ReadRegStr $1 ${NT_current_env} "PATH" - Goto unDoTrim - unReadAllKey: - ReadRegStr $1 ${NT_all_env} "PATH" - unDoTrim: - StrCpy $5 $1 1 -1 # copy last char - StrCmp $5 ";" +2 # if last char != ; - StrCpy $1 "$1;" # append ; - Push $1 - Push "$0;" - Call un.StrStr ; Find `$0;` in $1 - Pop $2 ; pos of our dir - StrCmp $2 "" unRemoveFromPath_done - ; else, it is in path - # $0 - path to add - # $1 - path var - StrLen $3 "$0;" - StrLen $4 $2 - StrCpy $5 $1 -$4 # $5 is now the part before the path to remove - StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove - StrCpy $3 $5$6 - - StrCpy $5 $3 1 -1 # copy last char - StrCmp $5 ";" 0 +2 # if last char == ; - StrCpy $3 $3 -1 # remove last char - - StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey - WriteRegExpandStr ${NT_current_env} "PATH" $3 - Goto unDoSend - unWriteAllKey: - WriteRegExpandStr ${NT_all_env} "PATH" $3 - unDoSend: - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - - unRemoveFromPath_done: - Pop $6 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Uninstall sutff -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -########################################### -# Utility Functions # -########################################### - -;==================================================== -; IsNT - Returns 1 if the current system is NT, 0 -; otherwise. -; Output: head of the stack -;==================================================== -; IsNT -; no input -; output, top of the stack = 1 if NT or 0 if not -; -; Usage: -; Call IsNT -; Pop $R0 -; ($R0 at this point is 1 or 0) - -!macro IsNT un -Function ${un}IsNT - Push $0 - ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -; StrStr -; input, top of stack = string to search for -; top of stack-1 = string to search in -; output, top of stack (replaces with the portion of the string remaining) -; modifies no other variables. -; -; Usage: -; Push "this is a long ass string" -; Push "ass" -; Call StrStr -; Pop $R0 -; ($R0 at this point is "ass string") - -!macro StrStr un -Function ${un}StrStr -Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - loop: - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 done - StrCmp $R5 "" done - IntOp $R4 $R4 + 1 - Goto loop -done: - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 -FunctionEnd -!macroend -!insertmacro StrStr "" -!insertmacro StrStr "un." - -Function Trim ; Added by Pelaca - Exch $R1 - Push $R2 -Loop: - StrCpy $R2 "$R1" 1 -1 - StrCmp "$R2" " " RTrim - StrCmp "$R2" "$\n" RTrim - StrCmp "$R2" "$\r" RTrim - StrCmp "$R2" ";" RTrim - GoTo Done -RTrim: - StrCpy $R1 "$R1" -1 - Goto Loop -Done: - Pop $R2 - Exch $R1 -FunctionEnd - -Function ConditionalAddToRegisty - Pop $0 - Pop $1 - StrCmp "$0" "" ConditionalAddToRegisty_EmptyString - WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \ - "$1" "$0" - ;MessageBox MB_OK "Set Registry: '$1' to '$0'" - DetailPrint "Set install registry entry: '$1' to '$0'" - ConditionalAddToRegisty_EmptyString: -FunctionEnd - -;-------------------------------- - -!ifdef CPACK_USES_DOWNLOAD -Function DownloadFile - IfFileExists $INSTDIR\* +2 - CreateDirectory $INSTDIR - Pop $0 - - ; Skip if already downloaded - IfFileExists $INSTDIR\$0 0 +2 - Return - - StrCpy $1 "@CPACK_DOWNLOAD_SITE@" - - try_again: - NSISdl::download "$1/$0" "$INSTDIR\$0" - - Pop $1 - StrCmp $1 "success" success - StrCmp $1 "Cancelled" cancel - MessageBox MB_OK "Download failed: $1" - cancel: - Return - success: -FunctionEnd -!endif - -;-------------------------------- -; Installation types -@CPACK_NSIS_INSTALLATION_TYPES@ - -;-------------------------------- -; Component sections -@CPACK_NSIS_COMPONENT_SECTIONS@ - -;-------------------------------- -; Define some macro setting for the gui -@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ -@CPACK_NSIS_INSTALLER_ICON_CODE@ -@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ -@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ - -;-------------------------------- -;Pages - !insertmacro MUI_PAGE_WELCOME - - !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@" - Page custom InstallOptionsPage - !insertmacro MUI_PAGE_DIRECTORY - - ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER - - @CPACK_NSIS_PAGE_COMPONENTS@ - - !insertmacro MUI_PAGE_INSTFILES - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" ;first language is the default language - !insertmacro MUI_LANGUAGE "Albanian" - !insertmacro MUI_LANGUAGE "Arabic" - !insertmacro MUI_LANGUAGE "Basque" - !insertmacro MUI_LANGUAGE "Belarusian" - !insertmacro MUI_LANGUAGE "Bosnian" - !insertmacro MUI_LANGUAGE "Breton" - !insertmacro MUI_LANGUAGE "Bulgarian" - !insertmacro MUI_LANGUAGE "Croatian" - !insertmacro MUI_LANGUAGE "Czech" - !insertmacro MUI_LANGUAGE "Danish" - !insertmacro MUI_LANGUAGE "Dutch" - !insertmacro MUI_LANGUAGE "Estonian" - !insertmacro MUI_LANGUAGE "Farsi" - !insertmacro MUI_LANGUAGE "Finnish" - !insertmacro MUI_LANGUAGE "French" - !insertmacro MUI_LANGUAGE "German" - !insertmacro MUI_LANGUAGE "Greek" - !insertmacro MUI_LANGUAGE "Hebrew" - !insertmacro MUI_LANGUAGE "Hungarian" - !insertmacro MUI_LANGUAGE "Icelandic" - !insertmacro MUI_LANGUAGE "Indonesian" - !insertmacro MUI_LANGUAGE "Irish" - !insertmacro MUI_LANGUAGE "Italian" - !insertmacro MUI_LANGUAGE "Japanese" - !insertmacro MUI_LANGUAGE "Korean" - !insertmacro MUI_LANGUAGE "Kurdish" - !insertmacro MUI_LANGUAGE "Latvian" - !insertmacro MUI_LANGUAGE "Lithuanian" - !insertmacro MUI_LANGUAGE "Luxembourgish" - !insertmacro MUI_LANGUAGE "Macedonian" - !insertmacro MUI_LANGUAGE "Malay" - !insertmacro MUI_LANGUAGE "Mongolian" - !insertmacro MUI_LANGUAGE "Norwegian" - !insertmacro MUI_LANGUAGE "Polish" - !insertmacro MUI_LANGUAGE "Portuguese" - !insertmacro MUI_LANGUAGE "PortugueseBR" - !insertmacro MUI_LANGUAGE "Romanian" - !insertmacro MUI_LANGUAGE "Russian" - !insertmacro MUI_LANGUAGE "Serbian" - !insertmacro MUI_LANGUAGE "SerbianLatin" - !insertmacro MUI_LANGUAGE "SimpChinese" - !insertmacro MUI_LANGUAGE "Slovak" - !insertmacro MUI_LANGUAGE "Slovenian" - !insertmacro MUI_LANGUAGE "Spanish" - !insertmacro MUI_LANGUAGE "Swedish" - !insertmacro MUI_LANGUAGE "Thai" - !insertmacro MUI_LANGUAGE "TradChinese" - !insertmacro MUI_LANGUAGE "Turkish" - !insertmacro MUI_LANGUAGE "Ukrainian" - !insertmacro MUI_LANGUAGE "Welsh" - - -;-------------------------------- -;Reserve Files - - ;These files should be inserted before other files in the data block - ;Keep these lines before any File command - ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) - - ReserveFile "NSIS.InstallOptions.ini" - !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - -;-------------------------------- -;Installer Sections - -Section "-Core installation" - ;Use the entire tree produced by the INSTALL target. Keep the - ;list of directories here in sync with the RMDir commands below. - SetOutPath "$INSTDIR" - @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@ - @CPACK_NSIS_FULL_INSTALL@ - - ;Store installation folder - WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR - - ;Create uninstaller - WriteUninstaller "$INSTDIR\Uninstall.exe" - Push "DisplayName" - Push "@CPACK_NSIS_DISPLAY_NAME@" - Call ConditionalAddToRegisty - Push "DisplayVersion" - Push "@CPACK_PACKAGE_VERSION@" - Call ConditionalAddToRegisty - Push "Publisher" - Push "@CPACK_PACKAGE_VENDOR@" - Call ConditionalAddToRegisty - Push "UninstallString" - Push "$INSTDIR\Uninstall.exe" - Call ConditionalAddToRegisty - Push "NoRepair" - Push "1" - Call ConditionalAddToRegisty - - !ifdef CPACK_NSIS_ADD_REMOVE - ;Create add/remove functionality - Push "ModifyPath" - Push "$INSTDIR\AddRemove.exe" - Call ConditionalAddToRegisty - !else - Push "NoModify" - Push "1" - Call ConditionalAddToRegisty - !endif - - ; Optional registration - Push "DisplayIcon" - Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" - Call ConditionalAddToRegisty - Push "HelpLink" - Push "@CPACK_NSIS_HELP_LINK@" - Call ConditionalAddToRegisty - Push "URLInfoAbout" - Push "@CPACK_NSIS_URL_INFO_ABOUT@" - Call ConditionalAddToRegisty - Push "Contact" - Push "@CPACK_NSIS_CONTACT@" - Call ConditionalAddToRegisty - !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State" - !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - - ;Create shortcuts - CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" -@CPACK_NSIS_CREATE_ICONS@ -@CPACK_NSIS_CREATE_ICONS_EXTRA@ - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" - - ;Read a value from an InstallOptions INI file - !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" - - ; Write special uninstall registry entries - Push "StartMenu" - Push "$STARTMENU_FOLDER" - Call ConditionalAddToRegisty - Push "DoNotAddToPath" - Push "$DO_NOT_ADD_TO_PATH" - Call ConditionalAddToRegisty - Push "AddToPathAllUsers" - Push "$ADD_TO_PATH_ALL_USERS" - Call ConditionalAddToRegisty - Push "AddToPathCurrentUser" - Push "$ADD_TO_PATH_CURRENT_USER" - Call ConditionalAddToRegisty - Push "InstallToDesktop" - Push "$INSTALL_DESKTOP" - Call ConditionalAddToRegisty - - !insertmacro MUI_STARTMENU_WRITE_END - -@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ - -SectionEnd - -Section "-Add to path" - Push $INSTDIR\bin - StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath - StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 - Call AddToPath - doNotAddToPath: -SectionEnd - -;-------------------------------- -; Create custom pages -Function InstallOptionsPage - !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" - -FunctionEnd - -;-------------------------------- -; determine admin versus local install -Function un.onInit - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - Goto done - StrCmp $1 "Power" 0 +3 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - Goto done - - noLM: - ;Get installation folder from registry if available - - done: - -FunctionEnd - -;--- Add/Remove callback functions: --- -!macro SectionList MacroName - ;This macro used to perform operation on multiple sections. - ;List all of your components in following manner here. -@CPACK_NSIS_COMPONENT_SECTION_LIST@ -!macroend - -Section -FinishComponents - ;Removes unselected components and writes component status to registry - !insertmacro SectionList "FinishSection" - -!ifdef CPACK_NSIS_ADD_REMOVE - ; Get the name of the installer executable - System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' - StrCpy $R3 $R0 - - ; Strip off the last 13 characters, to see if we have AddRemove.exe - StrLen $R1 $R0 - IntOp $R1 $R0 - 13 - StrCpy $R2 $R0 13 $R1 - StrCmp $R2 "AddRemove.exe" addremove_installed - - ; We're not running AddRemove.exe, so install it - CopyFiles $R3 $INSTDIR\AddRemove.exe - - addremove_installed: -!endif -SectionEnd -;--- End of Add/Remove callback functions --- - -;-------------------------------- -; Component dependencies -Function .onSelChange - !insertmacro SectionList MaybeSelectionChanged -FunctionEnd - -;-------------------------------- -;Uninstaller Section - -Section "Uninstall" - ReadRegStr $START_MENU SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu" - ;MessageBox MB_OK "Start menu is in: $START_MENU" - ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath" - ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers" - ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser" - ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" - ReadRegStr $INSTALL_DESKTOP SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop" - ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " - -@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ - - ;Remove files we installed. - ;Keep the list of directories here in sync with the File commands above. -@CPACK_NSIS_DELETE_FILES@ -@CPACK_NSIS_DELETE_DIRECTORIES@ - -!ifdef CPACK_NSIS_ADD_REMOVE - ;Remove the add/remove program - Delete "$INSTDIR\AddRemove.exe" -!endif - - ;Remove the uninstaller itself. - Delete "$INSTDIR\Uninstall.exe" - DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - ;Remove the installation directory if it is empty. - RMDir "$INSTDIR" - - ; Remove the registry entries. - DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - ; Removes all optional components - !insertmacro SectionList "RemoveSection_CPack" - - !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP - - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" -@CPACK_NSIS_DELETE_ICONS@ -@CPACK_NSIS_DELETE_ICONS_EXTRA@ - - ;Delete empty start menu parent directories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - startMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors startMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop - startMenuDeleteLoopDone: - - ; If the user changed the shortcut, then untinstall may not work. This should - ; try to fix it. - StrCpy $MUI_TEMP "$START_MENU" - Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" -@CPACK_NSIS_DELETE_ICONS_EXTRA@ - - ;Delete empty start menu parent directories - StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" - - secondStartMenuDeleteLoop: - ClearErrors - RMDir $MUI_TEMP - GetFullPathName $MUI_TEMP "$MUI_TEMP\.." - - IfErrors secondStartMenuDeleteLoopDone - - StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop - secondStartMenuDeleteLoopDone: - - DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" - - Push $INSTDIR\bin - StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 - Call un.RemoveFromPath - doNotRemoveFromPath: -SectionEnd - -;-------------------------------- -; determine admin versus local install -; Is install for "AllUsers" or "JustMe"? -; Default to "JustMe" - set to "AllUsers" if admin or on Win9x -; This function is used for the very first "custom page" of the installer. -; This custom page does not show up visibly, but it executes prior to the -; first visible page and sets up $INSTDIR properly... -; Choose different default installation folder based on SV_ALLUSERS... -; "Program Files" for AllUsers, "My Documents" for JustMe... - -Function .onInit - StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst - - ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString" - StrCmp $0 "" inst - - MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \ - "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \ - IDYES uninst IDNO inst - Abort - -;Run the uninstaller -uninst: - ClearErrors - StrLen $2 "\Uninstall.exe" - StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path - ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file - - IfErrors uninst_failed inst -uninst_failed: - MessageBox MB_OK|MB_ICONSTOP "Uninstall failed." - Abort - - -inst: - ; Reads components status for registry - !insertmacro SectionList "InitSection" - - ; check to see if /D has been used to change - ; the install directory by comparing it to the - ; install directory that is expected to be the - ; default - StrCpy $IS_DEFAULT_INSTALLDIR 0 - StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 - StrCpy $IS_DEFAULT_INSTALLDIR 1 - - StrCpy $SV_ALLUSERS "JustMe" - ; if default install dir then change the default - ; if it is installed for JustMe - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - ClearErrors - UserInfo::GetName - IfErrors noLM - Pop $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Admin group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - StrCmp $1 "Power" 0 +4 - SetShellVarContext all - ;MessageBox MB_OK 'User "$0" is in the Power Users group' - StrCpy $SV_ALLUSERS "AllUsers" - Goto done - - noLM: - StrCpy $SV_ALLUSERS "AllUsers" - ;Get installation folder from registry if available - - done: - StrCmp $SV_ALLUSERS "AllUsers" 0 +3 - StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" - - StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" - - noOptionsPage: -FunctionEnd diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake deleted file mode 100644 index 631fca6..0000000 --- a/config/cmake_ext_mod/grepTest.cmake +++ /dev/null @@ -1,195 +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://www.hdfgroup.org/licenses. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# grepTest.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. - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif () -if (NOT TEST_FOLDER) - message (FATAL_ERROR "Require TEST_FOLDER to be defined") -endif () -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif () -if (NOT TEST_FILTER) - message (STATUS "Optional TEST_FILTER to be defined") -endif () -if (NOT TEST_REFERENCE) - message (FATAL_ERROR "Require TEST_REFERENCE to be defined") -endif () - -if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") - file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) -endif () - -if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") - file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) -endif () - -message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") - -if (TEST_LIBRARY_DIRECTORY) - if (WIN32) - set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") - else () - set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") - endif () -endif () - -if (TEST_ENV_VAR) - set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (TRACE "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") - endif () -endif () - -# run the test program, capture the stdout/stderr and the result var -execute_process ( - COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_OUT - ERROR_VARIABLE TEST_ERROR -) - -message (STATUS "COMMAND Result: ${TEST_RESULT}") - -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -# remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}") -if (TEST_FIND_RESULT GREATER 0) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) -endif () - -# if the TEST_ERRREF exists grep the error output with the error reference -set (TEST_ERRREF_RESULT 0) -if (TEST_ERRREF) - # if the .err file exists grep the error output with the error reference before comparing stdout - if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM) - list (LENGTH TEST_ERR_STREAM test_len) - if (test_len GREATER 0) - # TEST_ERRREF should always be matched - string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM}) - string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_ERRREF_RESULT) - if (NOT TEST_ERRREF_RESULT) - message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}") - endif () - endif () - endif () - - #always compare output file to reference unless this must be skipped - set (TEST_COMPARE_RESULT 0) - if (NOT TEST_SKIP_COMPARE) - if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - list (LENGTH TEST_STREAM test_len) - if (test_len GREATER 0) - if (WIN32) - configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) - if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") - file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) - endif () - #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () - if (NOT TEST_SORT_COMPARE) - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_COMPARE_RESULT - ) - else () - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) - list (SORT v1) - list (SORT v2) - if (NOT v1 STREQUAL v2) - set(TEST_COMPARE_RESULT 1) - endif () - endif () - - if (TEST_COMPARE_RESULT) - set (TEST_COMPARE_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (len_act GREATER 0 AND len_ref GREATER 0) - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_COMPARE_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif () - endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") - endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") - endif () - endif () - if (NOT len_act EQUAL len_ref) - set (TEST_COMPARE_RESULT 1) - endif () - endif () - endif () - - message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") - - # again, if return value is !=0 scream and shout - if (TEST_COMPARE_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") - endif () - endif () - endif () -else () - # else grep the output with the reference - set (TEST_GREP_RESULT 0) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - - # TEST_REFERENCE should always be matched - string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) - if (NOT TEST_GREP_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") - endif () -endif () - - -if (TEST_FILTER) - string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if (TEST_EXPECT) - # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match - string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) - if (TEST_GREP_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif () - endif () -endif () - -# everything went fine... -message (STATUS "Passed: The output of ${TEST_PROGRAM} matched") - diff --git a/config/cmake_ext_mod/hdf.bmp b/config/cmake_ext_mod/hdf.bmp deleted file mode 100644 index 9e9e4aa..0000000 Binary files a/config/cmake_ext_mod/hdf.bmp and /dev/null differ diff --git a/config/cmake_ext_mod/hdf.icns b/config/cmake_ext_mod/hdf.icns deleted file mode 100644 index 66f025d..0000000 Binary files a/config/cmake_ext_mod/hdf.icns and /dev/null differ diff --git a/config/cmake_ext_mod/hdf.ico b/config/cmake_ext_mod/hdf.ico deleted file mode 100644 index 26abc96..0000000 Binary files a/config/cmake_ext_mod/hdf.ico and /dev/null differ diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake deleted file mode 100644 index b373fe4..0000000 --- a/config/cmake_ext_mod/runTest.cmake +++ /dev/null @@ -1,381 +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://www.hdfgroup.org/licenses. -# 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 -# against a reference file. Exit status of command can also be compared. -cmake_policy(SET CMP0007 NEW) - -# arguments checking -if (NOT TEST_PROGRAM) - message (FATAL_ERROR "Require TEST_PROGRAM to be defined") -endif () -if (NOT TEST_FOLDER) - message (FATAL_ERROR "Require TEST_FOLDER to be defined") -endif () -if (NOT TEST_OUTPUT) - message (FATAL_ERROR "Require TEST_OUTPUT to be defined") -endif () -if (NOT TEST_EXPECT) - message (STATUS "Require TEST_EXPECT to be defined") -endif () - -if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") - file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) -endif () - -if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") - file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) -endif () - -message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") - -if (TEST_LIBRARY_DIRECTORY) - if (WIN32) - set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") - else () - set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") - endif () -endif () - -if (TEST_ENV_VAR) - set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") - #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") -endif () - -if (NOT TEST_INPUT) - # run the test program, capture the stdout/stderr and the result var - execute_process ( - COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_OUT - ERROR_VARIABLE TEST_ERROR - ) -else () - # run the test program with stdin, capture the stdout/stderr and the result var - execute_process ( - COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} - WORKING_DIRECTORY ${TEST_FOLDER} - RESULT_VARIABLE TEST_RESULT - INPUT_FILE ${TEST_INPUT} - OUTPUT_FILE ${TEST_OUTPUT} - ERROR_FILE ${TEST_OUTPUT}.err - OUTPUT_VARIABLE TEST_OUT - ERROR_VARIABLE TEST_ERROR - ) -endif () - -if (TEST_REGEX) - # TEST_REGEX should always be matched - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT) - if (NOT REGEX_RESULT) - message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}") - endif () -endif () - -message (STATUS "COMMAND Result: ${TEST_RESULT}") - -# if the .err file exists and ERRROR_APPEND is enabled -if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - list (LENGTH TEST_STREAM test_len) - if (test_len GREATER 0) - if (TEST_MASK_FILE) - STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") - endif () - # remove special output - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - - if (NOT ERROR_APPEND) - # write back to original .err file - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - else () - # append error output to the stdout output file - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - endif () - endif () -endif () - -# append the test result status with a predefined text -if (TEST_APPEND) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") -endif () - -# if the return value is !=${TEST_EXPECT} bail out -if (NOT TEST_RESULT EQUAL TEST_EXPECT) - if (NOT TEST_NOERRDISPLAY) - if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - message (STATUS "Output :\n${TEST_STREAM}") - endif () - endif () - message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") -endif () - -message (STATUS "COMMAND Error: ${TEST_ERROR}") - -# remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) -endif () - -# remove special error output -if (NOT TEST_ERRREF) - # the error stack has been appended to the output file - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -else () - # the error stack remains in the .err file - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) -endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - # write back the changes to the original files - if (NOT TEST_ERRREF) - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else () - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif () -endif () - -# if the output file needs Storage text removed -if (TEST_MASK) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - string (REGEX REPLACE "Storage:[^\n]+\n" "Storage:
\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif () - -# if the output file needs Modified text removed -if (TEST_MASK_MOD) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - string (REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif () - -# if the output file or the .err file needs to mask out error stack info -if (TEST_MASK_ERROR) - if (NOT TEST_ERRREF) - # the error stack has been appended to the output file - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else () - # the error stack remains in the .err file - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - endif () - string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - # write back the changes to the original files - if (NOT TEST_ERRREF) - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else () - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif () -endif () - -# remove text from the output file -if (TEST_FILTER) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - string (REGEX REPLACE "${TEST_FILTER}" "${TEST_FILTER_REPLACE}" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif () - -if (TEST_REF_FILTER) - #message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}") - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - string (REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") -endif () - -# compare output files to references unless this must be skipped -set (TEST_COMPARE_RESULT 0) -if (NOT TEST_SKIP_COMPARE) - if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - list (LENGTH TEST_STREAM test_len) - if (test_len GREATER 0) - if (WIN32) - configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) - if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp") - file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) - endif () - #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") - endif () - - if (NOT TEST_SORT_COMPARE) - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_COMPARE_RESULT - ) - else () - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) - list (SORT v1) - list (SORT v2) - if (NOT v1 STREQUAL v2) - set (TEST_COMPARE_RESULT 1) - endif () - endif () - - if (TEST_COMPARE_RESULT) - set (TEST_COMPARE_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) - list (LENGTH test_ref len_ref) - if (NOT len_act EQUAL len_ref) - set (TEST_COMPARE_RESULT 1) - endif () - if (len_act GREATER 0 AND len_ref GREATER 0) - if (TEST_SORT_COMPARE) - list (SORT test_act) - list (SORT test_ref) - endif () - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_COMPARE_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif () - endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") - endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") - endif () - endif () - endif () - endif () - - message (STATUS "COMPARE Result: ${TEST_COMPARE_RESULT}") - - # again, if return value is !=0 scream and shout - if (TEST_COMPARE_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") - endif () - endif () - - # now compare the .err file with the error reference, if supplied - set (TEST_ERRREF_RESULT 0) - if (TEST_ERRREF) - file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - list (LENGTH TEST_STREAM test_len) - if (test_len GREATER 0) - if (WIN32) - configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) - if (EXISTS "${TEST_FOLDER}/${TEST_ERRREF}.tmp") - file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) - endif () - #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") - endif () - - # now compare the error output with the error reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_IGNORE_EOL} ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} - RESULT_VARIABLE TEST_ERRREF_RESULT - ) - if (TEST_ERRREF_RESULT) - set (TEST_ERRREF_RESULT 0) - file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) - list (LENGTH test_act len_act) - file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) - list (LENGTH test_ref len_ref) - math (EXPR _FP_LEN "${len_ref} - 1") - if (len_act GREATER 0 AND len_ref GREATER 0) - math (EXPR _FP_LEN "${len_ref} - 1") - foreach (line RANGE 0 ${_FP_LEN}) - list (GET test_act ${line} str_act) - list (GET test_ref ${line} str_ref) - if (NOT str_act STREQUAL str_ref) - if (str_act) - set (TEST_ERRREF_RESULT 1) - message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") - endif () - endif () - endforeach () - else () - if (len_act EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty") - endif () - if (len_ref EQUAL 0) - message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty") - endif () - endif () - if (NOT len_act EQUAL len_ref) - set (TEST_ERRREF_RESULT 1) - endif () - endif () - endif () - - message (STATUS "COMPARE Result: ${TEST_ERRREF_RESULT}") - - # again, if return value is !=0 scream and shout - if (TEST_ERRREF_RESULT) - message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") - endif () - endif () -endif () - -set (TEST_GREP_RESULT 0) -if (TEST_GREP_COMPARE) - # now grep the output with the reference - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - list (LENGTH TEST_STREAM test_len) - if (test_len GREATER 0) - # TEST_REFERENCE should always be matched - string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_GREP_RESULT) - if (NOT TEST_GREP_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") - endif () - - string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) - if (TEST_EXPECT) - # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match - string (LENGTH "${TEST_MATCH}" TEST_GREP_RESULT) - if (TEST_GREP_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") - endif () - endif () - endif () -endif () - -# dump the output unless nodisplay option is set -if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - execute_process ( - COMMAND ${CMAKE_COMMAND} -E echo ${TEST_STREAM} - RESULT_VARIABLE TEST_RESULT - ) -endif () - -# everything went fine... -message (STATUS "${TEST_PROGRAM} Passed") - diff --git a/config/cmake_ext_mod/version.plist.in b/config/cmake_ext_mod/version.plist.in deleted file mode 100644 index 817d89e..0000000 --- a/config/cmake_ext_mod/version.plist.in +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - BuildVersion - @CPACK_PACKAGE_VERSION_MAJOR@ - CFBundleShortVersionString - @CPACK_APPLE_GUI_SHORT_VERSION_STRING@ - CFBundleVersion - @CPACK_APPLE_GUI_SHORT_VERSION_STRING@ - ProjectName - @CPACK_APPLE_GUI_BUNDLE_NAME@ - SourceVersion - @CPACK_PACKAGE_VERSION_MINOR@ - - diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 3e24ba0..6c84d1d 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -85,7 +85,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=${example}.txt" #-D "TEST_REFERENCE=${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) @@ -115,7 +115,7 @@ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND NOT WIN32) -D "TEST_REFERENCE:STRING=PHDF5 example finished with no errors" #-D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () if (last_test) diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index e59d6f8..09b3fa0 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -55,7 +55,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=f90_ex_${example}.txt" #-D "TEST_REFERENCE=f90_ex_${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) @@ -78,7 +78,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=f03_ex_${example}.txt" #-D "TEST_REFERENCE=f03_ex_${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index d143539..b27e550 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -73,7 +73,7 @@ else () -D "TEST_OUTPUT=testhdf5_fortran.txt" #-D "TEST_REFERENCE=testhdf5_fortran.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () #set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") @@ -96,7 +96,7 @@ else () -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt" #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () #set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") @@ -120,7 +120,7 @@ else () -D "TEST_OUTPUT=fortranlib_test_F03.txt" #-D "TEST_REFERENCE=fortranlib_test_F03.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () # set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index 82b32cf..7564fd7 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -36,7 +36,7 @@ else () -D "TEST_OUTPUT=ptExampleFL.txt" #-D "TEST_REFERENCE=ptExampleFL.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (HL_CPP_ex_ptExampleFL PROPERTIES DEPENDS HL_CPP_ex_ptExampleFL-clear-objects) diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index 28ee5df..5abbd47 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -33,7 +33,7 @@ else () -D "TEST_OUTPUT=hl_ptableTest.txt" #-D "TEST_REFERENCE=hl_ptableTest.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (HL_CPP_ptableTest PROPERTIES DEPENDS HL_CPP_ptableTest-clear-objects) diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index b997096..6014f6c 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -66,7 +66,7 @@ foreach (example ${examples}) -D "TEST_OUTPUT=hl_ex_${example}.txt" #-D "TEST_REFERENCE=hl_ex_${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () if (last_test) diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 2e73ad9..6389fbe 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -39,7 +39,7 @@ foreach (example ${examples}) -D "TEST_OUTPUT=hl_f90_ex_${example}.txt" #-D "TEST_REFERENCE=hl_f90_ex_${example}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index bceb6ee..463ac07 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -17,10 +17,10 @@ ############################################################################## set (test_hl_fortran_CLEANFILES - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 dsetf5.h5 f1img.h5 f1tab.h5 @@ -49,7 +49,7 @@ macro (ADD_H5_FORTRAN_TEST file) -D "TEST_OUTPUT=hl_f90_${file}.txt" #-D "TEST_REFERENCE=hl_f90_${file}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 44208e3..ba4bb86 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -97,7 +97,7 @@ macro (HL_ADD_TEST hl_name) -D "TEST_OUTPUT=hl_${hl_name}.txt" #-D "TEST_REFERENCE=hl_${hl_name}.out" -D "TEST_FOLDER=${HDF5_HL_TEST_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (HL_${hl_name} PROPERTIES diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index b2f689b..32b2b95 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -80,7 +80,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test} @@ -103,7 +103,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test} @@ -131,7 +131,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5WATCH-${resultfile} PROPERTIES DEPENDS H5WATCH-${resultfile}-clear-objects diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 5c79bd3..af1aaff 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.12) project (HDF5_JAVA C Java) -set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}") +set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR}") find_package (Java) #----------------------------------------------------------------------------- diff --git a/m4/aclocal_cxx.m4 b/m4/aclocal_cxx.m4 index 662d260..1a24599 100644 --- a/m4/aclocal_cxx.m4 +++ b/m4/aclocal_cxx.m4 @@ -26,7 +26,7 @@ dnl have a [PAC] prefix. dnl Checking if C++ needs old style header files in includes AC_DEFUN([PAC_PROG_CXX_HEADERS],[ AC_MSG_CHECKING([if $CXX needs old style header files in includes]) - TEST_SRC="`(echo \"#define OLD_HEADER_FILENAME 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" + TEST_SRC="`(echo \"#define OLD_HEADER_FILENAME 1\"; cat $srcdir/config/cmake/HDFCXXTests.cpp)`" AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([no])], @@ -38,7 +38,7 @@ AC_DEFUN([PAC_PROG_CXX_HEADERS],[ dnl Checking if ++ can handle namespaces AC_DEFUN([PAC_PROG_CXX_NAMESPACE],[ AC_MSG_CHECKING([if $CXX can handle namespaces]) - TEST_SRC="`(echo \"#define HDF_NO_NAMESPACE 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" + TEST_SRC="`(echo \"#define HDF_NO_NAMESPACE 1\"; cat $srcdir/config/cmake/HDFCXXTests.cpp)`" AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) @@ -49,7 +49,7 @@ AC_DEFUN([PAC_PROG_CXX_NAMESPACE],[ dnl Checking if C++ supports std AC_DEFUN([PAC_PROG_CXX_STD],[ AC_MSG_CHECKING([if $CXX supports std]) - TEST_SRC="`(echo \"#define HDF_NO_STD 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" + TEST_SRC="`(echo \"#define HDF_NO_STD 1\"; cat $srcdir/config/cmake/HDFCXXTests.cpp)`" AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) @@ -60,7 +60,7 @@ AC_DEFUN([PAC_PROG_CXX_STD],[ dnl Checking if C++ has offsetof extension AC_DEFUN([PAC_PROG_CXX_OFFSETOF],[ AC_MSG_CHECKING([if $CXX has offsetof extension]) - TEST_SRC="`(echo \"#define CXX_HAVE_OFFSETOF 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" + TEST_SRC="`(echo \"#define CXX_HAVE_OFFSETOF 1\"; cat $srcdir/config/cmake/HDFCXXTests.cpp)`" AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],[AC_MSG_RESULT([yes]) AC_DEFINE([CXX_HAVE_OFFSETOF], [1], [Define if C++ compiler recognizes offsetof])], @@ -70,7 +70,7 @@ AC_DEFUN([PAC_PROG_CXX_OFFSETOF],[ dnl Checking if C++ can handle static cast AC_DEFUN([PAC_PROG_CXX_STATIC_CAST],[ AC_MSG_CHECKING([if $CXX can handle static cast]) - TEST_SRC="`(echo \"#define NO_STATIC_CAST 1\"; cat $srcdir/config/cmake_ext_mod/HDFCXXTests.cpp)`" + TEST_SRC="`(echo \"#define NO_STATIC_CAST 1\"; cat $srcdir/config/cmake/HDFCXXTests.cpp)`" AC_LINK_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index eefdc48..6ee9981 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -114,7 +114,7 @@ foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) endforeach () # -------------------------------------------------------------------- -#-- Copy all the HDF5 files from the test directory into the source directory +#-- Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- set (HDF5_REFERENCE_TEST_FILES aggr.h5 @@ -497,7 +497,7 @@ foreach (h5_test ${H5_TESTS}) -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" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-${h5_test} PROPERTIES @@ -534,7 +534,7 @@ if (NOT CYGWIN) -D "TEST_OUTPUT=cache.txt" #-D "TEST_REFERENCE=cache.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-cache PROPERTIES @@ -591,7 +591,7 @@ else () -D "TEST_OUTPUT=external_env.txt" #-D "TEST_REFERENCE=external_env.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-external_env PROPERTIES @@ -625,7 +625,7 @@ else () -D "TEST_OUTPUT=vds_env.txt" #-D "TEST_REFERENCE=vds_env.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-vds_env PROPERTIES @@ -660,7 +660,7 @@ else () -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=flush1.txt" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-flush1 PROPERTIES @@ -679,7 +679,7 @@ else () -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=flush2.txt" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-flush2 PROPERTIES @@ -776,7 +776,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS AND NOT MINGW) -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -793,7 +793,7 @@ else () -D "TEST_OUTPUT=err_compat.txt" -D "TEST_REFERENCE=err_compat_2" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -813,7 +813,7 @@ if (DEFAULT_API_VERSION MATCHES "v16" OR MINGW) -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_2" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" @@ -830,7 +830,7 @@ else () -D "TEST_OUTPUT=error_test.txt" -D "TEST_REFERENCE=error_test_1" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" @@ -861,7 +861,7 @@ else () -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" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5TEST-links_env PROPERTIES diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 154ca15..12d8a52 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -242,7 +242,7 @@ -D "TEST_REFERENCE=./testfiles/${testname}.out" -D "TEST_ERRREF=./testfiles/${testname}.err" -D "TEST_MASK=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects) endif () @@ -270,7 +270,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) else () add_test ( @@ -287,7 +287,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5COPY_UD-${testname} PROPERTIES DEPENDS H5COPY_UD-${testname}-clear-objects) @@ -305,7 +305,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD-${testname}) endif () @@ -334,7 +334,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) else () add_test ( @@ -352,7 +352,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5COPY_UD_ERR-${testname} PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}-clearall-objects) @@ -370,7 +370,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD_ERR-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}) endif () diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index ce82968..5b21d80 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -394,7 +394,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" -D "TEST_APPEND=EXIT CODE:" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) if (last_test) set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) @@ -427,7 +427,7 @@ -D "TEST_REF_APPEND=EXIT CODE: [0-9]" -D "TEST_REF_FILTER=EXIT CODE: 0" -D "TEST_SORT_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) if (last_test) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) @@ -453,7 +453,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) else () add_test ( @@ -470,7 +470,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () if (last_test) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 509d29a..525af97 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -423,7 +423,7 @@ -D "TEST_OUTPUT=h5dump-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=h5dump-${testname}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -472,7 +472,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () @@ -505,7 +505,7 @@ -D "TEST_OUTPUT=${resultfile}-N.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}-N.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS "H5DUMP-N-${resultfile}-clear-objects") endif () @@ -538,7 +538,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") add_test ( @@ -579,7 +579,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") add_test ( @@ -632,7 +632,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -649,7 +649,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${result_check}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () endmacro () @@ -667,7 +667,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_ERRREF=${result_errcheck}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () endmacro () @@ -687,7 +687,7 @@ -D "TEST_ERRREF=${result_errcheck}" -D "TEST_ENV_VAR:STRING=${envvar}" -D "TEST_ENV_VALUE:STRING=${envval}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) endif () endmacro () @@ -712,7 +712,7 @@ -D "TEST_OUTPUT=${conffile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${conffile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) @@ -739,7 +739,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 0c3297f..3c188c4 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -141,7 +141,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 88df9ad..31624e6 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -137,7 +137,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -169,7 +169,7 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -196,7 +196,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index d735257..a8083fb 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -195,7 +195,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.xml" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 00a28bb..5b8c51f 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -124,7 +124,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") set (last_test "H5FC-${testname}-${testfile}") @@ -139,7 +139,7 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") set (last_test "H5FC-${testname}-NA") @@ -172,7 +172,7 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") set (last_test "H5FC-${testname}-${testfile}") @@ -205,7 +205,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" -D "TEST_ERRREF=${result_errcheck}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") set (last_test "H5FC-${testname}-${testfile}") @@ -237,7 +237,7 @@ -D "TEST_OUTPUT=testfiles/${testname}.out" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_EXPECT=${resultcode}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") set (last_test "H5FC-${testname}") @@ -280,7 +280,7 @@ -D "TEST_OUTPUT=testfiles/${testname}.out" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_EXPECT=${resultcode}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") add_test ( @@ -317,7 +317,7 @@ -D "TEST_OUTPUT=testfiles/${testname}.out" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_EXPECT=0" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") add_test ( @@ -330,7 +330,7 @@ -D "TEST_OUTPUT=testfiles/${testname}_chk.out" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=testfiles/${testname}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5FC_CHECK_DUMP-${testname} PROPERTIES DEPENDS "H5FC-${testname}") set (last_test "H5FC_CHECK_DUMP-${testname}") diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index ee1d401..81ebc4a 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -128,7 +128,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname} @@ -144,7 +144,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_REFERENCE=${testfile}.new" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP @@ -176,7 +176,7 @@ -D "TEST_OUTPUT=d${testfile}.dmp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) else () add_test ( @@ -189,7 +189,7 @@ -D "TEST_OUTPUT=d${testfile}.dmp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES @@ -206,7 +206,7 @@ -D "TEST_OUTPUT=d${testfile}.imp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP" @@ -223,7 +223,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(Warning)[^\n]*)" -D "TEST_REFERENCE=testfiles/d${testfile}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}" @@ -254,7 +254,7 @@ -D "TEST_OUTPUT=${testname}.dmp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-clear-objects" @@ -270,7 +270,7 @@ -D "TEST_OUTPUT=${testname}.imp" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5IMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5DMP" @@ -285,7 +285,7 @@ -D "TEST_OUTPUT=d-${testname}.dmp" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=testfiles/${testname}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-CMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP" diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 82d99b7..e19ec86 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -71,7 +71,7 @@ -D "TEST_ERRREF=testfiles/${expectfile}.txt" -D "TEST_SKIP_COMPARE=1" -D "TEST_REFERENCE=testfiles/${expectfile}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -98,7 +98,7 @@ -D "TEST_OUTPUT=${expectfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=testfiles/${expectfile}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -117,7 +117,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS ${testdepends}) add_test ( @@ -131,7 +131,7 @@ -D "TEST_EXPECT=0" -D "TEST_FILTER=(^(HDF5)[^\n]*)" -D "TEST_REFERENCE=${actual}.new" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP_CMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-H5DMP) endif () @@ -174,7 +174,7 @@ -D "TEST_OUTPUT=${outfile}.ufile.txt" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index cd2f764..34f8e6f 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -154,7 +154,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -179,7 +179,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -199,7 +199,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index e93e7e7..5ef21ab 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -99,7 +99,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -128,7 +128,7 @@ -D "TEST_REFERENCE=vds/prefix/${resultfile}.ls" -D "TEST_ENV_VAR=HDF5_VDS_PREFIX" -D "TEST_ENV_VALUE=\${ORIGIN}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index d44c856..a920c19 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -230,7 +230,7 @@ -D "TEST_OUTPUT=h5repack-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=h5repack-${testname}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES @@ -341,7 +341,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=${resultfile}-${testname}.tst" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS H5REPACK_CMP-${testname}-clear-objects @@ -389,7 +389,7 @@ -D "TEST_SKIP_COMPARE=true" -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${result_errcheck}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) endif () @@ -431,7 +431,7 @@ -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${testname}.${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}" @@ -474,7 +474,7 @@ -D "TEST_OUTPUT=out-${testname}.${testfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${testname}.${testfile}.tst" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_DIFF-${testname}_DFF PROPERTIES DEPENDS H5REPACK_DIFF-${testname} @@ -517,7 +517,7 @@ -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${statarg}.${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_STAT-h5stat-${testname} PROPERTIES DEPENDS "H5REPACK_STAT-${testname}" @@ -570,7 +570,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=${testfilter}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF @@ -596,7 +596,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=${nottestfilter}" -D "TEST_REFERENCE=${testfilter}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF @@ -643,7 +643,7 @@ -D "TEST_OUTPUT=${testfile}-${testname}-v.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${testfile}-${testname}-v.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -681,7 +681,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_FILTER:STRING=SUPERBLOCK_VERSION ${superblock}" -D "TEST_REFERENCE=SUPERBLOCK_VERSION ${superblock}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + -P "${HDF_RESOURCES_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname} @@ -739,7 +739,7 @@ -D "TEST_OUTPUT=out-${testname}_N.${testname}.out" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=out-${testname}_N.${testname}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_META-${testname}_N_DFF PROPERTIES DEPENDS H5REPACK_META-${testname}_N @@ -761,7 +761,7 @@ -D "TEST_OUTPUT=out-${testname}_M.${testname}.out" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=out-${testname}_M.${testname}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_META-${testname}_M_DFF PROPERTIES DEPENDS H5REPACK_META-${testname}_M @@ -808,7 +808,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects @@ -826,7 +826,7 @@ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}" diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index d4238b5..c79c0a1 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -111,7 +111,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -135,7 +135,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 198a363..5e307aa 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -97,7 +97,7 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -115,7 +115,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () endmacro () @@ -144,7 +144,7 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname} @@ -177,7 +177,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" -D "TEST_ERRREF=${resultfile}.err" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname} @@ -222,7 +222,7 @@ -D "TEST_OUTPUT=${testname}_before_size.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}_before_size.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname} @@ -253,7 +253,7 @@ -D "TEST_OUTPUT=${testname}_after_size.out" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=${resultfile}_after_size.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_INCR-${testname} @@ -285,7 +285,7 @@ -D "TEST_OUTPUT=${testname}_before_size.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.mty" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} @@ -315,7 +315,7 @@ -D "TEST_OUTPUT=${testname}_after_size.out" -D "TEST_EXPECT=0" -D "TEST_REFERENCE=${resultfile}_after_size.ddl" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5CLEAR_FILESIZE_FAIL_CMP-${testname}_after_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_FAIL_INCR-${testname} diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index 11c9fdf..b4d1a56 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -87,7 +87,7 @@ -D "TEST_EXPECT=${resultcode}" -D "TEST_MASK_MOD=true" -D "TEST_REFERENCE=${resultfile}.ls" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile}) endif () @@ -114,7 +114,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.txt" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 73b2260..17f4b48 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -64,7 +64,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=h5perf_serial.txt" #-D "TEST_REFERENCE=h5perf_serial.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_h5perf_serial PROPERTIES @@ -88,7 +88,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=chunk.txt" #-D "TEST_REFERENCE=chunk.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_chunk PROPERTIES @@ -107,7 +107,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=iopipe.txt" #-D "TEST_REFERENCE=iopipe.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_iopipe PROPERTIES @@ -126,7 +126,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=overhead.txt" #-D "TEST_REFERENCE=overhead.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_overhead PROPERTIES @@ -145,7 +145,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=perf_meta.txt" #-D "TEST_REFERENCE=perf_meta.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_perf_meta PROPERTIES @@ -164,7 +164,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=zip_perf-h.txt" #-D "TEST_REFERENCE=zip_perf-h.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_zip_perf_help PROPERTIES @@ -183,7 +183,7 @@ if (HDF5_TEST_SERIAL) -D "TEST_OUTPUT=zip_perf.txt" #-D "TEST_REFERENCE=zip_perf.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_DIR}/runTest.cmake" ) endif () set_tests_properties (PERFORM_zip_perf PROPERTIES -- cgit v0.12