summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2021-11-06 11:19:51 (GMT)
committerRaul Tambre <raul@tambre.ee>2021-11-07 19:28:08 (GMT)
commit15fde4c420e0fa469077fad020b9fdc071796f70 (patch)
tree464136dac024f24ea261e877a54d95d073d08cce /Source/cmMakefileTargetGenerator.cxx
parentcf7e68087d005051ec07cb21c2aed2963a3d5c4e (diff)
downloadCMake-15fde4c420e0fa469077fad020b9fdc071796f70.zip
CMake-15fde4c420e0fa469077fad020b9fdc071796f70.tar.gz
CMake-15fde4c420e0fa469077fad020b9fdc071796f70.tar.bz2
CUDA: Use local shorthands for variables in Clang device link code
Helps reduce wrapping of lines making code more readable.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx26
1 files changed, 12 insertions, 14 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4e5913e..67beaad 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1530,9 +1530,9 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
return;
}
+ cmLocalUnixMakefileGenerator3* localGen{ this->LocalGenerator };
std::vector<std::string> architectures = cmExpandedList(architecturesStr);
- std::string const& relPath =
- this->LocalGenerator->GetHomeRelativeOutputPath();
+ std::string const& relPath = localGen->GetHomeRelativeOutputPath();
// Ensure there are no duplicates.
const std::vector<std::string> linkDeps = [&]() -> std::vector<std::string> {
@@ -1552,12 +1552,12 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
const std::string objectDir = this->GeneratorTarget->ObjectDirectory;
const std::string relObjectDir =
- this->LocalGenerator->MaybeRelativeToCurBinDir(objectDir);
+ localGen->MaybeRelativeToCurBinDir(objectDir);
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> cleanFiles;
- cleanFiles.push_back(this->LocalGenerator->MaybeRelativeToCurBinDir(output));
+ cleanFiles.push_back(localGen->MaybeRelativeToCurBinDir(output));
std::string profiles;
std::vector<std::string> fatbinaryDepends;
@@ -1594,8 +1594,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
" -arch=sm_", architecture, registerFileCmd, " -o=$@ ",
cmJoin(linkDeps, " "));
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr, cubin,
- linkDeps, { command }, false);
+ localGen->WriteMakeRule(*this->BuildFileStream, nullptr, cubin, linkDeps,
+ { command }, false);
}
// Combine all architectures into a single fatbinary.
@@ -1609,9 +1609,8 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
const std::string fatbinaryOutputRel =
cmStrCat(relPath, relObjectDir, "cmake_cuda_fatbin.h");
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr,
- fatbinaryOutputRel, fatbinaryDepends,
- { fatbinaryCommand }, false);
+ localGen->WriteMakeRule(*this->BuildFileStream, nullptr, fatbinaryOutputRel,
+ fatbinaryDepends, { fatbinaryCommand }, false);
// Compile the stub that registers the kernels and contains the
// fatbinaries.
@@ -1630,13 +1629,12 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule(
std::string compileCmd = this->GetLinkRule("CMAKE_CUDA_DEVICE_LINK_COMPILE");
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
- this->LocalGenerator->CreateRulePlaceholderExpander());
- rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator,
- compileCmd, vars);
+ localGen->CreateRulePlaceholderExpander());
+ rulePlaceholderExpander->ExpandRuleVariables(localGen, compileCmd, vars);
commands.emplace_back(compileCmd);
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr, output,
- { fatbinaryOutputRel }, commands, false);
+ localGen->WriteMakeRule(*this->BuildFileStream, nullptr, output,
+ { fatbinaryOutputRel }, commands, false);
// Clean all the possible executable names and symlinks.
this->CleanFiles.insert(cleanFiles.begin(), cleanFiles.end());