summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2016-08-26 20:59:36 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2016-11-14 16:36:42 (GMT)
commitf8aac21947f43a0e886a3cc3655514abb95bb260 (patch)
treea257ad0211362ab635e3b09922ec143eba1827a3 /Modules/Compiler
parent4a4be0301bd9c6062738e87892cbe5bd8d900a49 (diff)
downloadCMake-f8aac21947f43a0e886a3cc3655514abb95bb260.zip
CMake-f8aac21947f43a0e886a3cc3655514abb95bb260.tar.gz
CMake-f8aac21947f43a0e886a3cc3655514abb95bb260.tar.bz2
CUDA: Add basic CUDA language support for *NIX systems.
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake16
-rw-r--r--Modules/Compiler/NVIDIA-DetermineCompiler.cmake7
2 files changed, 23 insertions, 0 deletions
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
new file mode 100644
index 0000000..9fcd8d7
--- /dev/null
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -0,0 +1,16 @@
+set(CMAKE_CXX_VERBOSE_FLAG "-v")
+
+
+set(CMAKE_CUDA_COMPILE_OPTIONS_PIE -Xcompiler=-fPIE)
+set(CMAKE_CUDA_COMPILE_OPTIONS_PIC -Xcompiler=-fPIC)
+set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -Xcompiler=-fPIC)
+set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
+set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
+set(CMAKE_CUDA_COMPILE_OPTIONS_VISIBILITY -Xcompiler=-fvisibility=)
+
+if (NOT CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 7.0)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
+ 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
new file mode 100644
index 0000000..32ccf8a
--- /dev/null
+++ b/Modules/Compiler/NVIDIA-DetermineCompiler.cmake
@@ -0,0 +1,7 @@
+
+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__)")