summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-04-06 09:22:37 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-04-19 13:53:11 (GMT)
commit4248bb452a5886ec4b632e2d602fcaafd2b13aaf (patch)
treeb7e126570036c7a7ec0ac61ca7ef99f67edd6d18 /Source/cmNinjaNormalTargetGenerator.cxx
parentec48e023f6261371aa5d0e46ebf9c163e40c9b40 (diff)
downloadCMake-4248bb452a5886ec4b632e2d602fcaafd2b13aaf.zip
CMake-4248bb452a5886ec4b632e2d602fcaafd2b13aaf.tar.gz
CMake-4248bb452a5886ec4b632e2d602fcaafd2b13aaf.tar.bz2
CUDA: Device linking use now link options
properties LINK_OPTIONS and INTERFACE_LINK_OPTIONS are propagated to the device link step. To control which options are selected for normal link and device link steps, the $<DEVICE_LINK> and $<HOST_LINK> generator expressions can be used. Fixes: #18265
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx36
1 files changed, 10 insertions, 26 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 9c4ff83..49e8af9 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -233,11 +233,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkRule(
vars.LinkFlags = "$LINK_FLAGS";
vars.Manifests = "$MANIFESTS";
- std::string langFlags;
- if (this->GetGeneratorTarget()->GetType() != cmStateEnums::EXECUTABLE) {
- langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
- vars.LanguageCompileFlags = langFlags.c_str();
- }
+ vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS";
std::string launcher;
const char* val = this->GetLocalGenerator()->GetRuleLauncher(
@@ -590,8 +586,6 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
return;
}
- // Now we can do device linking
-
// First and very important step is to make sure while inside this
// step our link language is set to CUDA
std::string cudaLinkLanguage = "CUDA";
@@ -677,9 +671,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
linkLineComputer->SetUseWatcomQuote(useWatcomQuote);
linkLineComputer->SetUseNinjaMulti(globalGen->IsMultiConfig());
- localGen.GetTargetFlags(
- linkLineComputer.get(), config, vars["LINK_LIBRARIES"], vars["FLAGS"],
- vars["LINK_FLAGS"], frameworkPath, linkPath, genTarget);
+ localGen.GetDeviceLinkFlags(linkLineComputer.get(), config,
+ vars["LINK_LIBRARIES"], vars["LINK_FLAGS"],
+ frameworkPath, linkPath, genTarget);
this->addPoolNinjaVariable("JOB_POOL_LINK", genTarget, vars);
@@ -689,22 +683,12 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
vars["LINK_PATH"] = frameworkPath + linkPath;
- // Compute architecture specific link flags. Yes, these go into a different
- // variable for executables, probably due to a mistake made when duplicating
- // code between the Makefile executable and library generators.
- if (targetType == cmStateEnums::EXECUTABLE) {
- std::string t = vars["FLAGS"];
- localGen.AddArchitectureFlags(t, genTarget, cudaLinkLanguage, config);
- vars["FLAGS"] = t;
- } else {
- std::string t = vars["ARCH_FLAGS"];
- localGen.AddArchitectureFlags(t, genTarget, cudaLinkLanguage, config);
- vars["ARCH_FLAGS"] = t;
- t.clear();
- localGen.AddLanguageFlagsForLinking(t, genTarget, cudaLinkLanguage,
- config);
- vars["LANGUAGE_COMPILE_FLAGS"] = t;
- }
+ // Compute language specific link flags.
+ std::string langFlags;
+ localGen.AddLanguageFlagsForLinking(langFlags, genTarget, cudaLinkLanguage,
+ config);
+ vars["LANGUAGE_COMPILE_FLAGS"] = langFlags;
+
auto const tgtNames = this->TargetNames(config);
if (genTarget->HasSOName(config)) {
vars["SONAME_FLAG"] =