diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/cmake/H5pubconf.h.in | 9 | ||||
-rw-r--r-- | config/cmake/HDFCXXCompilerFlags.cmake | 54 | ||||
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 2 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFUseCXX.cmake | 74 | ||||
-rw-r--r-- | config/sanitizer/sanitizers.cmake | 2 |
5 files changed, 48 insertions, 93 deletions
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 6329cbc..a8c9596 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -289,6 +289,9 @@ /* Define to 1 if you have the <pthread.h> header file. */ #cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@ +/* Define to 1 if you have the <pwd.h> header file. */ +#cmakedefine H5_HAVE_PWD_H @H5_HAVE_PWD_H@ + /* Define to 1 if you have the <quadmath.h> header file. */ #cmakedefine H5_HAVE_QUADMATH_H @H5_HAVE_QUADMATH_H@ @@ -670,15 +673,15 @@ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #cmakedefine H5_TIME_WITH_SYS_TIME @H5_TIME_WITH_SYS_TIME@ -/* Define using v1.10 public API symbols by default */ -#cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ - /* Define using v1.6 public API symbols by default */ #cmakedefine H5_USE_16_API_DEFAULT @H5_USE_16_API_DEFAULT@ /* Define using v1.8 public API symbols by default */ #cmakedefine H5_USE_18_API_DEFAULT @H5_USE_18_API_DEFAULT@ +/* Define using v1.10 public API symbols by default */ +#cmakedefine H5_USE_110_API_DEFAULT @H5_USE_110_API_DEFAULT@ + /* Define if the library will use file locking */ #cmakedefine H5_USE_FILE_LOCKING @H5_USE_FILE_LOCKING@ diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index a7e241b..38db636 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -9,10 +9,10 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -set(CMAKE_CXX_STANDARD 98) -set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set (CMAKE_CXX_STANDARD 98) +set (CMAKE_CXX_STANDARD_REQUIRED TRUE) -set(CMAKE_CXX_EXTENSIONS OFF) +set (CMAKE_CXX_EXTENSIONS OFF) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_SANITIZER_FLAGS} ${CMAKE_CXX_FLAGS}") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") @@ -21,30 +21,34 @@ endif () #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- -if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(_INTEL_WINDOWS 1) -endif() +if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (_INTEL_WINDOWS 1) +endif () -if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" +if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") - set(_CLANG_MSVC_WINDOWS 1) + set (_CLANG_MSVC_WINDOWS 1) endif() # MSVC 14.28 enables C5105, but the Windows SDK 10.0.18362.0 triggers it. -if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") -endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.28) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd5105") + endif () +endif () -if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND - NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) - if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") - endif() - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") - endif() -endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND CMAKE_CXX_COMPILER_LOADED) + if (NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) + if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") + endif () + else () + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4") + endif () + endif () +endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}") @@ -299,7 +303,7 @@ endif () # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- if (HDF5_ENABLE_SYMBOLS MATCHES "YES") - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -307,7 +311,7 @@ if (HDF5_ENABLE_SYMBOLS MATCHES "YES") endif () endif () elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-s") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -321,7 +325,7 @@ endif () # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- if (HDF5_ENABLE_PROFILING) - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) list (APPEND HDF5_CMAKE_CXX_FLAGS "${PROFILE_CXXFLAGS}") endif () endif () @@ -331,7 +335,7 @@ endif () # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- if (HDF5_ENABLE_OPTIMIZATION) - if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_LOADED) list (APPEND HDF5_CMAKE_CXX_FLAGS "${OPTIMIZE_CXXFLAGS}") endif () endif () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 36228fc..8244a8d 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -116,7 +116,7 @@ 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 ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) - +CHECK_INCLUDE_FILE_CONCAT ("pwd.h" ${HDF_PREFIX}_HAVE_PWD_H) 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) diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake index 423f74a..fcd3ba6 100644 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -32,68 +32,16 @@ endif () include (CheckIncludeFileCXX) include (TestForSTDNamespace) -# For other CXX specific tests, use this MACRO. -macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) - if (NOT DEFINED ${OTHER_TEST}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (HDF5_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}") - endif () - - foreach (def - HAVE_SYS_TIME_H - HAVE_UNISTD_H - HAVE_SYS_TYPES_H - HAVE_SYS_SOCKET_H - HAVE_SYS_FILE_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}/HDFCXXTests.cpp - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (${OTHER_TEST} EQUAL 0) - set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing CXX Test ${OTHER_TEST} - Success") - endif () - else () - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Performing CXX Test ${OTHER_TEST} - Failed") - endif () - set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" - "${OUTPUT}\n" - ) - endif () +# 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 () -endmacro () - -#----------------------------------------------------------------------------- -# Check a bunch of cxx functions -#----------------------------------------------------------------------------- -if (CMAKE_CXX_COMPILER_LOADED) - foreach (cxx_test - CXX_HAVE_OFFSETOF - ) - HDF_CXX_FUNCTION_TEST (${cxx_test}) - endforeach () endif () + +#Always define +set (${HDF_PREFIX}_CXX_HAVE_OFFSETOF 1) diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index 22b9e3c..58c4050 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -80,7 +80,7 @@ if(USE_SANITIZER) message( FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") endif() - elseif(MSVC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.29) + elseif(MSVC) if(USE_SANITIZER MATCHES "([Aa]ddress)") message(STATUS "Building with Address sanitizer") append("/fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) |