diff options
author | Brad King <brad.king@kitware.com> | 2018-10-10 17:41:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-10 17:41:44 (GMT) |
commit | bcfb2457030efcfdb84eef02230aa47f18072555 (patch) | |
tree | ec0fe92e5d05b7ef04f383e1e5b02b8db7a6da60 | |
parent | a8a485715afe3017a514bc5fbd3a19a96d493aed (diff) | |
parent | faf3d7d224ae2292e88b8238271a7ff97950ddf9 (diff) | |
download | CMake-bcfb2457030efcfdb84eef02230aa47f18072555.zip CMake-bcfb2457030efcfdb84eef02230aa47f18072555.tar.gz CMake-bcfb2457030efcfdb84eef02230aa47f18072555.tar.bz2 |
Merge branch 'vs-cuda-pdb' into release-3.13
Merge-request: !2473
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 25 | ||||
-rw-r--r-- | Tests/Cuda/Complex/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/ObjectLibrary/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/WithC/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/CircularLinkLine/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/EnableStandard/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/ExportPTX/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/PDB/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/SeparateCompilation/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/WithDefs/CMakeLists.txt | 2 |
15 files changed, 32 insertions, 21 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 57d66e0..2d39cbb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2679,6 +2679,13 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( // Specify the compiler program database file if configured. std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName); if (!pdb.empty()) { + if (this->GlobalGenerator->IsCudaEnabled()) { + // CUDA does not quote paths with spaces correctly when forwarding + // this to the host compiler. Use a relative path to avoid spaces. + // FIXME: We can likely do this even when CUDA is not involved, + // but for now we will make a minimal change. + pdb = this->ConvertPath(pdb, true); + } ConvertToWindowsSlash(pdb); e2.Element("ProgramDataBaseFileName", pdb); } @@ -2819,15 +2826,19 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // Specify the compiler program database file if configured. std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName); if (!pdb.empty()) { - // CUDA does not have a field for this and does not honor the - // ProgramDataBaseFileName field in ClCompile. Work around this - // limitation by creating the directory and passing the flag ourselves. + // CUDA does not make the directory if it is non-standard. std::string const pdbDir = cmSystemTools::GetFilenamePath(pdb); cmSystemTools::MakeDirectory(pdbDir); - pdb = this->ConvertPath(pdb, true); - ConvertToWindowsSlash(pdb); - std::string const clFd = "-Xcompiler=\"-Fd\\\"" + pdb + "\\\"\""; - cudaOptions.AppendFlagString("AdditionalOptions", clFd); + if (cmSystemTools::VersionCompareGreaterEq( + "9.2", this->GlobalGenerator->GetPlatformToolsetCudaString())) { + // CUDA does not have a field for this and does not honor the + // ProgramDataBaseFileName field in ClCompile. Work around this + // limitation by creating the directory and passing the flag ourselves. + pdb = this->ConvertPath(pdb, true); + ConvertToWindowsSlash(pdb); + std::string const clFd = "-Xcompiler=\"-Fd\\\"" + pdb + "\\\"\""; + cudaOptions.AppendFlagString("AdditionalOptions", clFd); + } } // CUDA automatically passes the proper '--machine' flag to nvcc diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt index f4e1923..d3d4b7c 100644 --- a/Tests/Cuda/Complex/CMakeLists.txt +++ b/Tests/Cuda/Complex/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project (CudaComplex CXX CUDA) +project (Complex CXX CUDA) #Goal for this example: #build a cpp dynamic library base diff --git a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt index 9fda2d0..7098a7d 100644 --- a/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt +++ b/Tests/Cuda/ConsumeCompileFeatures/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project (CudaConsumeCompileFeatures CXX CUDA) +project (ConsumeCompileFeatures CXX CUDA) #Goal for this example: #build a c++11 library that express a c++11 public compile feature diff --git a/Tests/Cuda/MixedStandardLevels/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels/CMakeLists.txt index 683abe7..b399662 100644 --- a/Tests/Cuda/MixedStandardLevels/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.7) -project(CudaComplex CXX CUDA) +project(MixedStandardLevels CXX CUDA) string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") diff --git a/Tests/Cuda/ObjectLibrary/CMakeLists.txt b/Tests/Cuda/ObjectLibrary/CMakeLists.txt index da5fb87..395bd38 100644 --- a/Tests/Cuda/ObjectLibrary/CMakeLists.txt +++ b/Tests/Cuda/ObjectLibrary/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.7) -project (CudaObjectLibrary CUDA CXX) +project (ObjectLibrary CUDA CXX) #Goal for this example: # #Build C++ and CUDA object files and than use them to make an executable diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt index 831ce12..69aa3f9 100644 --- a/Tests/Cuda/WithC/CMakeLists.txt +++ b/Tests/Cuda/WithC/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.7) -project(CudaComplex CUDA C) +project(WithC CUDA C) string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt index c978e51..5e6f7ab 100644 --- a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt +++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.7) -project (CudaOnlyCircularLinkLine CUDA) +project (CircularLinkLine CUDA) #Goal for this example: # Verify that we de-duplicate the device link line diff --git a/Tests/CudaOnly/EnableStandard/CMakeLists.txt b/Tests/CudaOnly/EnableStandard/CMakeLists.txt index 35a1deb..54e2c14 100644 --- a/Tests/CudaOnly/EnableStandard/CMakeLists.txt +++ b/Tests/CudaOnly/EnableStandard/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project (CudaOnlyEnableStandard CUDA) +project (EnableStandard CUDA) #Goal for this example: #build cuda sources that require C++11 to be enabled. diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt index 65d5243..ff6e77c 100644 --- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project (CudaOnlyExportPTX CUDA) +project (ExportPTX CUDA) #Goal for this example: # How to generate PTX files instead of OBJECT files diff --git a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt index 5b96906..fbef15f 100644 --- a/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt +++ b/Tests/CudaOnly/GPUDebugFlag/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project (CudaOnlGPUDebugFlag CUDA) +project (GPUDebugFlag CUDA) #Goal for this example: #verify that -G enables gpu debug flags diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt b/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt index 62be1e6..7f7f606 100644 --- a/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt +++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(CudaOnlyLinkSystemDeviceLibraries CUDA) +project(LinkSystemDeviceLibraries CUDA) string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_35,code=compute_35 -gencode arch=compute_35,code=sm_35") set(CMAKE_CUDA_STANDARD 11) diff --git a/Tests/CudaOnly/PDB/CMakeLists.txt b/Tests/CudaOnly/PDB/CMakeLists.txt index 34e1e5c..6ecf989 100644 --- a/Tests/CudaOnly/PDB/CMakeLists.txt +++ b/Tests/CudaOnly/PDB/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.11) -project (CudaOnlyPDB CUDA) +project (PDB CUDA) add_executable(CudaOnlyPDB main.cu) set_target_properties(CudaOnlyPDB PROPERTIES diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt index 0c453a9..796e133 100644 --- a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt +++ b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.7) -project (CudaOnlyResolveDeviceSymbols CUDA) +project (ResolveDeviceSymbols CUDA) # Find nm and dumpbin if(CMAKE_NM) diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index c934c51..1e574d6 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project (CudaOnlySeparateCompilation CUDA) +project (SeparateCompilation CUDA) #Goal for this example: #Build a static library that defines multiple methods and kernels that diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 926d9ed..e58204d 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.7) -project (CudaOnlyWithDefs CUDA) +project (WithDefs CUDA) #verify that we can pass explicit cuda arch flags string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") |