diff options
author | Brad King <brad.king@kitware.com> | 2017-03-07 21:12:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-10 15:19:56 (GMT) |
commit | 4def02a3852eb211e26951819646f8cd8ee6c00c (patch) | |
tree | 428ac536110f48862923479e7430ed95047e04a7 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 29f07b08671ea8a8cf2b32c6b740a2ecaa58168c (diff) | |
download | CMake-4def02a3852eb211e26951819646f8cd8ee6c00c.zip CMake-4def02a3852eb211e26951819646f8cd8ee6c00c.tar.gz CMake-4def02a3852eb211e26951819646f8cd8ee6c00c.tar.bz2 |
VS: Place CUDA host compiler options in proper project file fields
The CUDA Toolkit's VS integration provides abstractions for host
compiler options for `nvcc` to pass through `-Xcompiler` to the host
MSVC. Populate our secondary flag table and use it to remove flags from
the `AdditionalCompilerOptions` in favor of their abstractions.
Unfortunately a bug in the CUDA 8.0 VS integration prevents us from
passing anything in `AdditionalCompilerOptions` reliably. After taking
out the flags that have dedicated abstractions, drop the rest.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ec39c8f..7d66fcb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2470,6 +2470,16 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( cudaOptions.Parse(defineFlags.c_str()); cudaOptions.ParseFinish(); + // Convert the host compiler options to the toolset's abstractions + // using a secondary flag table. + cudaOptions.ClearTables(); + cudaOptions.AddTable(gg->GetCudaHostFlagTable()); + cudaOptions.Reparse("AdditionalCompilerOptions"); + + // `CUDA 8.0.targets` places these before nvcc! Just drop whatever + // did not parse and hope it works. + cudaOptions.RemoveFlag("AdditionalCompilerOptions"); + std::vector<std::string> targetDefines; this->GeneratorTarget->GetCompileDefinitions(targetDefines, configName.c_str(), "CUDA"); |