mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-25 10:18:34 -06:00
Refactor: Prepare Ninja generator for multi-config
This commit is contained in:
@@ -35,10 +35,9 @@ cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
|
||||
{
|
||||
this->CustomCommandDriver = OnDepends;
|
||||
this->TargetNames =
|
||||
this->GeneratorTarget->GetExecutableNames(this->ConfigName);
|
||||
this->GeneratorTarget->GetExecutableNames(this->GetConfigName());
|
||||
|
||||
this->OSXBundleGenerator =
|
||||
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
|
||||
this->OSXBundleGenerator = cm::make_unique<cmOSXBundleGenerator>(target);
|
||||
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ void cmMakefileExecutableTargetGenerator::WriteRuleFiles()
|
||||
|
||||
// write the link rules
|
||||
this->WriteExecutableRule(false);
|
||||
if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) {
|
||||
if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->GetConfigName())) {
|
||||
// Write rules to link an installable version of the target.
|
||||
this->WriteExecutableRule(true);
|
||||
}
|
||||
@@ -85,7 +84,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
|
||||
{
|
||||
#ifndef CMAKE_BOOTSTRAP
|
||||
const bool requiresDeviceLinking = requireDeviceLinking(
|
||||
*this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
|
||||
*this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
|
||||
if (!requiresDeviceLinking) {
|
||||
return;
|
||||
}
|
||||
@@ -141,10 +140,10 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
|
||||
|
||||
// Add language feature flags.
|
||||
this->LocalGenerator->AddLanguageFlagsForLinking(
|
||||
flags, this->GeneratorTarget, linkLanguage, this->ConfigName);
|
||||
flags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
|
||||
|
||||
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
|
||||
linkLanguage, this->ConfigName);
|
||||
this->LocalGenerator->AddArchitectureFlags(
|
||||
flags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
|
||||
|
||||
// Add target-specific linker flags.
|
||||
this->GetTargetLinkFlags(linkFlags, linkLanguage);
|
||||
@@ -213,7 +212,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
|
||||
this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal),
|
||||
output);
|
||||
|
||||
std::string targetFullPathCompilePDB = this->ComputeTargetCompilePDB();
|
||||
std::string targetFullPathCompilePDB =
|
||||
this->ComputeTargetCompilePDB(this->GetConfigName());
|
||||
std::string targetOutPathCompilePDB =
|
||||
this->LocalGenerator->ConvertToOutputFormat(targetFullPathCompilePDB,
|
||||
cmOutputConverter::SHELL);
|
||||
@@ -287,12 +287,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
|
||||
// Get the name of the executable to generate.
|
||||
cmGeneratorTarget::Names targetNames =
|
||||
this->GeneratorTarget->GetExecutableNames(this->ConfigName);
|
||||
this->GeneratorTarget->GetExecutableNames(this->GetConfigName());
|
||||
|
||||
// Construct the full path version of the names.
|
||||
std::string outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
|
||||
std::string outpath =
|
||||
this->GeneratorTarget->GetDirectory(this->GetConfigName());
|
||||
if (this->GeneratorTarget->IsAppBundleOnApple()) {
|
||||
this->OSXBundleGenerator->CreateAppBundle(targetNames.Output, outpath);
|
||||
this->OSXBundleGenerator->CreateAppBundle(targetNames.Output, outpath,
|
||||
this->GetConfigName());
|
||||
}
|
||||
outpath += '/';
|
||||
std::string outpathImp;
|
||||
@@ -308,18 +310,18 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
cmSystemTools::MakeDirectory(outpath);
|
||||
if (!targetNames.ImportLibrary.empty()) {
|
||||
outpathImp = this->GeneratorTarget->GetDirectory(
|
||||
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
|
||||
this->GetConfigName(), cmStateEnums::ImportLibraryArtifact);
|
||||
cmSystemTools::MakeDirectory(outpathImp);
|
||||
outpathImp += '/';
|
||||
}
|
||||
}
|
||||
|
||||
std::string compilePdbOutputPath =
|
||||
this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
|
||||
this->GeneratorTarget->GetCompilePDBDirectory(this->GetConfigName());
|
||||
cmSystemTools::MakeDirectory(compilePdbOutputPath);
|
||||
|
||||
std::string pdbOutputPath =
|
||||
this->GeneratorTarget->GetPDBDirectory(this->ConfigName);
|
||||
this->GeneratorTarget->GetPDBDirectory(this->GetConfigName());
|
||||
cmSystemTools::MakeDirectory(pdbOutputPath);
|
||||
pdbOutputPath += '/';
|
||||
|
||||
@@ -347,7 +349,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
|
||||
// Get the language to use for linking this executable.
|
||||
std::string linkLanguage =
|
||||
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
|
||||
this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName());
|
||||
|
||||
// Make sure we have a link language.
|
||||
if (linkLanguage.empty()) {
|
||||
@@ -380,7 +382,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
|
||||
// Add flags to create an executable.
|
||||
this->LocalGenerator->AddConfigVariableFlags(
|
||||
linkFlags, "CMAKE_EXE_LINKER_FLAGS", this->ConfigName);
|
||||
linkFlags, "CMAKE_EXE_LINKER_FLAGS", this->GetConfigName());
|
||||
|
||||
if (this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE")) {
|
||||
this->LocalGenerator->AppendFlags(
|
||||
@@ -409,10 +411,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
|
||||
// Add language feature flags.
|
||||
this->LocalGenerator->AddLanguageFlagsForLinking(
|
||||
flags, this->GeneratorTarget, linkLanguage, this->ConfigName);
|
||||
flags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
|
||||
|
||||
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
|
||||
linkLanguage, this->ConfigName);
|
||||
this->LocalGenerator->AddArchitectureFlags(
|
||||
flags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
|
||||
|
||||
// Add target-specific linker flags.
|
||||
this->GetTargetLinkFlags(linkFlags, linkLanguage);
|
||||
@@ -423,11 +425,12 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
this->LocalGenerator,
|
||||
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
|
||||
|
||||
this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags);
|
||||
this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags,
|
||||
this->GetConfigName());
|
||||
}
|
||||
|
||||
this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget,
|
||||
this->ConfigName, linkLanguage);
|
||||
this->LocalGenerator->AppendIPOLinkerFlags(
|
||||
linkFlags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
|
||||
|
||||
// Construct a list of files associated with this executable that
|
||||
// may need to be cleaned.
|
||||
@@ -451,7 +454,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
targetFullPathImport));
|
||||
std::string implib;
|
||||
if (this->GeneratorTarget->GetImplibGNUtoMS(
|
||||
this->ConfigName, targetFullPathImport, implib)) {
|
||||
this->GetConfigName(), targetFullPathImport, implib)) {
|
||||
exeCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath(
|
||||
this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
|
||||
}
|
||||
@@ -479,7 +482,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
// Construct the main link rule.
|
||||
std::vector<std::string> real_link_commands;
|
||||
std::string linkRuleVar = this->GeneratorTarget->GetCreateRuleVariable(
|
||||
linkLanguage, this->ConfigName);
|
||||
linkLanguage, this->GetConfigName());
|
||||
std::string linkRule = this->GetLinkRule(linkRuleVar);
|
||||
std::vector<std::string> commands1;
|
||||
cmExpandList(linkRule, real_link_commands);
|
||||
@@ -536,7 +539,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
// maybe create .def file from list of objects
|
||||
this->GenDefFile(real_link_commands);
|
||||
|
||||
std::string manifests = this->GetManifests();
|
||||
std::string manifests = this->GetManifests(this->GetConfigName());
|
||||
|
||||
cmRulePlaceholderExpander::RuleVariables vars;
|
||||
vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
|
||||
|
||||
Reference in New Issue
Block a user