PERF: Remove several classes from the bootstrap and so making bootstrap smaller and faster

This commit is contained in:
Andy Cedilnik 2004-10-27 10:47:14 -04:00
parent 21c818340e
commit 56234aed4b
8 changed files with 76 additions and 39 deletions

View File

@ -156,6 +156,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
return false;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
std::vector<std::string>::const_iterator i = args.begin();
i++; // Get rid of subcommand
@ -200,6 +201,11 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
}
m_Makefile->AddDefinition(variable.c_str(), output.c_str());
return true;
#else
(void)recurse;
this->SetError("GLOB is not implemented in the bootstrap CMake");
return false;
#endif
}
//----------------------------------------------------------------------------

View File

@ -17,11 +17,14 @@
#include "cmFindPackageCommand.h"
#include <cmsys/RegularExpression.hxx>
#ifdef CMAKE_BUILD_WITH_CMAKE
#include "cmVariableWatch.h"
#endif
void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
int access_type, void* )
{
#ifdef CMAKE_BUILD_WITH_CMAKE
if(access_type == cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS)
{
std::string message = "An attempt was made to access a variable: ";
@ -36,6 +39,10 @@ void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
"the case of the argument to FIND_PACKAGE.";
cmSystemTools::Error(message.c_str());
}
#else
(void)variable;
(void)access_type;
#endif
}
//----------------------------------------------------------------------------
@ -196,6 +203,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
m_Makefile->GetDefinition(foundVar.c_str()));
}
#ifdef CMAKE_BUILD_WITH_CMAKE
if(!(upperDir == this->Variable))
{
if(needCompatibility)
@ -225,6 +233,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
);
}
}
#endif
return result;
}

View File

@ -24,7 +24,9 @@
#include "cmCacheManager.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
#ifdef CMAKE_BUILD_WITH_CMAKE
# include "cmVariableWatch.h"
#endif
#include "cmake.h"
#include <stdlib.h> // required for atoi
@ -900,12 +902,15 @@ void cmMakefile::AddDefinition(const char* name, const char* value)
}
m_TemporaryDefinitionKey = name;
m_Definitions[m_TemporaryDefinitionKey] = value;
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
{
vv->VariableAccessed(m_TemporaryDefinitionKey,
cmVariableWatch::VARIABLE_MODIFIED_ACCESS);
}
#endif
}
@ -958,11 +963,13 @@ void cmMakefile::AddDefinition(const char* name, bool value)
m_Definitions.erase( DefinitionMap::key_type(name));
m_Definitions.insert(DefinitionMap::value_type(name, "OFF"));
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
{
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_MODIFIED_ACCESS);
}
#endif
}
@ -983,11 +990,13 @@ void cmMakefile::AddCacheDefinition(const char* name, bool value, const char* do
void cmMakefile::RemoveDefinition(const char* name)
{
m_Definitions.erase(DefinitionMap::key_type(name));
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
{
vv->VariableAccessed(name, cmVariableWatch::VARIABLE_REMOVED_ACCESS);
}
#endif
}
void cmMakefile::SetProjectName(const char* p)
@ -1373,6 +1382,7 @@ const char* cmMakefile::GetDefinition(const char* name) const
{
def = this->GetCacheManager()->GetCacheValue(name);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* vv = this->GetVariableWatch();
if ( vv )
{
@ -1398,6 +1408,7 @@ const char* cmMakefile::GetDefinition(const char* name) const
}
}
}
#endif
return def;
}
@ -2134,6 +2145,7 @@ cmake *cmMakefile::GetCMakeInstance() const
return 0;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch *cmMakefile::GetVariableWatch() const
{
if ( this->GetCMakeInstance() &&
@ -2143,6 +2155,7 @@ cmVariableWatch *cmMakefile::GetVariableWatch() const
}
return 0;
}
#endif
void cmMakefile::AddMacro(const char* name, const char* signature)
{

View File

@ -618,7 +618,14 @@ public:
* given a current CMakeLists file name
*/
cmCacheManager *GetCacheManager() const;
/**
* Get the variable watch. This is used to determine when certain variables
* are accessed.
*/
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* GetVariableWatch() const;
#endif
//! Determine wether this is a local or global build.
bool GetLocal() const;

View File

@ -21,10 +21,16 @@
#include "cmLocalGenerator.h"
#include "cmCommands.h"
#include "cmCommand.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmVariableWatch.h"
# include "cmVersion.h"
#endif
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmLocalUnixMakefileGenerator2.h"
#endif
// only build kdevelop generator on non-windows platforms
// when not bootstrapping cmake
@ -69,6 +75,7 @@
void cmNeedBackwardsCompatibility(const std::string& variable,
int access_type, void* )
{
#ifdef CMAKE_BUILD_WITH_CMAKE
if (access_type == cmVariableWatch::UNKNOWN_VARIABLE_READ_ACCESS)
{
std::string message = "An attempt was made to access a variable: ";
@ -81,6 +88,10 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
"include a CMake module to test for the feature this variable defines.";
cmSystemTools::Error(message.c_str());
}
#else
(void)variable;
(void)access_type;
#endif
}
cmake::cmake()
@ -115,18 +126,21 @@ cmake::cmake()
m_GlobalGenerator = 0;
m_ProgressCallback = 0;
m_ProgressCallbackClientData = 0;
m_VariableWatch = new cmVariableWatch;
m_ScriptMode = false;
this->AddDefaultGenerators();
this->AddDefaultCommands();
#ifdef CMAKE_BUILD_WITH_CMAKE
m_VariableWatch = new cmVariableWatch;
m_VariableWatch->AddWatch("CMAKE_WORDS_BIGENDIAN",
cmNeedBackwardsCompatibility);
m_VariableWatch->AddWatch("CMAKE_SIZEOF_INT",
cmNeedBackwardsCompatibility);
m_VariableWatch->AddWatch("CMAKE_X_LIBS",
cmNeedBackwardsCompatibility);
#endif
this->AddDefaultGenerators();
this->AddDefaultCommands();
}
cmake::~cmake()
@ -142,7 +156,9 @@ cmake::~cmake()
{
delete (*j).second;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
delete m_VariableWatch;
#endif
}
bool cmake::CommandExists(const char* name) const
@ -174,30 +190,6 @@ void cmake::AddCommand(cmCommand* wg)
m_Commands.insert( RegisteredCommandsMap::value_type(name, wg));
}
void cmake::Usage(const char* program)
{
cmOStringStream errorStream;
errorStream << "cmake version " << cmVersion::GetCMakeVersion() << "\n";
errorStream << "Usage: " << program << " [srcdir] [options]\n"
<< "Where cmake is run from the directory where you want the object files written. If srcdir is not specified, the current directory is used for both source and object files.\n";
errorStream << "Options are:\n";
errorStream << "\n-i (puts cmake in wizard mode, not available for ccmake)\n";
errorStream << "\n-DVAR:TYPE=VALUE (create a cache file entry)\n";
errorStream << "\n-Cpath_to_initial_cache (a cmake list file that is used to pre-load the cache with values.)\n";
errorStream << "\n[-GgeneratorName] (where generator name can be one of these: ";
std::vector<std::string> names;
this->GetRegisteredGenerators(names);
for(std::vector<std::string>::iterator i =names.begin();
i != names.end(); ++i)
{
errorStream << "\"" << i->c_str() << "\" ";
}
errorStream << ")\n";
cmSystemTools::Error(errorStream.str().c_str());
}
// Parse the args
bool cmake::SetCacheArgs(const std::vector<std::string>& args)
{
@ -654,8 +646,13 @@ void CMakeCommandUsage(const char* program)
{
cmOStringStream errorStream;
#ifdef CMAKE_BUILD_WITH_CMAKE
errorStream
<< "cmake version " << cmVersion::GetCMakeVersion() << "\n";
#else
errorStream
<< "cmake bootstrap\n";
#endif
errorStream
<< "Usage: " << program << " -E [command] [arguments ...]\n"
@ -824,11 +821,13 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
return result;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake dependency scanning support.
else if (args[1] == "cmake_depends" && args.size() >= 5)
{
return cmLocalUnixMakefileGenerator2::ScanDependencies(args)? 0 : 1;
}
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
// Write registry value
@ -1384,6 +1383,7 @@ const char* cmake::GetCacheDefinition(const char* name) const
int cmake::DumpDocumentationToFile(std::ostream& f)
{
#ifdef CMAKE_BUILD_WITH_CMAKE
// Loop over all registered commands and print out documentation
const char *name;
const char *terse;
@ -1404,6 +1404,9 @@ int cmake::DumpDocumentationToFile(std::ostream& f)
<< "<br><i>Usage:</i> " << full << "</li>" << std::endl << std::endl;
}
f << "</ul></html>\n";
#else
(void)f;
#endif
return 1;
}

View File

@ -210,9 +210,6 @@ class cmake
*/
bool GetLocal() { return m_Local; }
///! Display command line useage
void Usage(const char *program);
///! Parse command line arguments
void SetArgs(const std::vector<std::string>&);

View File

@ -19,6 +19,8 @@
#include "cmCacheManager.h"
#include "cmDynamicLoader.h"
#include "cmListFileCache.h"
#ifdef CMAKE_BUILD_WITH_CMAKE
#include "cmDocumentation.h"
//----------------------------------------------------------------------------
@ -98,6 +100,7 @@ static const cmDocumentationEntry cmDocumentationNOTE[] =
" cmake .", 0},
{0,0,0}
};
#endif
int do_cmake(int ac, char** av);
void updateProgress(const char *msg, float prog, void *cd);
@ -115,7 +118,9 @@ int main(int ac, char** av)
int do_cmake(int ac, char** av)
{
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDocumentation doc;
#endif
int nocwd = 0;
if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
@ -124,6 +129,7 @@ int do_cmake(int ac, char** av)
nocwd = 1;
}
#ifdef CMAKE_BUILD_WITH_CMAKE
if(doc.CheckOptions(ac, av) || nocwd)
{
// Construct and print requested documentation.
@ -156,6 +162,7 @@ int do_cmake(int ac, char** av)
}
return result;
}
#endif
bool wiz = false;
bool command = false;

View File

@ -38,22 +38,17 @@ CMAKE_CXX_SOURCES="\
cmakemain \
cmMakeDepend \
cmMakefile \
cmDocumentation \
cmGlob \
cmGlobalGenerator \
cmLocalGenerator \
cmSourceFile \
cmSystemTools \
cmGlobalUnixMakefileGenerator \
cmLocalUnixMakefileGenerator \
cmLocalUnixMakefileGenerator2 \
cmCommands \
cmTarget \
cmCustomCommand \
cmCacheManager \
cmListFileCache \
cmVariableWatch \
cmVersion \
cmSourceGroup"
CMAKE_C_SOURCES="\