diff options
author | Brad King <brad.king@kitware.com> | 2015-07-07 20:37:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-09 13:50:05 (GMT) |
commit | 001f9b361711b479ee0d530056e44b7444edfcff (patch) | |
tree | 480f5e333a21000e27c0e7042d3ac9fbdba9e8af /Source | |
parent | 6f6664f578426e15e6e101f20a0c54a7b2820e96 (diff) | |
download | CMake-001f9b361711b479ee0d530056e44b7444edfcff.zip CMake-001f9b361711b479ee0d530056e44b7444edfcff.tar.gz CMake-001f9b361711b479ee0d530056e44b7444edfcff.tar.bz2 |
Add common base classes to Makefile and Ninja generators
Provide a place to move functionality common to both.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 20 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.h | 27 | ||||
-rw-r--r-- | Source/cmGlobalCommonGenerator.cxx | 21 | ||||
-rw-r--r-- | Source/cmGlobalCommonGenerator.h | 27 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.h | 4 | ||||
-rw-r--r-- | Source/cmLocalCommonGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/cmLocalCommonGenerator.h | 29 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 4 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.h | 4 |
19 files changed, 174 insertions, 16 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6940187..d5fe7d1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -165,6 +165,8 @@ set(SRCS cmCommandArgumentLexer.cxx cmCommandArgumentParser.cxx cmCommandArgumentParserHelper.cxx + cmCommonTargetGenerator.cxx + cmCommonTargetGenerator.h cmComputeComponentGraph.cxx cmComputeComponentGraph.h cmComputeLinkDepends.cxx @@ -260,6 +262,8 @@ set(SRCS cmGeneratorExpression.h cmGeneratorTarget.cxx cmGeneratorTarget.h + cmGlobalCommonGenerator.cxx + cmGlobalCommonGenerator.h cmGlobalGenerator.cxx cmGlobalGenerator.h cmGlobalGeneratorFactory.h @@ -285,6 +289,8 @@ set(SRCS cmListFileCache.cxx cmListFileCache.h cmListFileLexer.c + cmLocalCommonGenerator.cxx + cmLocalCommonGenerator.h cmLocalGenerator.cxx cmLocalGenerator.h cmLocalUnixMakefileGenerator3.cxx diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx new file mode 100644 index 0000000..e1f7522 --- /dev/null +++ b/Source/cmCommonTargetGenerator.cxx @@ -0,0 +1,20 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmCommonTargetGenerator.h" + +cmCommonTargetGenerator::cmCommonTargetGenerator() +{ +} + +cmCommonTargetGenerator::~cmCommonTargetGenerator() +{ +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h new file mode 100644 index 0000000..96f4088 --- /dev/null +++ b/Source/cmCommonTargetGenerator.h @@ -0,0 +1,27 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmCommonTargetGenerator_h +#define cmCommonTargetGenerator_h + +#include "cmStandardIncludes.h" + +/** \class cmCommonTargetGenerator + * \brief Common infrastructure for Makefile and Ninja per-target generators + */ +class cmCommonTargetGenerator +{ +public: + cmCommonTargetGenerator(); + virtual ~cmCommonTargetGenerator(); +}; + +#endif diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx new file mode 100644 index 0000000..dc8e5a7 --- /dev/null +++ b/Source/cmGlobalCommonGenerator.cxx @@ -0,0 +1,21 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalCommonGenerator.h" + +cmGlobalCommonGenerator::cmGlobalCommonGenerator(cmake* cm): + cmGlobalGenerator(cm) +{ +} + +cmGlobalCommonGenerator::~cmGlobalCommonGenerator() +{ +} diff --git a/Source/cmGlobalCommonGenerator.h b/Source/cmGlobalCommonGenerator.h new file mode 100644 index 0000000..7bb0e55 --- /dev/null +++ b/Source/cmGlobalCommonGenerator.h @@ -0,0 +1,27 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalCommonGenerator_h +#define cmGlobalCommonGenerator_h + +#include "cmGlobalGenerator.h" + +/** \class cmGlobalCommonGenerator + * \brief Common infrastructure for Makefile and Ninja global generators. + */ +class cmGlobalCommonGenerator : public cmGlobalGenerator +{ +public: + cmGlobalCommonGenerator(cmake* cm); + ~cmGlobalCommonGenerator(); +}; + +#endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 722294b..b88b8c8 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -505,7 +505,7 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os, cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) - : cmGlobalGenerator(cm) + : cmGlobalCommonGenerator(cm) , BuildFileStream(0) , RulesFileStream(0) , CompileCommandsStream(0) diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index ffd1cdc..2a749c1 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -13,7 +13,7 @@ #ifndef cmGlobalNinjaGenerator_h # define cmGlobalNinjaGenerator_h -# include "cmGlobalGenerator.h" +# include "cmGlobalCommonGenerator.h" # include "cmGlobalGeneratorFactory.h" # include "cmNinjaTypes.h" @@ -42,7 +42,7 @@ class cmGeneratorTarget; * - We extensively use Ninja variable overloading system to minimize the * number of generated rules. */ -class cmGlobalNinjaGenerator : public cmGlobalGenerator +class cmGlobalNinjaGenerator : public cmGlobalCommonGenerator { public: /// The default name of Ninja's build file. Typically: build.ninja. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index e6a67d3..42b42d4 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -21,7 +21,7 @@ #include "cmAlgorithms.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3(cmake* cm) - : cmGlobalGenerator(cm) + : cmGlobalCommonGenerator(cm) { // This type of makefile always requires unix style paths this->ForceUnixPaths = true; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 14adf2e..fc53fa8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -12,7 +12,7 @@ #ifndef cmGlobalUnixMakefileGenerator3_h #define cmGlobalUnixMakefileGenerator3_h -#include "cmGlobalGenerator.h" +#include "cmGlobalCommonGenerator.h" #include "cmGlobalGeneratorFactory.h" class cmGeneratedFileStream; @@ -51,7 +51,7 @@ class cmLocalUnixMakefileGenerator3; */ -class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator +class cmGlobalUnixMakefileGenerator3 : public cmGlobalCommonGenerator { public: cmGlobalUnixMakefileGenerator3(cmake* cm); diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx new file mode 100644 index 0000000..0b266f8 --- /dev/null +++ b/Source/cmLocalCommonGenerator.cxx @@ -0,0 +1,23 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmLocalCommonGenerator.h" + +cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent, + cmState::Snapshot snapshot): + cmLocalGenerator(gg, parent, snapshot) +{ +} + +cmLocalCommonGenerator::~cmLocalCommonGenerator() +{ +} diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h new file mode 100644 index 0000000..c897e49 --- /dev/null +++ b/Source/cmLocalCommonGenerator.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2015 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmLocalCommonGenerator_h +#define cmLocalCommonGenerator_h + +#include "cmLocalGenerator.h" + +/** \class cmLocalCommonGenerator + * \brief Common infrastructure for Makefile and Ninja local generators. + */ +class cmLocalCommonGenerator: public cmLocalGenerator +{ +public: + cmLocalCommonGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent, + cmState::Snapshot snapshot); + ~cmLocalCommonGenerator(); +}; + +#endif diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 4db36fc..e712b46 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -25,7 +25,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) - : cmLocalGenerator(gg, parent, snapshot) + : cmLocalCommonGenerator(gg, parent, snapshot) , ConfigName("") , HomeRelativeOutputPath("") { diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index ce966ff..8bc5640 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -13,7 +13,7 @@ #ifndef cmLocalNinjaGenerator_h # define cmLocalNinjaGenerator_h -# include "cmLocalGenerator.h" +# include "cmLocalCommonGenerator.h" # include "cmNinjaTypes.h" class cmCustomCommandGenerator; @@ -28,7 +28,7 @@ class cmake; * cmLocalNinjaGenerator produces a local build.ninja file from its * member Makefile. */ -class cmLocalNinjaGenerator : public cmLocalGenerator +class cmLocalNinjaGenerator : public cmLocalCommonGenerator { public: cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmLocalGenerator* parent, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e292ba7..e3acbaf 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -82,7 +82,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) cmLocalUnixMakefileGenerator3:: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, cmLocalGenerator* parent, cmState::Snapshot snapshot) - : cmLocalGenerator(gg, parent, snapshot) + : cmLocalCommonGenerator(gg, parent, snapshot) { this->MakefileVariableSize = 0; this->ColorMakefile = false; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index b097c95..70d59de 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -12,7 +12,7 @@ #ifndef cmLocalUnixMakefileGenerator3_h #define cmLocalUnixMakefileGenerator3_h -#include "cmLocalGenerator.h" +#include "cmLocalCommonGenerator.h" // for cmDepends::DependencyVector #include "cmDepends.h" @@ -31,7 +31,7 @@ class cmSourceFile; * cmLocalUnixMakefileGenerator3 produces a LocalUnix makefile from its * member Makefile. */ -class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator +class cmLocalUnixMakefileGenerator3 : public cmLocalCommonGenerator { public: cmLocalUnixMakefileGenerator3(cmGlobalGenerator* gg, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 09fad5c..2f53899 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -33,7 +33,8 @@ #include <ctype.h> cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) - : OSXBundleGenerator(0) + : cmCommonTargetGenerator() + , OSXBundleGenerator(0) , MacOSXContentGenerator(0) { this->BuildFileStream = 0; diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 9182236..a438717 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -12,6 +12,8 @@ #ifndef cmMakefileTargetGenerator_h #define cmMakefileTargetGenerator_h +#include "cmCommonTargetGenerator.h" + #include "cmLocalUnixMakefileGenerator3.h" #include "cmOSXBundleGenerator.h" @@ -30,7 +32,7 @@ class cmSourceFile; * \brief Support Routines for writing makefiles * */ -class cmMakefileTargetGenerator +class cmMakefileTargetGenerator: public cmCommonTargetGenerator { public: // constructor to set the ivars diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b18f368..93b3f4e 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,7 +58,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) - : + : cmCommonTargetGenerator(), MacOSXContentGenerator(0), OSXBundleGenerator(0), MacContentFolders(), diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index fc361b2..a98f04e 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -13,6 +13,8 @@ #ifndef cmNinjaTargetGenerator_h #define cmNinjaTargetGenerator_h +#include "cmCommonTargetGenerator.h" + #include "cmStandardIncludes.h" #include "cmNinjaTypes.h" #include "cmLocalNinjaGenerator.h" @@ -26,7 +28,7 @@ class cmMakefile; class cmSourceFile; class cmCustomCommand; -class cmNinjaTargetGenerator +class cmNinjaTargetGenerator: public cmCommonTargetGenerator { public: /// Create a cmNinjaTargetGenerator according to the @a target's type. |