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

Method WriteNvidiaDeviceLibraryRules

Source/cmMakefileLibraryTargetGenerator.cxx:301–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
302 std::string const& linkRuleVar, bool relink,
303 std::vector<std::string>& commands, std::string const& targetOutput)
304{
305 std::string linkLanguage = "CUDA";
306
307 // Build list of dependencies.
308 std::vector<std::string> depends;
309 this->AppendLinkDepends(depends, linkLanguage);
310
311 // Add language-specific flags.
312 std::string langFlags;
313 this->LocalGenerator->AddLanguageFlagsForLinking(
314 langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
315
316 // Clean files associated with this library.
317 std::set<std::string> libCleanFiles;
318 libCleanFiles.insert(
319 this->LocalGenerator->MaybeRelativeToCurBinDir(targetOutput));
320
321 // Determine whether a link script will be used.
322 bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
323
324 bool useResponseFileForObjects =
325 this->CheckUseResponseFileForObjects(linkLanguage);
326 bool const useResponseFileForLibs =
327 this->CheckUseResponseFileForLibraries(linkLanguage);
328
329 cmRulePlaceholderExpander::RuleVariables vars;
330 vars.Language = linkLanguage.c_str();
331
332 // Expand the rule variables.
333 cmList real_link_commands;
334 {
335 // Set path conversion for link script shells.
336 this->LocalGenerator->SetLinkScriptShell(useLinkScript);
337
338 // Collect up flags to link in needed libraries.
339 std::string linkLibs;
340 std::unique_ptr<cmLinkLineDeviceComputer> linkLineComputer(
341 new cmLinkLineDeviceComputer(
342 this->LocalGenerator,
343 this->LocalGenerator->GetStateSnapshot().GetDirectory()));
344 linkLineComputer->SetForResponse(useResponseFileForLibs);
345 linkLineComputer->SetRelink(relink);
346
347 // Create set of linking flags.
348 std::string linkFlags;
349 std::string ignored_;
350 this->LocalGenerator->GetDeviceLinkFlags(
351 *linkLineComputer, this->GetConfigName(), ignored_, linkFlags, ignored_,
352 ignored_, this->GeneratorTarget);
353
354 this->CreateLinkLibs(
355 linkLineComputer.get(), linkLibs, useResponseFileForLibs, depends,
356 linkLanguage, cmMakefileTargetGenerator::ResponseFlagFor::DeviceLink);
357
358 // Construct object file lists that may be needed to expand the

Calls 15

cmNonemptyFunction · 0.85
appendFunction · 0.85
AppendLinkDependsMethod · 0.80
GetUseLinkScriptMethod · 0.80
c_strMethod · 0.80
SetLinkScriptShellMethod · 0.80
SetForResponseMethod · 0.80
SetRelinkMethod · 0.80
CreateLinkLibsMethod · 0.80

Tested by

no test coverage detected