mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 19:49:51 +00:00
Merge topic 'unity-step'
83c1657ff7
Unity build: Generate sources during Compute step
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3884
This commit is contained in:
commit
395e5f77fc
@ -1381,6 +1381,11 @@ bool cmGlobalGenerator::Compute()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add automatically generated sources (e.g. unity build).
|
||||
if (!this->AddAutomaticSources()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add generator specific helper commands
|
||||
for (cmLocalGenerator* localGen : this->LocalGenerators) {
|
||||
localGen->AddHelperCommands();
|
||||
@ -1548,6 +1553,19 @@ bool cmGlobalGenerator::QtAutoGen()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::AddAutomaticSources()
|
||||
{
|
||||
for (cmLocalGenerator* lg : this->LocalGenerators) {
|
||||
for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) {
|
||||
if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
|
||||
continue;
|
||||
}
|
||||
lg->AddUnityBuild(gt);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
|
||||
cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
|
||||
{
|
||||
|
@ -503,6 +503,8 @@ protected:
|
||||
/// @return true on success
|
||||
bool QtAutoGen();
|
||||
|
||||
bool AddAutomaticSources();
|
||||
|
||||
std::string SelectMakeProgram(const std::string& makeProgram,
|
||||
const std::string& makeDefault = "") const;
|
||||
|
||||
|
@ -2827,7 +2827,6 @@ bool cmGlobalXCodeGenerator::CreateGroups(
|
||||
continue;
|
||||
}
|
||||
|
||||
generator->AddUnityBuild(gtgt, "");
|
||||
generator->AddPchDependencies(gtgt, "");
|
||||
|
||||
auto addSourceToGroup = [this, mf, gtgt,
|
||||
|
@ -2452,13 +2452,18 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
|
||||
}
|
||||
}
|
||||
|
||||
void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target,
|
||||
const std::string& config)
|
||||
void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
|
||||
{
|
||||
if (!target->GetPropertyAsBool("UNITY_BUILD")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: Handle all configurations in multi-config generators.
|
||||
std::string config;
|
||||
if (!this->GetGlobalGenerator()->IsMultiConfig()) {
|
||||
config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
}
|
||||
|
||||
const std::string buildType = cmSystemTools::UpperCase(config);
|
||||
|
||||
std::string filename_base =
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
const std::string& rawFlag) const;
|
||||
void AddPchDependencies(cmGeneratorTarget* target,
|
||||
const std::string& config);
|
||||
void AddUnityBuild(cmGeneratorTarget* target, const std::string& config);
|
||||
void AddUnityBuild(cmGeneratorTarget* target);
|
||||
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
|
||||
const std::string& config,
|
||||
const std::string& lang);
|
||||
|
@ -1313,7 +1313,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
|
||||
const std::string& libName,
|
||||
cmGeneratorTarget* target)
|
||||
{
|
||||
this->AddUnityBuild(target, "");
|
||||
this->AddPchDependencies(target, "");
|
||||
|
||||
std::vector<std::string> configs;
|
||||
|
@ -41,7 +41,6 @@ cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
|
||||
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
|
||||
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||
|
||||
this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
|
||||
this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
|
||||
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
|
||||
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||
|
||||
this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
|
||||
this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
|
||||
cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
|
||||
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||
|
||||
this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
|
||||
this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,6 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
|
||||
cm::make_unique<cmOSXBundleGenerator>(target, this->GetConfigName());
|
||||
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
|
||||
|
||||
GetLocalGenerator()->AddUnityBuild(target, this->GetConfigName());
|
||||
GetLocalGenerator()->AddPchDependencies(target, this->GetConfigName());
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,6 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
|
||||
this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
|
||||
this->Makefile->GetCurrentBinaryDirectory());
|
||||
|
||||
this->LocalGenerator->AddUnityBuild(target, "");
|
||||
this->LocalGenerator->AddPchDependencies(target, "");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user