summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.h')
-rw-r--r--Source/cmLocalGenerator.h184
1 files changed, 35 insertions, 149 deletions
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index d64ae0f..98f4d3a 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -13,6 +13,9 @@
#define cmLocalGenerator_h
#include "cmStandardIncludes.h"
+#include "cmState.h"
+#include "cmake.h"
+#include "cmOutputConverter.h"
class cmMakefile;
class cmGlobalGenerator;
@@ -30,10 +33,11 @@ class cmCustomCommandGenerator;
* platforms. This class should never be constructed directly. A
* GlobalGenerator will create it and invoke the appropriate commands on it.
*/
-class cmLocalGenerator
+class cmLocalGenerator : public cmOutputConverter
{
public:
- cmLocalGenerator();
+ cmLocalGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent,
+ cmState::Snapshot snapshot);
virtual ~cmLocalGenerator();
/**
@@ -41,11 +45,7 @@ public:
*/
virtual void Generate() {}
- /**
- * Process the CMakeLists files for this directory to fill in the
- * Makefile ivar
- */
- virtual void Configure();
+ virtual void ComputeHomeRelativeOutputPath() {}
/**
* Calls TraceVSDependencies() on all targets of this generator.
@@ -55,11 +55,6 @@ public:
virtual void AddHelperCommands() {}
/**
- * Perform any final calculations prior to generation
- */
- void ConfigureFinalPass();
-
- /**
* Generate the install rules files in this directory.
*/
void GenerateInstallRules();
@@ -88,68 +83,30 @@ public:
const cmGlobalGenerator *GetGlobalGenerator() const {
return this->GlobalGenerator; }
- ///! Set the Global Generator, done on creation by the GlobalGenerator
- void SetGlobalGenerator(cmGlobalGenerator *gg);
-
- /**
- * Convert something to something else. This is a centralized conversion
- * routine used by the generators to handle relative paths and the like.
- * The flags determine what is actually done.
- *
- * relative: treat the argument as a directory and convert it to make it
- * relative or full or unchanged. If relative (HOME, START etc) then that
- * specifies what it should be relative to.
- *
- * output: make the result suitable for output to a...
- *
- * optional: should any relative path operation be controlled by the rel
- * path setting
- */
- enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
- enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE };
- std::string ConvertToOutputFormat(const std::string& source,
- OutputFormat output);
- std::string Convert(const std::string& remote, RelativeRoot local,
- OutputFormat output = UNCHANGED,
- bool optional = false);
- std::string Convert(RelativeRoot remote, const std::string& local,
- OutputFormat output = UNCHANGED,
- bool optional = false);
-
- /**
- * Get path for the specified relative root.
- */
- const char* GetRelativeRootPath(RelativeRoot relroot);
-
- /**
- * Convert the given path to an output path that is optionally
- * relative based on the cache option CMAKE_USE_RELATIVE_PATHS. The
- * remote path must use forward slashes and not already be escaped
- * or quoted.
- */
- std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote);
+ cmState* GetState() const;
+ cmState::Snapshot GetStateSnapshot() const;
///! set/get the parent generator
cmLocalGenerator* GetParent() const {return this->Parent;}
- void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); }
///! set/get the children
void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); }
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; }
- void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target,
+ void AddArchitectureFlags(std::string& flags,
+ cmGeneratorTarget const* target,
const std::string&lang, const std::string& config);
void AddLanguageFlags(std::string& flags, const std::string& lang,
const std::string& config);
- void AddCMP0018Flags(std::string &flags, cmTarget* target,
+ void AddCMP0018Flags(std::string &flags, cmTarget const* target,
std::string const& lang, const std::string& config);
- void AddVisibilityPresetFlags(std::string &flags, cmTarget* target,
+ void AddVisibilityPresetFlags(std::string &flags, cmTarget const* target,
const std::string& lang);
void AddConfigVariableFlags(std::string& flags, const std::string& var,
const std::string& config);
- void AddCompilerRequirementFlag(std::string &flags, cmTarget* target,
+ void AddCompilerRequirementFlag(std::string &flags, cmTarget const* target,
const std::string& lang);
///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const std::string& newFlags);
@@ -189,6 +146,9 @@ public:
void AppendFeatureOptions(std::string& flags, const std::string& lang,
const char* feature);
+ const char* GetFeature(const std::string& feature,
+ const std::string& config);
+
/** \brief Get absolute path to dependency \a name
*
* Translate a dependency as given in CMake code to the name to
@@ -204,17 +164,6 @@ public:
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
- ///! for existing files convert to output path and short path if spaces
- std::string ConvertToOutputForExisting(const std::string& remote,
- RelativeRoot local = START_OUTPUT,
- OutputFormat format = SHELL);
-
- /** For existing path identified by RelativeRoot convert to output
- path and short path if spaces. */
- std::string ConvertToOutputForExisting(RelativeRoot remote,
- const std::string& local = "",
- OutputFormat format = SHELL);
-
virtual std::string ConvertToIncludeReference(std::string const& path,
OutputFormat format = SHELL,
bool forceFullPaths = false);
@@ -234,12 +183,13 @@ public:
cmGeneratorTarget* target,
const std::string& lang = "C",
const std::string& config = "",
- bool stripImplicitInclDirs = true);
+ bool stripImplicitInclDirs = true) const;
void AddCompileOptions(std::string& flags, cmTarget* target,
const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target,
- const std::string& config);
+ const std::string& config,
+ const std::string& lang);
/** Compute the language used to compile the given source file. */
std::string GetSourceFileLanguage(const cmSourceFile& source);
@@ -285,43 +235,6 @@ public:
const char* FilterPrefix;
};
- /** Set whether to treat conversions to SHELL as a link script shell. */
- void SetLinkScriptShell(bool b) { this->LinkScriptShell = b; }
-
- /** Escape the given string to be used as a command line argument in
- the native build system shell. Optionally allow the build
- system to replace make variable references. Optionally adjust
- escapes for the special case of passing to the native echo
- command. */
- std::string EscapeForShell(const std::string& str, bool makeVars = false,
- bool forEcho = false,
- bool useWatcomQuote = false);
-
- /** Backwards-compatibility version of EscapeForShell. */
- std::string EscapeForShellOldStyle(const std::string& str);
-
- /** Escape the given string as an argument in a CMake script. */
- static std::string EscapeForCMake(const std::string& str);
-
- enum FortranFormat
- {
- FortranFormatNone,
- FortranFormatFixed,
- FortranFormatFree
- };
- FortranFormat GetFortranFormat(const char* value);
-
- /**
- * Convert the given remote path to a relative path with respect to
- * the given local path. The local path must be given in component
- * form (see SystemTools::SplitPath) without a trailing slash. The
- * remote path must use forward slashes and not already be escaped
- * or quoted.
- */
- std::string ConvertToRelativePath(const std::vector<std::string>& local,
- const std::string& remote,
- bool force=false);
-
/**
* Get the relative path from the generator output directory to a
* per-target support directory.
@@ -384,9 +297,18 @@ public:
std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt = 0);
+ bool IsWindowsShell() const;
+ bool IsWatcomWMake() const;
+ bool IsMinGWMake() const;
+ bool IsNMake() const;
+
+ void IssueMessage(cmake::MessageType t, std::string const& text) const;
+
+
+ void ComputeObjectMaxPath();
protected:
///! put all the libraries for a target on into the given stream
- virtual void OutputLinkLibraries(std::string& linkLibraries,
+ void OutputLinkLibraries(std::string& linkLibraries,
std::string& frameworkPath,
std::string& linkPath,
cmGeneratorTarget &,
@@ -429,12 +351,6 @@ protected:
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
- void ComputeObjectMaxPath();
-
- void ConfigureRelativePaths();
- std::string FindRelativePathTopSource();
- std::string FindRelativePathTopBinary();
- void SetupPathConversions();
virtual std::string ConvertToLinkReference(std::string const& lib,
OutputFormat format = SHELL);
@@ -443,56 +359,26 @@ protected:
definition. Issues a warning. */
virtual bool CheckDefinition(std::string const& define) const;
- /** Read the input CMakeLists.txt file. */
- void ReadInputFile();
-
cmMakefile *Makefile;
+ cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;
- // members used for relative path function ConvertToMakefilePath
- std::string RelativePathToSourceDir;
- std::string RelativePathToBinaryDir;
- std::vector<std::string> HomeDirectoryComponents;
- std::vector<std::string> StartDirectoryComponents;
- std::vector<std::string> HomeOutputDirectoryComponents;
- std::vector<std::string> StartOutputDirectoryComponents;
cmLocalGenerator* Parent;
std::vector<cmLocalGenerator*> Children;
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
- bool WindowsShell;
- bool WindowsVSIDE;
- bool WatcomWMake;
- bool MinGWMake;
- bool NMake;
- bool ForceUnixPath;
- bool MSYSShell;
- bool LinkScriptShell;
- bool UseRelativePaths;
- bool IgnoreLibPrefix;
- bool Configured;
+
+ std::set<cmTarget const*> WarnCMP0063;
+
bool EmitUniversalBinaryFlags;
+
// Hack for ExpandRuleVariable until object-oriented version is
// committed.
std::string TargetImplib;
- // The top-most directories for relative path conversion. Both the
- // source and destination location of a relative path conversion
- // must be underneath one of these directories (both under source or
- // both under binary) in order for the relative path to be evaluated
- // safely by the build tools.
- std::string RelativePathTopSource;
- std::string RelativePathTopBinary;
- bool RelativePathsConfigured;
- bool PathConversionsSetup;
-
cmIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal;
private:
- std::string ConvertToOutputForExistingCommon(const std::string& remote,
- std::string const& result,
- OutputFormat format);
-
void AddSharedFlags(std::string& flags, const std::string& lang,
bool shared);
bool GetShouldUseOldFlags(bool shared, const std::string &lang) const;