summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake44
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake6
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake48
-rw-r--r--Modules/Compiler/XL-Fortran.cmake4
-rwxr-xr-xModules/Compiler/XL-Fortran/cpp29
5 files changed, 122 insertions, 9 deletions
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index 96537f8..409b65a 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -134,3 +134,47 @@ macro(cmake_record_cxx_compile_features)
unset(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT)
endif()
endmacro()
+
+macro(cmake_record_cuda_compile_features)
+ set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA20_STANDARD_COMPILE_OPTION)
+ if(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(20)
+ else()
+ _record_compiler_features_cuda(20)
+ endif()
+ unset(CMAKE_CUDA20_STANDARD__HAS_FULL_SUPPORT)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA17_STANDARD_COMPILE_OPTION)
+ if(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(17)
+ else()
+ _record_compiler_features_cuda(17)
+ endif()
+ unset(CMAKE_CUDA17_STANDARD__HAS_FULL_SUPPORT)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA14_STANDARD_COMPILE_OPTION)
+ if(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(14)
+ else()
+ _record_compiler_features_cuda(14)
+ endif()
+ unset(CMAKE_CUDA14_STANDARD__HAS_FULL_SUPPORT)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA11_STANDARD_COMPILE_OPTION)
+ if(CMAKE_CUDA11_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(11)
+ else()
+ _record_compiler_features_cuda(11)
+ endif()
+ unset(CMAKE_CUDA11_STANDARD__HAS_FULL_SUPPORT)
+ endif()
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA03_STANDARD_COMPILE_OPTION)
+ if(CMAKE_CUDA03_STANDARD__HAS_FULL_SUPPORT)
+ _has_compiler_features_cuda(03)
+ else()
+ _record_compiler_features_cuda(03)
+ endif()
+ unset(CMAKE_CUDA03_STANDARD__HAS_FULL_SUPPORT)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index 9973feb..c54ab9d 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -1,6 +1,6 @@
# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files.
if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED)
- message(STATUS "Detecting NAG Fortran directory")
+ message(CHECK_START "Detecting NAG Fortran directory")
# Run with -dryrun to see sample "link" line.
execute_process(
COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun
@@ -20,11 +20,11 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED)
" directory: ${_nag_dir}\n"
" regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n"
"from output:\n${_dryrun}\n\n")
- message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}")
+ message(CHECK_PASS "${_nag_dir}")
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n")
- message(STATUS "Detecting NAG Fortran directory - failed")
+ message(CHECK_FAIL "failed")
endif()
endif()
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index b59deda..ad7f084 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -1,7 +1,32 @@
+include(Compiler/CMakeCommonCompilerMacros)
+
set(CMAKE_CUDA_COMPILER_HAS_DEVICE_LINK_PHASE True)
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
set(CMAKE_CUDA_VERBOSE_COMPILE_FLAG "-Xcompiler=-v")
+if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.2)
+ # The -forward-unknown-to-host-compiler flag was only
+ # added to nvcc in 10.2 so before that we had no good
+ # way to invoke the CUDA compiler and propagate unknown
+ # flags such as -pthread to the host compiler
+ set(_CMAKE_CUDA_EXTRA_FLAGS "-forward-unknown-to-host-compiler")
+else()
+ set(_CMAKE_CUDA_EXTRA_FLAGS "")
+endif()
+
+if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0")
+ set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "-Wno-deprecated-gpu-targets")
+else()
+ set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "")
+endif()
+
+if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.2)
+ # The -MD flag was only added to nvcc in 10.2 so
+ # before that we had to invoke the compiler twice
+ # to get header dependency information
+ set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <OBJECT> -MF <DEPFILE>")
+endif()
+
if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
@@ -19,17 +44,26 @@ set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
- set(CMAKE_CUDA_STANDARD_DEFAULT "")
+ set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "")
+
+ set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "")
+
+ if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
+ set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "")
+ endif()
else()
- set(CMAKE_CUDA_STANDARD_DEFAULT 98)
- set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
- set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "")
+
set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
- set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "-std=c++03")
- set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "-std=c++03")
+ set(CMAKE_CUDA03_STANDARD_COMPILE_OPTION "-std=c++03")
+ set(CMAKE_CUDA03_EXTENSION_COMPILE_OPTION "-std=c++03")
set(CMAKE_CUDA14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CUDA14_EXTENSION_COMPILE_OPTION "-std=c++14")
endif()
@@ -46,3 +80,5 @@ if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL "9.0")
set(CMAKE_CUDA_RESPONSE_FILE_LINK_FLAG "--options-file ")
set(CMAKE_CUDA_RESPONSE_FILE_FLAG "--options-file ")
endif()
+
+__compiler_check_default_language_standard(CUDA 6.0 03)
diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake
index c4fb097..1683dff 100644
--- a/Modules/Compiler/XL-Fortran.cmake
+++ b/Modules/Compiler/XL-Fortran.cmake
@@ -18,3 +18,7 @@ string(APPEND CMAKE_Fortran_FLAGS_INIT " -qthreaded -qhalt=e")
# xlf: 1501-214 (W) command option E reserved for future use - ignored
set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE)
set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE)
+
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -qpreprocess -qnoobject -qsuppress=1517-020 -tF -B \"${CMAKE_CURRENT_LIST_DIR}/XL-Fortran/\" -WF,--cpp,\"${CMAKE_Fortran_XL_CPP}\",--out,<PREPROCESSED_SOURCE> <SOURCE>"
+ )
diff --git a/Modules/Compiler/XL-Fortran/cpp b/Modules/Compiler/XL-Fortran/cpp
new file mode 100755
index 0000000..1fd62c2
--- /dev/null
+++ b/Modules/Compiler/XL-Fortran/cpp
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+# Source file.
+src="$(printf %q "$1")"
+shift
+
+# Output file the compiler expects.
+out="$(printf %q "$1")"
+shift
+
+# Create the file the compiler expects. It will check syntax.
+>"$out"
+
+cpp='cpp'
+opts=''
+while test "$#" != 0; do
+ case "$1" in
+ # Extract the option for the path to cpp.
+ --cpp) shift; cpp="$(printf %q "$1")" ;;
+ # Extract the option for our own output file.
+ --out) shift; out="$(printf %q "$1")" ;;
+ # Collect the rest of the command line.
+ *) opts="$opts $(printf %q "$1")" ;;
+ esac
+ shift
+done
+
+# Execute the real preprocessor tool.
+eval "exec $cpp $src $out $opts"