diff options
author | Brad King <brad.king@kitware.com> | 2018-01-11 15:18:06 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-11 15:18:11 (GMT) |
commit | fe8d74cc6022b814f08486df3b575c1dbe875f18 (patch) | |
tree | 50dbd6c7bb291096cf9d3375c9a421874274615b /Source/cmVisualStudioGeneratorOptions.cxx | |
parent | 3f4924aa60889dd2a34a2a1ba6877528779867d0 (diff) | |
parent | a91fde135d8a9fb03a28d0760f0c052a26350b91 (diff) | |
download | CMake-fe8d74cc6022b814f08486df3b575c1dbe875f18.zip CMake-fe8d74cc6022b814f08486df3b575c1dbe875f18.tar.gz CMake-fe8d74cc6022b814f08486df3b575c1dbe875f18.tar.bz2 |
Merge topic 'cuda_msvc_support_complex_gencode_signatures'
a91fde13 CUDA: gencode signature that list multiple code types now supported.
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1618
Diffstat (limited to 'Source/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 9a5986c..106bdff 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -239,20 +239,32 @@ void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() // It translates to -arch=<virtual> -code=<real>. cmSystemTools::ReplaceString(arch_name, "sm_", "compute_"); } - for (std::vector<std::string>::iterator ci = codes.begin(); - ci != codes.end(); ++ci) { - std::string entry = arch_name + "," + *ci; + for (auto const& c : codes) { + std::string entry = arch_name + "," + c; result.push_back(entry); } } - // Now add entries for the -gencode=<arch>,<code> pairs. - for (std::vector<std::string>::iterator ei = gencode.begin(); - ei != gencode.end(); ++ei) { - std::string entry = *ei; + // Now add entries for the following signatures: + // -gencode=<arch>,<code> + // -gencode=<arch>,[<code1>,<code2>] + // -gencode=<arch>,"<code1>,<code2>" + for (auto const& e : gencode) { + std::string entry = e; cmSystemTools::ReplaceString(entry, "arch=", ""); cmSystemTools::ReplaceString(entry, "code=", ""); - result.push_back(entry); + cmSystemTools::ReplaceString(entry, "[", ""); + cmSystemTools::ReplaceString(entry, "]", ""); + cmSystemTools::ReplaceString(entry, "\"", ""); + + std::vector<std::string> codes = cmSystemTools::tokenize(entry, ","); + if (codes.size() >= 2) { + auto gencode_arch = cm::cbegin(codes); + for (auto ci = gencode_arch + 1; ci != cm::cend(codes); ++ci) { + std::string code_entry = *gencode_arch + "," + *ci; + result.push_back(code_entry); + } + } } } |