summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-12 15:41:57 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-01-12 15:41:57 (GMT)
commit728820f3ea0faf55ffe1236a44a35e9197fc6291 (patch)
tree3b80da93591a9e20df72181b295cf11009fe385e /Modules/Compiler
parent9f3eff6f5675851c81f093d16310d17e3754cd5f (diff)
parentf9a810f7b39406e00998c6e74e5a7d7d218d5aba (diff)
downloadCMake-728820f3ea0faf55ffe1236a44a35e9197fc6291.zip
CMake-728820f3ea0faf55ffe1236a44a35e9197fc6291.tar.gz
CMake-728820f3ea0faf55ffe1236a44a35e9197fc6291.tar.bz2
Merge topic 'cuda-windows'
f9a810f7 CUDA: Enable CudaOnly.SeparateCompilation test runtime calls 5599d858 CUDA: Port test cases to Windows with MSVC host compiler 11551702 CUDA: Populate NVIDIA compiler information on Windows 5365421e CUDA: Detect implicit link information on Windows 522b913f CUDA: Find MSVC binutils on Windows 02582b91 CUDA: Populate compiler PDB placeholder during device linking d470cb70 CUDA: Use `.obj` object file extension on Windows a2e80cb0 CUDA: Detect MSVC architecture id 65c1e012 CUDA: Detect use of MSVC host compiler 945dd207 CUDA: Allow platform files to set device linking rules 95420cea CMakeParseImplicitLinkInfo: Add support for MSVC invoked by CUDA nvcc
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake30
-rw-r--r--Modules/Compiler/NVIDIA-DetermineCompiler.cmake12
2 files changed, 28 insertions, 14 deletions
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index 605d555..ae35132 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -1,14 +1,15 @@
set(CMAKE_CUDA_VERBOSE_FLAG "-v")
-
-set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
-set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
-#CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we don' need
-#to forward it through nvcc
-set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+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)
+ set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
+ # CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we
+ # don't need to forward it through nvcc.
+ set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+endif()
set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
-set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
@@ -16,9 +17,12 @@ string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
-set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
-set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
-set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
-set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
-
-set(CMAKE_CUDA_STANDARD_DEFAULT 98)
+if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
+ set(CMAKE_CUDA_STANDARD_DEFAULT "")
+else()
+ set(CMAKE_CUDA_STANDARD_DEFAULT 98)
+ set(CMAKE_CUDA98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CUDA98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CUDA11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CUDA11_EXTENSION_COMPILE_OPTION "-std=c++11")
+endif()
diff --git a/Modules/Compiler/NVIDIA-DetermineCompiler.cmake b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
index 32ccf8a..cb0beaf 100644
--- a/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
+++ b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
@@ -4,4 +4,14 @@ set(_compiler_id_pp_test "defined(__NVCC__)")
set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__CUDACC_VER_MAJOR__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__CUDACC_VER_MINOR__)
-# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CUDACC_VER_BUILD__)")
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__CUDACC_VER_BUILD__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+# define @PREFIX@SIMULATE_ID \"MSVC\"
+# endif")