MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteDeviceExecutableRule

Method WriteDeviceExecutableRule

Source/cmMakefileExecutableTargetGenerator.cxx:87–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
88 bool relink)
89{
90#ifndef CMAKE_BOOTSTRAP
91 bool const requiresDeviceLinking = requireDeviceLinking(
92 *this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
93 if (!requiresDeviceLinking) {
94 return;
95 }
96
97 std::vector<std::string> commands;
98
99 // Get the name of the device object to generate.
100 std::string const& objExt =
101 this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
102 std::string const targetOutput =
103 this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt;
104 this->DeviceLinkObject = targetOutput;
105
106 this->NumberOfProgressActions++;
107 if (!this->NoRuleMessages) {
108 cmLocalUnixMakefileGenerator3::EchoProgress progress;
109 this->MakeEchoProgress(progress);
110 // Add the link message.
111 std::string buildEcho = cmStrCat(
112 "Linking CUDA device code ",
113 this->LocalGenerator->ConvertToOutputFormat(
114 this->LocalGenerator->MaybeRelativeToCurBinDir(this->DeviceLinkObject),
115 cmOutputConverter::SHELL));
116 this->LocalGenerator->AppendEcho(
117 commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
118 }
119
120 if (this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID") == "Clang") {
121 this->WriteDeviceLinkRule(commands, targetOutput);
122 } else {
123 this->WriteNvidiaDeviceExecutableRule(relink, commands, targetOutput);
124 }
125
126 // Write the main driver rule to build everything in this target.
127 this->WriteTargetDriverRule(targetOutput, relink);
128#else
129 static_cast<void>(relink);
130#endif
131}
132
133void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
134 bool relink, std::vector<std::string>& commands,

Callers 1

WriteRuleFilesMethod · 0.95

Calls 9

requireDeviceLinkingFunction · 0.85
MakeEchoProgressMethod · 0.80
AppendEchoMethod · 0.80
WriteDeviceLinkRuleMethod · 0.80
WriteTargetDriverRuleMethod · 0.80
cmStrCatFunction · 0.70
ConvertToOutputFormatMethod · 0.45

Tested by

no test coverage detected