Add common base classes to Makefile and Ninja generators

Provide a place to move functionality common to both.
This commit is contained in:
Brad King 2015-07-07 16:37:56 -04:00
parent 6f6664f578
commit 001f9b3617
20 changed files with 177 additions and 16 deletions

View File

@ -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

View File

@ -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()
{
}

View File

@ -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

View File

@ -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()
{
}

View File

@ -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

View File

@ -505,7 +505,7 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os,
cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
: cmGlobalGenerator(cm)
: cmGlobalCommonGenerator(cm)
, BuildFileStream(0)
, RulesFileStream(0)
, CompileCommandsStream(0)

View File

@ -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.

View File

@ -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;

View File

@ -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);

View File

@ -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()
{
}

View File

@ -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

View File

@ -25,7 +25,7 @@
cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
cmLocalGenerator* parent,
cmState::Snapshot snapshot)
: cmLocalGenerator(gg, parent, snapshot)
: cmLocalCommonGenerator(gg, parent, snapshot)
, ConfigName("")
, HomeRelativeOutputPath("")
{

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -33,7 +33,8 @@
#include <ctype.h>
cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
: OSXBundleGenerator(0)
: cmCommonTargetGenerator()
, OSXBundleGenerator(0)
, MacOSXContentGenerator(0)
{
this->BuildFileStream = 0;

View File

@ -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

View File

@ -58,7 +58,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
}
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
:
: cmCommonTargetGenerator(),
MacOSXContentGenerator(0),
OSXBundleGenerator(0),
MacContentFolders(),

View File

@ -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.

View File

@ -248,6 +248,7 @@ CMAKE_CXX_SOURCES="\
cmCommandArgumentLexer \
cmCommandArgumentParser \
cmCommandArgumentParserHelper \
cmCommonTargetGenerator \
cmCPackPropertiesGenerator \
cmDefinitions \
cmDepends \
@ -276,8 +277,10 @@ CMAKE_CXX_SOURCES="\
cmGeneratorExpressionNode \
cmGeneratorExpressionParser \
cmGeneratorExpression \
cmGlobalCommonGenerator \
cmGlobalGenerator \
cmInstallDirectoryGenerator \
cmLocalCommonGenerator \
cmLocalGenerator \
cmInstalledFile \
cmInstallGenerator \