summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudioGeneratorOptions.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-07 21:19:22 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-10 15:19:57 (GMT)
commit253594d0aec0cbe34694cac59ef1a8e42a532118 (patch)
tree29fbe76be9f47076af03470cde40cc219580d98c /Source/cmVisualStudioGeneratorOptions.cxx
parent4def02a3852eb211e26951819646f8cd8ee6c00c (diff)
downloadCMake-253594d0aec0cbe34694cac59ef1a8e42a532118.zip
CMake-253594d0aec0cbe34694cac59ef1a8e42a532118.tar.gz
CMake-253594d0aec0cbe34694cac59ef1a8e42a532118.tar.bz2
VS: Select the CUDA runtime library
Parse the `-cudart=` option and add a corresponding `CudaRuntime` field to the generated project file. Also add a matching `.lib` to the list of libraries linked.
Diffstat (limited to 'Source/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 125d2c4..c79dc11 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -187,6 +187,27 @@ bool cmVisualStudioGeneratorOptions::UsingSBCS() const
return false;
}
+cmVisualStudioGeneratorOptions::CudaRuntime
+cmVisualStudioGeneratorOptions::GetCudaRuntime() const
+{
+ std::map<std::string, FlagValue>::const_iterator i =
+ this->FlagMap.find("CudaRuntime");
+ if (i != this->FlagMap.end() && i->second.size() == 1) {
+ std::string const& cudaRuntime = i->second[0];
+ if (cudaRuntime == "Static") {
+ return CudaRuntimeStatic;
+ }
+ if (cudaRuntime == "Shared") {
+ return CudaRuntimeShared;
+ }
+ if (cudaRuntime == "None") {
+ return CudaRuntimeNone;
+ }
+ }
+ // nvcc default is static
+ return CudaRuntimeStatic;
+}
+
void cmVisualStudioGeneratorOptions::Parse(const char* flags)
{
// Parse the input string as a windows command line since the string
@@ -220,6 +241,21 @@ void cmVisualStudioGeneratorOptions::ParseFinish()
rl += this->FortranRuntimeDLL ? "DLL" : "";
this->FlagMap["RuntimeLibrary"] = rl;
}
+
+ if (this->CurrentTool == CudaCompiler) {
+ std::map<std::string, FlagValue>::iterator i =
+ this->FlagMap.find("CudaRuntime");
+ if (i != this->FlagMap.end() && i->second.size() == 1) {
+ std::string& cudaRuntime = i->second[0];
+ if (cudaRuntime == "static") {
+ cudaRuntime = "Static";
+ } else if (cudaRuntime == "shared") {
+ cudaRuntime = "Shared";
+ } else if (cudaRuntime == "none") {
+ cudaRuntime = "None";
+ }
+ }
+ }
}
void cmVisualStudioGeneratorOptions::PrependInheritedString(