diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/CrayPrgEnv.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/Intel-C.cmake | 8 | ||||
-rw-r--r-- | Modules/FindHDF5.cmake | 68 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 8 | ||||
-rw-r--r-- | Modules/GetPrerequisites.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/CrayLinuxEnvironment.cmake | 16 |
6 files changed, 92 insertions, 18 deletions
diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index fa39b00..9f8befd 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -56,6 +56,8 @@ macro(__CrayPrgEnv_setup lang test_src compiler_cmd link_cmd) message(STATUS "Cray Programming Environment $ENV{CRAYPE_VERSION} ${lang}") elseif(DEFINED ENV{ASYNCPE_VERSION}) message(STATUS "Cray XT Programming Environment $ENV{ASYNCPE_VERSION} ${lang}") + else() + message(STATUS "Cray Programming Environment (unknown version) ${lang}") endif() # Flags for the Cray wrappers diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index eb9602a..edca154 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -16,14 +16,14 @@ endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=gnu11") endif() -if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) +if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "${_std}=c89") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=c89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=gnu89") set(CMAKE_C99_STANDARD_COMPILE_OPTION "${_std}=c99") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=c99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=gnu99") endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index aa2764b..ab046e3 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -183,7 +183,7 @@ endmacro() # Test first if the current compilers automatically wrap HDF5 -function(_HDF5_test_regular_compiler_C success version) +function(_HDF5_test_regular_compiler_C success version is_parallel) set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) if(NOT ${success} OR @@ -214,10 +214,21 @@ function(_HDF5_test_regular_compiler_C success version) set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3}) endif() set(${version} ${${version}} PARENT_SCOPE) + + execute_process(COMMAND ${CMAKE_C_COMPILER} -showconfig + OUTPUT_VARIABLE config_output + ERROR_VARIABLE config_error + RESULT_VARIABLE config_result + ) + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() endif() endfunction() -function(_HDF5_test_regular_compiler_CXX success version) +function(_HDF5_test_regular_compiler_CXX success version is_parallel) set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) if(NOT ${success} OR NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx) @@ -248,10 +259,21 @@ function(_HDF5_test_regular_compiler_CXX success version) set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3}) endif() set(${version} ${${version}} PARENT_SCOPE) + + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -showconfig + OUTPUT_VARIABLE config_output + ERROR_VARIABLE config_error + RESULT_VARIABLE config_result + ) + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() endif() endfunction() -function(_HDF5_test_regular_compiler_Fortran success) +function(_HDF5_test_regular_compiler_Fortran success is_parallel) if(NOT ${success}) set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5) @@ -266,12 +288,24 @@ function(_HDF5_test_regular_compiler_Fortran success) " call h5close_f(error)\n" "end\n") try_compile(${success} ${scratch_directory} ${test_file}) + if(${success}) + execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig + OUTPUT_VARIABLE config_output + ERROR_VARIABLE config_error + RESULT_VARIABLE config_result + ) + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE PARENT_SCOPE) + else() + set(${is_parallel} FALSE PARENT_SCOPE) + endif() + endif() endif() endfunction() # Invoke the HDF5 wrapper compiler. The compiler return value is stored to the # return_value argument, the text output is stored to the output variable. -macro( _HDF5_invoke_compiler language output return_value version) +macro( _HDF5_invoke_compiler language output return_value version is_parallel) set(${version}) if(HDF5_USE_STATIC_LIBRARIES) set(lib_type_args -noshlib) @@ -309,6 +343,11 @@ macro( _HDF5_invoke_compiler language output return_value version) string(REPLACE "HDF5 Version: " "" ${version} "${version_match}") string(REPLACE "-patch" "." ${version} "${${version}}") endif() + if(config_output MATCHES "Parallel HDF5: yes") + set(${is_parallel} TRUE) + else() + set(${is_parallel} FALSE) + endif() endmacro() # Parse a compile line for definitions, includes, library paths, and libraries. @@ -386,6 +425,7 @@ endif() if(NOT HDF5_FOUND AND NOT HDF5_ROOT) find_package(HDF5 QUIET NO_MODULE) if( HDF5_FOUND) + set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL}) set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) set(HDF5_LIBRARIES) set(HDF5_C_TARGET hdf5) @@ -446,14 +486,17 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT) if(__lang STREQUAL "C") _HDF5_test_regular_compiler_C( HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_VERSION) + HDF5_${__lang}_VERSION + HDF5_${__lang}_IS_PARALLEL) elseif(__lang STREQUAL "CXX") _HDF5_test_regular_compiler_CXX( HDF5_${__lang}_COMPILER_NO_INTERROGATE - HDF5_${__lang}_VERSION) + HDF5_${__lang}_VERSION + HDF5_${__lang}_IS_PARALLEL) elseif(__lang STREQUAL "Fortran") _HDF5_test_regular_compiler_Fortran( - HDF5_${__lang}_COMPILER_NO_INTERROGATE) + HDF5_${__lang}_COMPILER_NO_INTERROGATE + HDF5_${__lang}_IS_PARALLEL) else() continue() endif() @@ -490,7 +533,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT) if(HDF5_${__lang}_COMPILER_EXECUTABLE) _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE - HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION) + HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL) if(HDF5_${__lang}_RETURN_VALUE EQUAL 0) message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration") _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE @@ -554,6 +597,15 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT) message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}") endif() endif() + if(DEFINED HDF5_${__lang}_IS_PARALLEL) + if(NOT DEFINED HDF5_IS_PARALLEL) + set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL}) + elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL) + message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.") + elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL) + message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.") + endif() + endif() endforeach() else() set(_HDF5_NEED_TO_SEARCH True) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 8042073..2807bb9 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -129,6 +129,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + if(DEFINED Protobuf_IMPORT_DIRS) foreach(DIR ${Protobuf_IMPORT_DIRS}) get_filename_component(ABS_PATH ${DIR} ABSOLUTE) @@ -183,6 +187,10 @@ function(PROTOBUF_GENERATE_PYTHON SRCS) set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) endif() + if(DEFINED PROTOBUF_IMPORT_DIRS AND NOT DEFINED Protobuf_IMPORT_DIRS) + set(Protobuf_IMPORT_DIRS "${PROTOBUF_IMPORT_DIRS}") + endif() + if(DEFINED Protobuf_IMPORT_DIRS) foreach(DIR ${Protobuf_IMPORT_DIRS}) get_filename_component(ABS_PATH ${DIR} ABSOLUTE) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index aa5bf28..fb7bf93 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -500,7 +500,9 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(NOT IS_ABSOLUTE "${original_file}") message(STATUS "warning: gp_resolved_file_type expects absolute full path for first arg original_file") endif() - get_filename_component(original_file "${original_file}" ABSOLUTE) # canonicalize path + if(IS_ABSOLUTE "${original_file}") + get_filename_component(original_file "${original_file}" ABSOLUTE) # canonicalize path + endif() set(is_embedded 0) set(is_local 0) @@ -516,7 +518,9 @@ function(gp_resolved_file_type original_file file exepath dirs type_var) if(NOT IS_ABSOLUTE "${file}") gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file "${rpaths}") endif() - get_filename_component(resolved_file "${resolved_file}" ABSOLUTE) # canonicalize path + if(IS_ABSOLUTE "${resolved_file}") + get_filename_component(resolved_file "${resolved_file}" ABSOLUTE) # canonicalize path + endif() string(TOLOWER "${original_file}" original_lower) string(TOLOWER "${resolved_file}" lower) diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake index 97771a2..a1a3d3f 100644 --- a/Modules/Platform/CrayLinuxEnvironment.cmake +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -8,14 +8,22 @@ if(DEFINED ENV{CRAYOS_VERSION}) set(CMAKE_SYSTEM_VERSION "$ENV{CRAYOS_VERSION}") elseif(DEFINED ENV{XTOS_VERSION}) set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}") -else() - message(FATAL_ERROR "Neither the CRAYOS_VERSION or XTOS_VERSION environment variables are defined. This platform file should be used inside the Cray Linux Environment for targeting compute nodes (NIDs)") +elseif(EXISTS /etc/opt/cray/release/cle-release) + file(STRINGS /etc/opt/cray/release/cle-release release REGEX "^RELEASE=.*") + string(REGEX REPLACE "^RELEASE=(.*)$" "\\1" CMAKE_SYSTEM_VERSION "${release}") + unset(release) +elseif(EXISTS /etc/opt/cray/release/clerelease) + file(READ /etc/opt/cray/release/clerelease CMAKE_SYSTEM_VERSION) endif() # Guard against multiple messages if(NOT __CrayLinuxEnvironment_message) - set(__CrayLinuxEnvironment_message 1) - message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") + set(__CrayLinuxEnvironment_message 1 CACHE INTERNAL "") + if(NOT CMAKE_SYSTEM_VERSION) + message(STATUS "CrayLinuxEnvironment: Unable to determine CLE version. This platform file should only be used from inside the Cray Linux Environment for targeting compute nodes (NIDs).") + else() + message(STATUS "Cray Linux Environment ${CMAKE_SYSTEM_VERSION}") + endif() endif() # All cray systems are x86 CPUs and have been for quite some time |