diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-10-04 22:01:22 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-10-04 22:01:22 (GMT) |
commit | ea2a969ce2a3a7dea80fcb2e5798da9307f04937 (patch) | |
tree | ad527940781662c5e3356b59ba6f8ac4b3bbb6ef /config | |
parent | 9c29c871281221a9f018b7d7b81af41d313c20cd (diff) | |
parent | a9e9cc29184b3b19d1161246264d722d731b5ec2 (diff) | |
download | hdf5-ea2a969ce2a3a7dea80fcb2e5798da9307f04937.zip hdf5-ea2a969ce2a3a7dea80fcb2e5798da9307f04937.tar.gz hdf5-ea2a969ce2a3a7dea80fcb2e5798da9307f04937.tar.bz2 |
Merge pull request #1279 in HDFFV/hdf5 from ~BYRN/hdf5_merge_adb:hdf5_1_10 to hdf5_1_10
* commit 'a9e9cc29184b3b19d1161246264d722d731b5ec2':
Fix typos and examples versions
HDFFV-10575, 10332, 10531, 10594 and TRILAB-21
Diffstat (limited to 'config')
-rw-r--r-- | config/cmake/HDF518_Examples.cmake.in | 2 | ||||
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 147 | ||||
-rw-r--r-- | config/cmake/HDF5_Examples.cmake.in | 2 | ||||
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 77 | ||||
-rwxr-xr-x | config/cmake/scripts/HDF5options.cmake | 5 | ||||
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 48 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFLibMacros.cmake | 9 | ||||
-rw-r--r-- | config/intel.cmake | 10 |
8 files changed, 162 insertions, 138 deletions
diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index 1f4f479..ba79ef2 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -48,7 +48,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${ ################################################################## if(NOT DEFINED INSTALLDIR) - set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") + set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@") endif() if(NOT DEFINED CTEST_SOURCE_NAME) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 1f66bad..157befd 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -31,69 +31,53 @@ endif () # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) -# -# if (NOT DEFINED ${RUN_RESULT_VAR}) - message (STATUS "Detecting Fortran ${FUNCTION}") - if (CMAKE_REQUIRED_LIBRARIES) - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else () - set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) - endif () +macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR) + message (STATUS "Detecting Fortran ${FUNCTION_NAME}") file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - "${CODE}" + "${SOURCE_CODE}" ) TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 - CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" ) - set(${RETURN} ${OUTPUT}) - - #message ( "Test result1 ${RETURN} ") - #message ( "Test result3 ${RESULT} ") - #message ( "Test result2 ${CMAKE_MATCH_0} ") - #message ( "Test result4 ${CMAKE_MATCH_1} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test result2 ${COMPILE_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test result1 ${RUN_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - if (${COMPILE_RESULT_VAR}) + set(${RETURN_VAR} ${RUN_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 0) - message (STATUS "Testing Fortran ${FUNCTION} - OK") + message (STATUS "Testing Fortran ${FUNCTION_NAME} - OK") 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" + "Determining if the Fortran ${FUNCTION_NAME} exists passed\n" ) else () - message (STATUS "Testing Fortran ${FUNCTION} - Fail") + message (STATUS "Testing Fortran ${FUNCTION_NAME} - Fail") 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") + "Determining if the Fortran ${FUNCTION_NAME} exists failed: ${RUN_RESULT_VAR}\n" + ) endif () + else () + message (STATUS "Compiling Fortran ${FUNCTION_NAME} - Fail") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran ${FUNCTION_NAME} compiles failed: ${COMPILE_RESULT_VAR}\n" + ) + set(${RETURN_VAR} ${COMPILE_RESULT_VAR}) endif () -# endif () endmacro () # Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END" -macro (READ_SOURCE START END RETURN) - file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" CODE) - string (REGEX MATCH "${START}[\\\t\\\n\\\r[].+]*${END}" CODE ${CODE}) - set (RETURN "${CODE}") +macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR) + file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_CODE) + string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_CODE}) + set (RETURN_VAR "${SOURCE_CODE}") endmacro () #----------------------------------------------------------------------------- # Check to see C_LONG_DOUBLE is available -READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" CODE) +READ_SOURCE("PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" "END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE" SOURCE_CODE) CHECK_FORTRAN_FEATURE(c_long_double - "${CODE}" + "${SOURCE_CODE}" FORTRAN_HAVE_C_LONG_DOUBLE ) @@ -105,9 +89,9 @@ endif () # Check to see C_LONG_DOUBLE is different from C_DOUBLE -READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" CODE) +READ_SOURCE("MODULE type_mod" "END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE" SOURCE_CODE) CHECK_FORTRAN_FEATURE(c_long_double - "${CODE}" + "${SOURCE_CODE}" FORTRAN_C_LONG_DOUBLE_IS_UNIQUE ) if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) @@ -133,12 +117,12 @@ endif () # Determine the available KINDs for REALs and INTEGERs #----------------------------------------------------------------------------- -READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" CODE) +READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) FORTRAN_RUN ("REAL and INTEGER KINDs" - "${CODE}" - XX - YY - PROG_OUTPUT + "${SOURCE_CODE}" + XX + YY + PROG_RESULT ) # dnl The output from the above program will be: # dnl -- LINE 1 -- valid integer kinds (comma seperated list) @@ -197,15 +181,18 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE INTEGER (KIND=${KIND}) a - WRITE(*,'(I0)') ${FC_SIZEOF_A} + OPEN(8,FILE='pac_validIntKinds.out',FORM='formatted') + WRITE(8,'(I0)') ${FC_SIZEOF_A} + CLOSE(8) END " ) FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC} - XX - YY - PROG_OUTPUT1 + XX + YY + PROG_RESULT1 ) + file (READ "${CMAKE_BINARY_DIR}/pac_validIntKinds.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -241,15 +228,18 @@ foreach (KIND ${VAR} ) USE ISO_C_BINDING IMPLICIT NONE REAL (KIND=${KIND}) a - WRITE(*,'(I0)') ${FC_SIZEOF_A} + OPEN(8,FILE='pac_validRealKinds.out',FORM='formatted') + WRITE(8,'(I0)') ${FC_SIZEOF_A} + CLOSE(8) END " ) FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC} - XX - YY - PROG_OUTPUT1 + XX + YY + PROG_RESULT1 ) + file (READ "${CMAKE_BINARY_DIR}/pac_validRealKinds.out" PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -288,18 +278,21 @@ FORTRAN_RUN ("SIZEOF NATIVE KINDs" INTEGER a REAL b DOUBLE PRECISION c - WRITE(*,*) ${FC_SIZEOF_A} - WRITE(*,*) kind(a) - WRITE(*,*) ${FC_SIZEOF_B} - WRITE(*,*) kind(b) - WRITE(*,*) ${FC_SIZEOF_C} - WRITE(*,*) kind(c) + OPEN(8,FILE='pac_sizeof_native_kinds.out',FORM='formatted') + WRITE(8,*) ${FC_SIZEOF_A} + WRITE(8,*) kind(a) + WRITE(8,*) ${FC_SIZEOF_B} + WRITE(8,*) kind(b) + WRITE(8,*) ${FC_SIZEOF_C} + WRITE(8,*) kind(c) + CLOSE(8) END " - XX - YY - PROG_OUTPUT -) + XX + YY + PROG_RESULT + ) + file (READ "${CMAKE_BINARY_DIR}/pac_sizeof_native_kinds.out" PROG_OUTPUT) # dnl The output from the above program will be: # dnl -- LINE 1 -- sizeof INTEGER # dnl -- LINE 2 -- kind of INTEGER @@ -372,8 +365,8 @@ ENABLE_LANGUAGE (C) # The provided CMake C macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (C_RUN FUNCTION CODE RETURN) - message (STATUS "Detecting C ${FUNCTION}") +macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) + message (STATUS "Detecting C ${FUNCTION_NAME}") if (CMAKE_REQUIRED_LIBRARIES) set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") @@ -382,16 +375,16 @@ macro (C_RUN FUNCTION CODE RETURN) endif () file (WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c - ${CODE} + ${SOURCE_CODE} ) TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" - RUN_OUTPUT_VARIABLE OUTPUT + RUN_OUTPUT_VARIABLE OUTPUT_VAR ) - set (${RETURN} ${OUTPUT}) + set (${RETURN_VAR} ${OUTPUT_VAR}) #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") @@ -401,21 +394,21 @@ macro (C_RUN FUNCTION CODE RETURN) if (${COMPILE_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 1) - set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION}") - message (STATUS "Testing C ${FUNCTION} - OK") + set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") + message (STATUS "Testing C ${FUNCTION_NAME} - OK") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the C ${FUNCTION} exists passed with the following output:\n" - "${OUTPUT}\n\n" + "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n" + "${OUTPUT_VAR}\n\n" ) else () - message (STATUS "Testing C ${FUNCTION} - Fail") - set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION}") + message (STATUS "Testing C ${FUNCTION_NAME} - Fail") + set (${RUN_RESULT_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the C ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n\n") + "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n" + "${OUTPUT_VAR}\n\n") endif () else () - message (FATAL_ERROR "Compilation of C ${FUNCTION} - Failed") + message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed") endif () endmacro () diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index bbe632c..d30f2ab 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -70,7 +70,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) -# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.5-Source") +# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.10-Source") #endif() ############################################################################################################### diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index ec13272..93ebc3c 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -24,7 +24,7 @@ if (CMAKE_COMPILER_IS_GNUCC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt") endif () endif () @@ -36,7 +36,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common") endif () else () - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstdarg-opt") endif () endif () @@ -94,16 +94,29 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) # warnings that are emitted. If you need it, add it at configure time. - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") - # gcc automatically inlines based on the optimization level - # this is just a failsafe - set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcheck -Wall") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcomment -Wdeprecated -Wmain -Wmissing-declarations -Wmissing-prototypes -Wp64 -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wreturn-type -Wstrict-prototypes -Wuninitialized") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunknown-pragmas -Wunused-function -Wunused-variable") + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 18.0) + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wextra-tokens -Wformat -Wformat-security -Wic-pointer -Wshadow") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings") + endif() + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") + # gcc automatically inlines based on the optimization level + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") + endif () endif () #----------------------------------------------------------------------------- @@ -113,28 +126,36 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) if (HDF5_ENABLE_DEV_WARNINGS) message (STATUS "....HDF5 developer group warnings are enabled") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing") + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") + endif () else () - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") + endif () endif () - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") - # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + # Append more extra warning flags that only gcc 4.4+ know about + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + endif () # Append more extra warning flags that only gcc 4.5+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") endif () # Append more extra warning flags that only gcc 4.6+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const") @@ -144,7 +165,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.7+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") @@ -154,7 +175,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.8+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) if (HDF5_ENABLE_DEV_WARNINGS) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format") else () @@ -163,17 +184,17 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () # Append more extra warning flags that only gcc 4.9+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") endif () # Append more extra warning flags that only gcc 5.1+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") endif () # Append more extra warning flags that only gcc 6.x+ know about - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") endif () diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 3e6aad0..80a28d3 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -96,3 +96,8 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") ############################################################################################# +### use a toolchain file + +#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/intel.cmake") + +############################################################################################# diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 9be30f7..4204511 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -142,10 +142,6 @@ endif () macro (HDF_FUNCTION_TEST OTHER_TEST) if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST}) set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif () foreach (def HAVE_SYS_TIME_H @@ -168,8 +164,8 @@ macro (HDF_FUNCTION_TEST OTHER_TEST) TRY_COMPILE (${OTHER_TEST} ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" + COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}" OUTPUT_VARIABLE OUTPUT ) if (${OTHER_TEST}) @@ -282,8 +278,7 @@ if (NOT WINDOWS) TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS - OUTPUT_VARIABLE OUTPUT + COMPILE_DEFINITIONS "-DTEST_LFS_WORKS" ) # The LARGEFILE definitions were from the transition period @@ -300,14 +295,14 @@ if (NOT WINDOWS) set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n" + "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}) message (STATUS "${msg}... no") file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n" + "Test TEST_LFS_WORKS Compile failed\n" ) endif () endif () @@ -574,30 +569,21 @@ if (WINDOWS) "${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_LIBRARIES) - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - else () - set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - 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}") + 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} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFTests.c + COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" + LINK_LIBRARIES "${CMAKE_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) @@ -648,8 +634,8 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT + 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) @@ -661,7 +647,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " endif () else () file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n" + "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed\n" ) endif () diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 54e408b..8a37af3 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -30,6 +30,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (JPEG @@ -47,6 +48,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (JPEG @@ -64,6 +66,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) @@ -121,6 +124,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (SZIP @@ -139,6 +143,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (SZIP @@ -157,6 +162,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) @@ -213,6 +219,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (ZLIB @@ -230,6 +237,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (ZLIB @@ -247,6 +255,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} + -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} ) endif () externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) diff --git a/config/intel.cmake b/config/intel.cmake new file mode 100644 index 0000000..f1a5734 --- /dev/null +++ b/config/intel.cmake @@ -0,0 +1,10 @@ +# Uncomment the following to use cross-compiling +#set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_COMPILER_VENDOR "intel") + +set(CMAKE_C_COMPILER icc) +set(CMAKE_CXX_COMPILER icpc) +set(CMAKE_Fortran_COMPILER ifort) + +# the following is used if cross-compiling +set(CMAKE_CROSSCOMPILING_EMULATOR "") |