CUDA: Detect MSVC architecture id

This commit is contained in:
Brad King 2016-12-13 13:00:43 -05:00
parent 65c1e012ff
commit a2e80cb085
4 changed files with 9 additions and 1 deletions

View File

@ -6,6 +6,7 @@ set(CMAKE_CUDA_COMPILER_VERSION "@CMAKE_CUDA_COMPILER_VERSION@")
set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@") set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@") set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@")
set(CMAKE_CUDA_SIMULATE_VERSION "@CMAKE_CUDA_SIMULATE_VERSION@") set(CMAKE_CUDA_SIMULATE_VERSION "@CMAKE_CUDA_SIMULATE_VERSION@")
@SET_MSVC_CUDA_ARCHITECTURE_ID@
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX") set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX") set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")

View File

@ -70,6 +70,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
endif() endif()
include(CMakeFindBinUtils) include(CMakeFindBinUtils)
if(MSVC_CUDA_ARCHITECTURE_ID)
set(SET_MSVC_CUDA_ARCHITECTURE_ID
"set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
endif()
#if this compiler vendor is matches NVIDIA we can determine #if this compiler vendor is matches NVIDIA we can determine
#what the host compiler is. This only needs to be done if the CMAKE_CUDA_HOST_COMPILER #what the host compiler is. This only needs to be done if the CMAKE_CUDA_HOST_COMPILER

View File

@ -54,6 +54,8 @@ if(NOT MSVC_VERSION)
set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION}) set(_compiler_version ${CMAKE_CXX_SIMULATE_VERSION})
elseif(CMAKE_Fortran_SIMULATE_VERSION) elseif(CMAKE_Fortran_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION}) set(_compiler_version ${CMAKE_Fortran_SIMULATE_VERSION})
elseif(CMAKE_CUDA_SIMULATE_VERSION)
set(_compiler_version ${CMAKE_CUDA_SIMULATE_VERSION})
elseif(CMAKE_C_COMPILER_VERSION) elseif(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
else() else()

View File

@ -344,7 +344,8 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const
{ {
cmMakefile* mf = this->GetMakefile(); cmMakefile* mf = this->GetMakefile();
if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") ||
mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID") ||
mf->GetDefinition("MSVC_CUDA_ARCHITECTURE_ID")) {
std::string pdbPath; std::string pdbPath;
std::string compilePdbPath = this->ComputeTargetCompilePDB(); std::string compilePdbPath = this->ComputeTargetCompilePDB();
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE || if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||