diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2018-01-11 22:15:31 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2018-01-12 20:17:03 (GMT) |
commit | 46abfedb8395f7e72281bd8eb7bd4f118c311140 (patch) | |
tree | 703899604007d87b1ad5e842276cc2aca06ea401 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 46ad7215979cd60c00589f6f0abdcff2856069e8 (diff) | |
download | CMake-46abfedb8395f7e72281bd8eb7bd4f118c311140.zip CMake-46abfedb8395f7e72281bd8eb7bd4f118c311140.tar.gz CMake-46abfedb8395f7e72281bd8eb7bd4f118c311140.tar.bz2 |
CUDA: MSVC will now state files are cuda files when needed
The MSVC CUDA build customizations before CUDA 9 would not explicitly
add the -x cu option when building. This caused .cpp and .c files
invoked with CudaCompile to be compiled as host code and not
cuda. Now when we detect CUDA < 9 we will explicitly add this
option to correct this bug.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ee9db43..3a008cd 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2646,6 +2646,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( cudaOptions.AddFlag("GPUDebugInfo", "false"); } + bool notPtx = true; if (this->GeneratorTarget->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION")) { cudaOptions.AddFlag("GenerateRelocatableDeviceCode", "true"); } else if (this->GeneratorTarget->GetPropertyAsBool( @@ -2654,6 +2655,16 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // We drop the %(Extension) component as CMake expects all PTX files // to not have the source file extension at all cudaOptions.AddFlag("CompileOut", "$(IntDir)%(Filename).ptx"); + notPtx = false; + } + + if (notPtx && + cmSystemTools::VersionCompareGreaterEq( + "8.0", this->GlobalGenerator->GetPlatformToolsetCudaString())) { + // Explicitly state that we want this file to be treated as a + // CUDA file no matter what the file extensions is + // This is only needed for < CUDA 9 + cudaOptions.AppendFlagString("AdditionalOptions", "-x cu"); } // CUDA automatically passes the proper '--machine' flag to nvcc |