diff options
author | Brad King <brad.king@kitware.com> | 2017-04-28 13:55:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-04-28 13:55:44 (GMT) |
commit | d828d0eb084cf094119d2b47dae0053267aba138 (patch) | |
tree | 00e258c1611d49ebcf08a1eefa58558e40ae3996 | |
parent | 2911d4701675d17b817f8fbe607bb5a493cacf0c (diff) | |
parent | 47990f9fef31eb4369bb01d72a6d86de332ae196 (diff) | |
download | CMake-d828d0eb084cf094119d2b47dae0053267aba138.zip CMake-d828d0eb084cf094119d2b47dae0053267aba138.tar.gz CMake-d828d0eb084cf094119d2b47dae0053267aba138.tar.bz2 |
Merge topic 'refactor-ipo-flags'
47990f9f Inline and remove AddFeatureFlags method
a8667467 Add IPO compiler flags more consistently in generators
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !772
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 4 |
9 files changed, 28 insertions, 34 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 178a7ce..391d65c 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -43,17 +43,6 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) return this->GeneratorTarget->GetFeature(feature, this->ConfigName); } -void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags, - const std::string& lang) -{ - // Add language-specific flags. - this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); - - if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) { - this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); - } -} - void cmCommonTargetGenerator::AddModuleDefinitionFlag( cmLinkLineComputer* linkLineComputer, std::string& flags) { diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 8ba2e22..c36145f 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -28,9 +28,6 @@ public: std::string const& GetConfigName() const; protected: - // Add language feature flags. - void AddFeatureFlags(std::string& flags, const std::string& lang); - // Feature query methods. const char* GetFeature(const std::string& feature); diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index ba623d5..7032cd5 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -232,10 +232,12 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config, const char* lang = language.c_str(); if (notKernel) { - this->LocalGenerator->AddLanguageFlags(flags, lang, config); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + lang, config); } else { - this->LocalGenerator->AddLanguageFlags( - flags, lang + std::string("_GHS_KERNEL"), config); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + lang + std::string("_GHS_KERNEL"), + config); } this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, config); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6636329..d99e3bb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1662,7 +1662,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string& flags = cflags[lang]; // Add language-specific flags. - this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); + this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang, + configName); // Add shared-library flags if needed. this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 424ab6f..57b744c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -985,7 +985,7 @@ void cmLocalGenerator::GetTargetFlags( target->GetName().c_str()); return; } - this->AddLanguageFlags(flags, linkLanguage, buildType); + this->AddLanguageFlags(flags, target, linkLanguage, buildType); if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); @@ -1050,11 +1050,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, cmMakefile* mf = this->GetMakefile(); // Add language-specific flags. - this->AddLanguageFlags(flags, lang, config); - - if (target->IsIPOEnabled(config)) { - this->AppendFeatureOptions(flags, lang, "IPO"); - } + this->AddLanguageFlags(flags, target, lang, config); this->AddArchitectureFlags(flags, target, lang, config); @@ -1287,6 +1283,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, } void cmLocalGenerator::AddLanguageFlags(std::string& flags, + cmGeneratorTarget const* target, const std::string& lang, const std::string& config) { @@ -1295,6 +1292,10 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, flagsVar += lang; flagsVar += "_FLAGS"; this->AddConfigVariableFlags(flags, flagsVar, config); + + if (target->IsIPOEnabled(config)) { + this->AppendFeatureOptions(flags, lang, "IPO"); + } } cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse( diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 1459a05..2eda0e5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -98,8 +98,8 @@ public: const std::string& lang, const std::string& config); - void AddLanguageFlags(std::string& flags, const std::string& lang, - const std::string& config); + void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target, + const std::string& lang, const std::string& config); void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target, std::string const& lang, const std::string& config); void AddVisibilityPresetFlags(std::string& flags, diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index a719887..272d45b 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -150,7 +150,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( linkLanguage, *this->GeneratorTarget)); // Add language feature flags. - this->AddFeatureFlags(flags, linkLanguage); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + linkLanguage, this->ConfigName); this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); @@ -433,7 +434,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } // Add language feature flags. - this->AddFeatureFlags(flags, linkLanguage); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + linkLanguage, this->ConfigName); this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2823977..ec01208 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -395,9 +395,10 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( vars.LinkFlags = linkFlags.c_str(); vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); - // Add language feature flags. + // Add language-specific flags. std::string langFlags; - this->AddFeatureFlags(langFlags, linkLanguage); + this->LocalGenerator->AddLanguageFlags(langFlags, this->GeneratorTarget, + linkLanguage, this->ConfigName); vars.LanguageCompileFlags = langFlags.c_str(); @@ -853,9 +854,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } } - // Add language feature flags. + // Add language-specific flags. std::string langFlags; - this->AddFeatureFlags(langFlags, linkLanguage); + this->LocalGenerator->AddLanguageFlags(langFlags, this->GeneratorTarget, + linkLanguage, this->ConfigName); this->LocalGenerator->AddArchitectureFlags( langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 8206083..54ae196 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -655,7 +655,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName); vars["ARCH_FLAGS"] = t; t = ""; - localGen.AddLanguageFlags(t, cudaLinkLanguage, cfgName); + localGen.AddLanguageFlags(t, &genTarget, cudaLinkLanguage, cfgName); vars["LANGUAGE_COMPILE_FLAGS"] = t; } if (this->GetGeneratorTarget()->HasSOName(cfgName)) { @@ -874,7 +874,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() vars["ARCH_FLAGS"] = t; t = ""; t += lwyuFlags; - localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName); + localGen.AddLanguageFlags(t, &genTarget, TargetLinkLanguage, cfgName); vars["LANGUAGE_COMPILE_FLAGS"] = t; } if (this->GetGeneratorTarget()->HasSOName(cfgName)) { |