diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-01-05 16:01:21 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2019-01-16 15:41:20 (GMT) |
commit | ead7117afda23d7cf0c1466ce5229d06240d3de0 (patch) | |
tree | d6f73008a1c387f27d3ef3834681ac5edd8c3897 /Source/cmGlobalGhsMultiGenerator.h | |
parent | e7825386e2e9e69728e5a5c3dcbc94814bb7cb1c (diff) | |
download | CMake-ead7117afda23d7cf0c1466ce5229d06240d3de0.zip CMake-ead7117afda23d7cf0c1466ce5229d06240d3de0.tar.gz CMake-ead7117afda23d7cf0c1466ce5229d06240d3de0.tar.bz2 |
GHS: Update the top-level project generation
-- Sort targets by name
-- Generate a top-level project for each project command named as project.top.gpj
Use the target set for the current project instead of assuming all targets
-- Add support for building projects not in binary root
-- Directly create files and pass ostream
-- Do no generate project files for UTILITY targets; this was never supported
-- Do no generate project files for OBJECT, SHARED, or MODULE libraries; this was never supported
-- Update GHS tags to support project types
NOTE: The default tag is changed to "" because "[ ]" is an invalid token in project file
Diffstat (limited to 'Source/cmGlobalGhsMultiGenerator.h')
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.h | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index e0d428e..8b81ba3 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -71,6 +71,7 @@ public: static void OpenBuildFileStream(std::string const& filepath, cmGeneratedFileStream** filestream); static void OpenBuildFileStream(cmGeneratedFileStream* filestream); + void OpenBuildFileStream(std::ostream& fout); static void CloseBuildFileStream(cmGeneratedFileStream** filestream); /// Write the common disclaimer text at the top of each build file. static void WriteDisclaimer(std::ostream* os); @@ -86,6 +87,24 @@ public: static std::string trimQuotes(std::string const& str); + // Target dependency sorting + class TargetSet : public std::set<cmGeneratorTarget const*> + { + }; + class TargetCompare + { + std::string First; + + public: + TargetCompare(std::string const& first) + : First(first) + { + } + bool operator()(cmGeneratorTarget const* l, + cmGeneratorTarget const* r) const; + }; + class OrderedTargetDependSet; + protected: void Generate() override; void GenerateBuildCommand(std::vector<std::string>& makeCommand, @@ -100,10 +119,16 @@ protected: private: void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts); - void OpenBuildFileStream(); - void WriteMacros(); - void WriteHighLevelDirectives(); + /* top-level project */ + void OutputTopLevelProject(cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + void WriteTopLevelProject(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); + void WriteMacros(std::ostream& fout); + void WriteHighLevelDirectives(std::ostream& fout); + void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, + std::vector<cmLocalGenerator*>& generators); static void AddFilesUpToPathNewBuildFile( cmGeneratedFileStream* mainBuildFile, @@ -116,7 +141,7 @@ private: std::vector<std::string>::const_iterator splitPathI, std::vector<std::string>::const_iterator end, GhsMultiGpj::Types projType); static std::string GetFileNameFromPath(std::string const& path); - void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts); + bool IsTgtForBuild(const cmGeneratorTarget* tgt); std::vector<cmGeneratedFileStream*> TargetSubProjects; @@ -128,4 +153,17 @@ private: static const char* DEFAULT_TOOLSET_ROOT; }; +class cmGlobalGhsMultiGenerator::OrderedTargetDependSet + : public std::multiset<cmTargetDepend, + cmGlobalGhsMultiGenerator::TargetCompare> +{ + typedef std::multiset<cmTargetDepend, + cmGlobalGhsMultiGenerator::TargetCompare> + derived; + +public: + typedef cmGlobalGenerator::TargetDependSet TargetDependSet; + OrderedTargetDependSet(TargetDependSet const&, std::string const& first); +}; + #endif |