Merge topic 'refactor-flags'
802b36fb cmExtraSublimeTextGenerator: Use GetTargetCompileFlags 3c488ce8 cmLocalGenerator: Adopt target compile flag generation 5467e794 cmLocalGenerator: Add method to get Fortran-specific compiler flags 49f10f0d cmGeneratorTarget: Adopt Fortran module directory generation 0392f72b Refactor Makefile/Ninja tool working directory storage
This commit is contained in:
commit
711caeb3bd
@ -19,17 +19,14 @@
|
|||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
cmCommonTargetGenerator::cmCommonTargetGenerator(
|
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
|
||||||
cmOutputConverter::RelativeRoot wd, cmGeneratorTarget* gt)
|
: GeneratorTarget(gt)
|
||||||
: WorkingDirectory(wd)
|
|
||||||
, GeneratorTarget(gt)
|
|
||||||
, Makefile(gt->Makefile)
|
, Makefile(gt->Makefile)
|
||||||
, LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
|
, LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
|
||||||
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
|
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
|
||||||
gt->LocalGenerator->GetGlobalGenerator()))
|
gt->LocalGenerator->GetGlobalGenerator()))
|
||||||
, ConfigName(LocalGenerator->GetConfigName())
|
, ConfigName(LocalGenerator->GetConfigName())
|
||||||
, ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
|
, ModuleDefinitionFile(GeneratorTarget->GetModuleDefinitionFile(ConfigName))
|
||||||
, FortranModuleDirectoryComputed(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,87 +88,6 @@ void cmCommonTargetGenerator::AddModuleDefinitionFlag(std::string& flags)
|
|||||||
this->LocalGenerator->AppendFlags(flags, flag);
|
this->LocalGenerator->AppendFlags(flags, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
|
|
||||||
{
|
|
||||||
std::string mod_dir;
|
|
||||||
const char* target_mod_dir =
|
|
||||||
this->GeneratorTarget->GetProperty("Fortran_MODULE_DIRECTORY");
|
|
||||||
const char* moddir_flag =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
|
|
||||||
if (target_mod_dir && moddir_flag) {
|
|
||||||
// Compute the full path to the module directory.
|
|
||||||
if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
|
|
||||||
// Already a full path.
|
|
||||||
mod_dir = target_mod_dir;
|
|
||||||
} else {
|
|
||||||
// Interpret relative to the current output directory.
|
|
||||||
mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
|
|
||||||
mod_dir += "/";
|
|
||||||
mod_dir += target_mod_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the module output directory exists.
|
|
||||||
cmSystemTools::MakeDirectory(mod_dir);
|
|
||||||
}
|
|
||||||
return mod_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string cmCommonTargetGenerator::GetFortranModuleDirectory()
|
|
||||||
{
|
|
||||||
// Compute the module directory.
|
|
||||||
if (!this->FortranModuleDirectoryComputed) {
|
|
||||||
this->FortranModuleDirectoryComputed = true;
|
|
||||||
this->FortranModuleDirectory = this->ComputeFortranModuleDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the computed directory.
|
|
||||||
return this->FortranModuleDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
|
|
||||||
{
|
|
||||||
// Enable module output if necessary.
|
|
||||||
if (const char* modout_flag =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
|
|
||||||
this->LocalGenerator->AppendFlags(flags, modout_flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a module output directory flag if necessary.
|
|
||||||
std::string mod_dir = this->GetFortranModuleDirectory();
|
|
||||||
if (!mod_dir.empty()) {
|
|
||||||
mod_dir =
|
|
||||||
this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
|
|
||||||
} else {
|
|
||||||
mod_dir =
|
|
||||||
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
|
|
||||||
}
|
|
||||||
if (!mod_dir.empty()) {
|
|
||||||
const char* moddir_flag =
|
|
||||||
this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
|
|
||||||
std::string modflag = moddir_flag;
|
|
||||||
modflag += mod_dir;
|
|
||||||
this->LocalGenerator->AppendFlags(flags, modflag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is a separate module path flag then duplicate the
|
|
||||||
// include path with it. This compiler does not search the include
|
|
||||||
// path for modules.
|
|
||||||
if (const char* modpath_flag =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
|
|
||||||
std::vector<std::string> includes;
|
|
||||||
const std::string& config = this->ConfigName;
|
|
||||||
this->LocalGenerator->GetIncludeDirectories(
|
|
||||||
includes, this->GeneratorTarget, "C", config);
|
|
||||||
for (std::vector<std::string>::const_iterator idi = includes.begin();
|
|
||||||
idi != includes.end(); ++idi) {
|
|
||||||
std::string flg = modpath_flag;
|
|
||||||
flg +=
|
|
||||||
this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL);
|
|
||||||
this->LocalGenerator->AppendFlags(flags, flg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmCommonTargetGenerator::AppendFortranFormatFlags(
|
void cmCommonTargetGenerator::AppendFortranFormatFlags(
|
||||||
std::string& flags, cmSourceFile const& source)
|
std::string& flags, cmSourceFile const& source)
|
||||||
{
|
{
|
||||||
@ -204,36 +120,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l)
|
|||||||
ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
|
ByLanguageMap::iterator i = this->FlagsByLanguage.find(l);
|
||||||
if (i == this->FlagsByLanguage.end()) {
|
if (i == this->FlagsByLanguage.end()) {
|
||||||
std::string flags;
|
std::string flags;
|
||||||
const char* lang = l.c_str();
|
|
||||||
|
|
||||||
// Add language feature flags.
|
this->LocalGenerator->GetTargetCompileFlags(this->GeneratorTarget,
|
||||||
this->AddFeatureFlags(flags, lang);
|
this->ConfigName, l, flags);
|
||||||
|
|
||||||
this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget,
|
|
||||||
lang, this->ConfigName);
|
|
||||||
|
|
||||||
// Fortran-specific flags computed for this target.
|
|
||||||
if (l == "Fortran") {
|
|
||||||
this->AddFortranFlags(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
|
|
||||||
this->ConfigName);
|
|
||||||
|
|
||||||
this->LocalGenerator->AddVisibilityPresetFlags(
|
|
||||||
flags, this->GeneratorTarget, lang);
|
|
||||||
|
|
||||||
// Append old-style preprocessor definition flags.
|
|
||||||
this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags());
|
|
||||||
|
|
||||||
// Add framework directory flags.
|
|
||||||
this->LocalGenerator->AppendFlags(
|
|
||||||
flags, this->LocalGenerator->GetFrameworkFlags(l, this->ConfigName,
|
|
||||||
this->GeneratorTarget));
|
|
||||||
|
|
||||||
// Add target-specific flags.
|
|
||||||
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang,
|
|
||||||
this->ConfigName);
|
|
||||||
|
|
||||||
ByLanguageMap::value_type entry(l, flags);
|
ByLanguageMap::value_type entry(l, flags);
|
||||||
i = this->FlagsByLanguage.insert(entry).first;
|
i = this->FlagsByLanguage.insert(entry).first;
|
||||||
@ -308,7 +197,8 @@ std::string cmCommonTargetGenerator::GetManifests()
|
|||||||
for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
|
for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin();
|
||||||
mi != manifest_srcs.end(); ++mi) {
|
mi != manifest_srcs.end(); ++mi) {
|
||||||
manifests.push_back(this->Convert(
|
manifests.push_back(this->Convert(
|
||||||
(*mi)->GetFullPath(), this->WorkingDirectory, cmOutputConverter::SHELL));
|
(*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(),
|
||||||
|
cmOutputConverter::SHELL));
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmJoin(manifests, " ");
|
return cmJoin(manifests, " ");
|
||||||
|
@ -28,8 +28,7 @@ class cmSourceFile;
|
|||||||
class cmCommonTargetGenerator
|
class cmCommonTargetGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd,
|
cmCommonTargetGenerator(cmGeneratorTarget* gt);
|
||||||
cmGeneratorTarget* gt);
|
|
||||||
virtual ~cmCommonTargetGenerator();
|
virtual ~cmCommonTargetGenerator();
|
||||||
|
|
||||||
std::string const& GetConfigName() const;
|
std::string const& GetConfigName() const;
|
||||||
@ -45,7 +44,6 @@ protected:
|
|||||||
// Helper to add flag for windows .def file.
|
// Helper to add flag for windows .def file.
|
||||||
void AddModuleDefinitionFlag(std::string& flags);
|
void AddModuleDefinitionFlag(std::string& flags);
|
||||||
|
|
||||||
cmOutputConverter::RelativeRoot WorkingDirectory;
|
|
||||||
cmGeneratorTarget* GeneratorTarget;
|
cmGeneratorTarget* GeneratorTarget;
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
cmLocalCommonGenerator* LocalGenerator;
|
cmLocalCommonGenerator* LocalGenerator;
|
||||||
@ -55,15 +53,6 @@ protected:
|
|||||||
// The windows module definition source file (.def), if any.
|
// The windows module definition source file (.def), if any.
|
||||||
cmSourceFile const* ModuleDefinitionFile;
|
cmSourceFile const* ModuleDefinitionFile;
|
||||||
|
|
||||||
// Target-wide Fortran module output directory.
|
|
||||||
bool FortranModuleDirectoryComputed;
|
|
||||||
std::string FortranModuleDirectory;
|
|
||||||
std::string GetFortranModuleDirectory();
|
|
||||||
virtual std::string ComputeFortranModuleDirectory() const;
|
|
||||||
|
|
||||||
// Compute target-specific Fortran language flags.
|
|
||||||
void AddFortranFlags(std::string& flags);
|
|
||||||
|
|
||||||
std::string Convert(
|
std::string Convert(
|
||||||
std::string const& source, cmOutputConverter::RelativeRoot relative,
|
std::string const& source, cmOutputConverter::RelativeRoot relative,
|
||||||
cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
|
cmOutputConverter::OutputFormat output = cmOutputConverter::UNCHANGED);
|
||||||
|
@ -314,27 +314,14 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
|
|||||||
cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt)
|
cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt)
|
||||||
{
|
{
|
||||||
std::string flags;
|
std::string flags;
|
||||||
|
|
||||||
cmMakefile* makefile = lg->GetMakefile();
|
|
||||||
std::string language = source->GetLanguage();
|
std::string language = source->GetLanguage();
|
||||||
if (language.empty()) {
|
if (language.empty()) {
|
||||||
language = "C";
|
language = "C";
|
||||||
}
|
}
|
||||||
const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
std::string const& config =
|
||||||
// Add language-specific flags.
|
lg->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||||
lg->AddLanguageFlags(flags, language, config);
|
|
||||||
|
|
||||||
lg->AddArchitectureFlags(flags, gtgt, language, config);
|
lg->GetTargetCompileFlags(gtgt, config, language, flags);
|
||||||
|
|
||||||
// TODO: Fortran support.
|
|
||||||
// // Fortran-specific flags computed for this target.
|
|
||||||
// if(*l == "Fortran")
|
|
||||||
// {
|
|
||||||
// this->AddFortranFlags(flags);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Add shared-library flags if needed.
|
|
||||||
lg->AddCMP0018Flags(flags, gtgt, language, config);
|
|
||||||
|
|
||||||
// Add include directory flags.
|
// Add include directory flags.
|
||||||
{
|
{
|
||||||
@ -345,17 +332,9 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject(
|
|||||||
lg->AppendFlags(flags, includeFlags);
|
lg->AppendFlags(flags, includeFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append old-style preprocessor definition flags.
|
|
||||||
lg->AppendFlags(flags, makefile->GetDefineFlags());
|
|
||||||
|
|
||||||
// Add target-specific flags.
|
|
||||||
lg->AddCompileOptions(flags, gtgt, language, config);
|
|
||||||
|
|
||||||
// Add source file specific flags.
|
// Add source file specific flags.
|
||||||
lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
|
lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS"));
|
||||||
|
|
||||||
// TODO: Handle Apple frameworks.
|
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +258,7 @@ void CreatePropertyGeneratorExpressions(
|
|||||||
|
|
||||||
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||||
: Target(t)
|
: Target(t)
|
||||||
|
, FortranModuleDirectoryCreated(false)
|
||||||
, SourceFileFlagsConstructed(false)
|
, SourceFileFlagsConstructed(false)
|
||||||
, PolicyWarnedCMP0022(false)
|
, PolicyWarnedCMP0022(false)
|
||||||
, DebugIncludesDone(false)
|
, DebugIncludesDone(false)
|
||||||
@ -3842,6 +3843,40 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmGeneratorTarget::GetFortranModuleDirectory() const
|
||||||
|
{
|
||||||
|
if (!this->FortranModuleDirectoryCreated) {
|
||||||
|
this->FortranModuleDirectory = true;
|
||||||
|
this->FortranModuleDirectory = this->CreateFortranModuleDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->FortranModuleDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string cmGeneratorTarget::CreateFortranModuleDirectory() const
|
||||||
|
{
|
||||||
|
static std::string mod_dir;
|
||||||
|
const char* target_mod_dir = this->GetProperty("Fortran_MODULE_DIRECTORY");
|
||||||
|
const char* moddir_flag =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG");
|
||||||
|
if (target_mod_dir && moddir_flag) {
|
||||||
|
// Compute the full path to the module directory.
|
||||||
|
if (cmSystemTools::FileIsFullPath(target_mod_dir)) {
|
||||||
|
// Already a full path.
|
||||||
|
mod_dir = target_mod_dir;
|
||||||
|
} else {
|
||||||
|
// Interpret relative to the current output directory.
|
||||||
|
mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
|
||||||
|
mod_dir += "/";
|
||||||
|
mod_dir += target_mod_dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the module output directory exists.
|
||||||
|
cmSystemTools::MakeDirectory(mod_dir);
|
||||||
|
}
|
||||||
|
return mod_dir;
|
||||||
|
}
|
||||||
|
|
||||||
std::string cmGeneratorTarget::GetFrameworkVersion() const
|
std::string cmGeneratorTarget::GetFrameworkVersion() const
|
||||||
{
|
{
|
||||||
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
|
assert(this->GetType() != cmState::INTERFACE_LIBRARY);
|
||||||
|
@ -526,7 +526,13 @@ public:
|
|||||||
void GetTargetVersion(bool soversion, int& major, int& minor,
|
void GetTargetVersion(bool soversion, int& major, int& minor,
|
||||||
int& patch) const;
|
int& patch) const;
|
||||||
|
|
||||||
|
std::string GetFortranModuleDirectory() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string CreateFortranModuleDirectory() const;
|
||||||
|
mutable bool FortranModuleDirectoryCreated;
|
||||||
|
mutable std::string FortranModuleDirectory;
|
||||||
|
|
||||||
friend class cmTargetTraceDependencies;
|
friend class cmTargetTraceDependencies;
|
||||||
struct SourceEntry
|
struct SourceEntry
|
||||||
{
|
{
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
|
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
|
||||||
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
|
cmLocalCommonGenerator::cmLocalCommonGenerator(
|
||||||
cmMakefile* mf)
|
cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd)
|
||||||
: cmLocalGenerator(gg, mf)
|
: cmLocalGenerator(gg, mf)
|
||||||
|
, WorkingDirectory(wd)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,3 +35,50 @@ void cmLocalCommonGenerator::SetConfigName()
|
|||||||
this->ConfigName = "";
|
this->ConfigName = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmLocalCommonGenerator::GetTargetFortranFlags(
|
||||||
|
cmGeneratorTarget const* target, std::string const& config)
|
||||||
|
{
|
||||||
|
std::string flags;
|
||||||
|
|
||||||
|
// Enable module output if necessary.
|
||||||
|
if (const char* modout_flag =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_Fortran_MODOUT_FLAG")) {
|
||||||
|
this->AppendFlags(flags, modout_flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a module output directory flag if necessary.
|
||||||
|
std::string mod_dir = target->GetFortranModuleDirectory();
|
||||||
|
if (!mod_dir.empty()) {
|
||||||
|
mod_dir =
|
||||||
|
this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL);
|
||||||
|
} else {
|
||||||
|
mod_dir =
|
||||||
|
this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
|
||||||
|
}
|
||||||
|
if (!mod_dir.empty()) {
|
||||||
|
const char* moddir_flag =
|
||||||
|
this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG");
|
||||||
|
std::string modflag = moddir_flag;
|
||||||
|
modflag += mod_dir;
|
||||||
|
this->AppendFlags(flags, modflag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is a separate module path flag then duplicate the
|
||||||
|
// include path with it. This compiler does not search the include
|
||||||
|
// path for modules.
|
||||||
|
if (const char* modpath_flag =
|
||||||
|
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
|
||||||
|
std::vector<std::string> includes;
|
||||||
|
this->GetIncludeDirectories(includes, target, "C", config);
|
||||||
|
for (std::vector<std::string>::const_iterator idi = includes.begin();
|
||||||
|
idi != includes.end(); ++idi) {
|
||||||
|
std::string flg = modpath_flag;
|
||||||
|
flg +=
|
||||||
|
this->Convert(*idi, cmOutputConverter::NONE, cmOutputConverter::SHELL);
|
||||||
|
this->AppendFlags(flags, flg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
@ -22,12 +22,23 @@ class cmCommonTargetGenerator;
|
|||||||
class cmLocalCommonGenerator : public cmLocalGenerator
|
class cmLocalCommonGenerator : public cmLocalGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
|
cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf,
|
||||||
|
cmOutputConverter::RelativeRoot wd);
|
||||||
~cmLocalCommonGenerator();
|
~cmLocalCommonGenerator();
|
||||||
|
|
||||||
std::string const& GetConfigName() { return this->ConfigName; }
|
std::string const& GetConfigName() { return this->ConfigName; }
|
||||||
|
|
||||||
|
cmOutputConverter::RelativeRoot GetWorkingDirectory() const
|
||||||
|
{
|
||||||
|
return this->WorkingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
|
||||||
|
std::string const& config);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
cmOutputConverter::RelativeRoot WorkingDirectory;
|
||||||
|
|
||||||
void SetConfigName();
|
void SetConfigName();
|
||||||
std::string ConfigName;
|
std::string ConfigName;
|
||||||
|
|
||||||
|
@ -1272,6 +1272,33 @@ void cmLocalGenerator::GetTargetFlags(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target,
|
||||||
|
std::string const& config,
|
||||||
|
std::string const& lang,
|
||||||
|
std::string& flags)
|
||||||
|
{
|
||||||
|
cmMakefile* mf = this->GetMakefile();
|
||||||
|
|
||||||
|
// Add language-specific flags.
|
||||||
|
this->AddLanguageFlags(flags, lang, config);
|
||||||
|
|
||||||
|
if (target->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
|
||||||
|
this->AppendFeatureOptions(flags, lang, "IPO");
|
||||||
|
}
|
||||||
|
|
||||||
|
this->AddArchitectureFlags(flags, target, lang, config);
|
||||||
|
|
||||||
|
if (lang == "Fortran") {
|
||||||
|
this->AppendFlags(flags, this->GetTargetFortranFlags(target, config));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->AddCMP0018Flags(flags, target, lang, config);
|
||||||
|
this->AddVisibilityPresetFlags(flags, target, lang);
|
||||||
|
this->AppendFlags(flags, mf->GetDefineFlags());
|
||||||
|
this->AppendFlags(flags, this->GetFrameworkFlags(lang, config, target));
|
||||||
|
this->AddCompileOptions(flags, target, lang, config);
|
||||||
|
}
|
||||||
|
|
||||||
static std::string GetFrameworkFlags(const std::string& lang,
|
static std::string GetFrameworkFlags(const std::string& lang,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
cmGeneratorTarget* target)
|
cmGeneratorTarget* target)
|
||||||
@ -1344,6 +1371,13 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target,
|
|||||||
this->AddCompileDefinitions(defines, target, config, lang.c_str());
|
this->AddCompileDefinitions(defines, target, config, lang.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmLocalGenerator::GetTargetFortranFlags(cmGeneratorTarget const*,
|
||||||
|
std::string const&)
|
||||||
|
{
|
||||||
|
// Implemented by specific generators that override this.
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
|
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
|
||||||
OutputFormat format)
|
OutputFormat format)
|
||||||
{
|
{
|
||||||
|
@ -317,10 +317,15 @@ public:
|
|||||||
void GetTargetDefines(cmGeneratorTarget const* target,
|
void GetTargetDefines(cmGeneratorTarget const* target,
|
||||||
std::string const& config, std::string const& lang,
|
std::string const& config, std::string const& lang,
|
||||||
std::set<std::string>& defines) const;
|
std::set<std::string>& defines) const;
|
||||||
|
void GetTargetCompileFlags(cmGeneratorTarget* target,
|
||||||
|
std::string const& config,
|
||||||
|
std::string const& lang, std::string& flags);
|
||||||
|
|
||||||
std::string GetFrameworkFlags(std::string const& l,
|
std::string GetFrameworkFlags(std::string const& l,
|
||||||
std::string const& config,
|
std::string const& config,
|
||||||
cmGeneratorTarget* target);
|
cmGeneratorTarget* target);
|
||||||
|
virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
|
||||||
|
std::string const& config);
|
||||||
|
|
||||||
virtual void ComputeObjectFilenames(
|
virtual void ComputeObjectFilenames(
|
||||||
std::map<cmSourceFile const*, std::string>& mapping,
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
|
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
: cmLocalCommonGenerator(gg, mf)
|
: cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT)
|
||||||
, HomeRelativeOutputPath("")
|
, HomeRelativeOutputPath("")
|
||||||
{
|
{
|
||||||
this->TargetImplib = "$TARGET_IMPLIB";
|
this->TargetImplib = "$TARGET_IMPLIB";
|
||||||
|
@ -84,7 +84,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
|
|||||||
|
|
||||||
cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(
|
cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3(
|
||||||
cmGlobalGenerator* gg, cmMakefile* mf)
|
cmGlobalGenerator* gg, cmMakefile* mf)
|
||||||
: cmLocalCommonGenerator(gg, mf)
|
: cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT)
|
||||||
{
|
{
|
||||||
this->MakefileVariableSize = 0;
|
this->MakefileVariableSize = 0;
|
||||||
this->ColorMakefile = false;
|
this->ColorMakefile = false;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
|
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
|
||||||
: cmCommonTargetGenerator(cmOutputConverter::START_OUTPUT, target)
|
: cmCommonTargetGenerator(target)
|
||||||
, OSXBundleGenerator(0)
|
, OSXBundleGenerator(0)
|
||||||
, MacOSXContentGenerator(0)
|
, MacOSXContentGenerator(0)
|
||||||
{
|
{
|
||||||
@ -962,7 +962,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "# Fortran module output directory.\n"
|
<< "# Fortran module output directory.\n"
|
||||||
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
|
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
|
||||||
<< this->GetFortranModuleDirectory() << "\")\n";
|
<< this->GeneratorTarget->GetFortranModuleDirectory() << "\")\n";
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
// and now write the rule to use it
|
// and now write the rule to use it
|
||||||
|
@ -58,7 +58,7 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
|
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
|
||||||
: cmCommonTargetGenerator(cmOutputConverter::HOME_OUTPUT, target)
|
: cmCommonTargetGenerator(target)
|
||||||
, MacOSXContentGenerator(0)
|
, MacOSXContentGenerator(0)
|
||||||
, OSXBundleGenerator(0)
|
, OSXBundleGenerator(0)
|
||||||
, MacContentFolders()
|
, MacContentFolders()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user