ENH: cleanup by removing all the olf local generate junk that i not longer needed

This commit is contained in:
Ken Martin 2005-03-10 13:39:38 -05:00
parent a79868206e
commit 3ff6722934
11 changed files with 57 additions and 187 deletions

View File

@ -45,13 +45,6 @@ bool cmExportLibraryDependenciesCommand::InitialPass(std::vector<std::string> co
void cmExportLibraryDependenciesCommand::FinalPass()
{
// don't do anything if local mode
if(m_Makefile->GetLocal())
{
return;
}
// Create a full path filename for output
std::string fname = m_Args[0];
bool append = false;

View File

@ -108,13 +108,8 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
cmSystemTools::SetFatalErrorOccured();
return;
}
// setup some variables for the EnableLanguage function
bool isLocal = m_CMakeInstance->GetLocal();
// if we are from the top, always define this
if(!isLocal)
{
mf->AddDefinition("RUN_CONFIGURE", true);
}
mf->AddDefinition("RUN_CONFIGURE", true);
bool needTestLanguage = false;
std::string rootBin = mf->GetHomeOutputDirectory();
// If the configuration files path has been set,
@ -168,7 +163,7 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
}
// **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
// what platform we are running on
if (!isLocal && !mf->GetDefinition("CMAKE_SYSTEM_NAME"))
if (!mf->GetDefinition("CMAKE_SYSTEM_NAME"))
{
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows version number data. */
@ -200,7 +195,7 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
l != languages.end(); ++l)
{
const char* lang = l->c_str();
if(!isLocal && !this->GetLanguageEnabled(lang) )
if(!this->GetLanguageEnabled(lang) )
{
if (m_CMakeInstance->GetIsInTryCompile())
{
@ -322,39 +317,36 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// **** Step 7, Test the compiler for the language just setup
// At this point we should have enough info for a try compile
// which is used in the backward stuff
if(!isLocal)
if(needTestLanguage)
{
if(needTestLanguage)
if (!m_CMakeInstance->GetIsInTryCompile())
{
if (!m_CMakeInstance->GetIsInTryCompile())
std::string testLang = "CMakeTest";
testLang += lang;
testLang += "Compiler.cmake";
std::string ifpath = mf->GetModulesFile(testLang.c_str());
if(!mf->ReadListFile(0,ifpath.c_str()))
{
std::string testLang = "CMakeTest";
testLang += lang;
testLang += "Compiler.cmake";
std::string ifpath = mf->GetModulesFile(testLang.c_str());
if(!mf->ReadListFile(0,ifpath.c_str()))
cmSystemTools::Error("Could not find cmake module file:", ifpath.c_str());
}
// **** Step 8, load backwards compatibility stuff for C and CXX
// for old versions of CMake ListFiles C and CXX had some
// backwards compatibility files they have to load
const char* versionValue
= mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (atof(versionValue) <= 1.4)
{
if(strcmp(lang, "C") == 0)
{
cmSystemTools::Error("Could not find cmake module file:", ifpath.c_str());
ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
mf->ReadListFile(0,ifpath.c_str());
}
// **** Step 8, load backwards compatibility stuff for C and CXX
// for old versions of CMake ListFiles C and CXX had some
// backwards compatibility files they have to load
const char* versionValue
= mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if (atof(versionValue) <= 1.4)
if(strcmp(lang, "CXX") == 0)
{
if(strcmp(lang, "C") == 0)
{
ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
mf->ReadListFile(0,ifpath.c_str());
}
if(strcmp(lang, "CXX") == 0)
{
ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
mf->ReadListFile(0,ifpath.c_str());
}
ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
mf->ReadListFile(0,ifpath.c_str());
}
}
}
}
@ -634,28 +626,6 @@ void cmGlobalGenerator::Generate()
m_CMakeInstance->UpdateProgress("Generating done", -1);
}
void cmGlobalGenerator::LocalGenerate()
{
// for this case we create one LocalGenerator
// configure it, and then Generate it
// start with this directory
cmLocalGenerator *lg = this->CreateLocalGenerator();
// Setup relative path generation.
this->ConfigureRelativePaths();
// set the Start directories
lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
lg->GetMakefile()->MakeStartDirectoriesCurrent();
// now do trhe configure
lg->Configure();
lg->ConfigureFinalPass();
lg->Generate(false);
delete lg;
}
int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
const char *projectName,
const char *target,

View File

@ -60,13 +60,6 @@ public:
*/
virtual void Generate();
/**
* Generate the required files for building this directory. This
* basically creates a single LocalGenerators and
* requests that it Generate.
*/
virtual void LocalGenerate();
/**
* Set/Get and Clear the enabled languages.
*/

View File

@ -717,11 +717,6 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const char* name)
cmCacheManager::INTERNAL);
}
void cmGlobalVisualStudio7Generator::LocalGenerate()
{
this->cmGlobalGenerator::LocalGenerate();
}
std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
{
return &m_Configurations;

View File

@ -66,13 +66,6 @@ public:
*/
virtual void Generate();
/**
* Generate the required files for building this directory. This
* basically creates a single LocalGenerators and
* requests that it Generate.
*/
virtual void LocalGenerate();
/**
* Generate the DSW workspace file.
*/

View File

@ -2124,10 +2124,6 @@ cmCacheManager *cmMakefile::GetCacheManager() const
return this->GetCMakeInstance()->GetCacheManager();
}
bool cmMakefile::GetLocal() const
{
return this->GetCMakeInstance()->GetLocal();
}
void cmMakefile::DisplayStatus(const char* message, float s)
{
this->GetLocalGenerator()->GetGlobalGenerator()

View File

@ -610,9 +610,6 @@ public:
cmVariableWatch* GetVariableWatch() const;
#endif
//! Determine wether this is a local or global build.
bool GetLocal() const;
///! Display progress or status message.
void DisplayStatus(const char*, float);

View File

@ -257,11 +257,6 @@ bool cmTryCompileCommand::InitialPass(std::vector<std::string> const& argv)
return false;
}
if ( m_Makefile->GetLocal() )
{
return true;
}
cmTryCompileCommand::CoreTryCompileCode(m_Makefile,argv,true);
return true;

View File

@ -26,11 +26,6 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
return false;
}
if ( m_Makefile->GetLocal() )
{
return true;
}
// build an arg list for TryCompile and extract the runArgs
std::vector<std::string> tryCompile;
std::string outputVariable;

View File

@ -115,7 +115,6 @@ cmake::cmake()
cmSystemTools::PutEnv("MAKEFLAGS=");
}
m_Local = false;
m_Verbose = false;
m_InTryCompile = false;
m_CacheManager = new cmCacheManager;
@ -275,7 +274,6 @@ void cmake::ReadListFile(const char *path)
// Parse the args
void cmake::SetArgs(const std::vector<std::string>& args)
{
m_Local = false;
bool directoriesSet = false;
for(unsigned int i=1; i < args.size(); ++i)
{
@ -363,11 +361,9 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->SetStartDirectory
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
}
if (!m_Local)
{
this->SetStartDirectory(this->GetHomeDirectory());
this->SetStartOutputDirectory(this->GetHomeOutputDirectory());
}
this->SetStartDirectory(this->GetHomeDirectory());
this->SetStartOutputDirectory(this->GetHomeOutputDirectory());
}
//----------------------------------------------------------------------------
@ -1282,49 +1278,36 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
}
int ret = 0;
// if not local or the cmake version has changed since the last run
// of cmake, or CMakeSystem.cmake file is not in the root binary
// directory, run a global generate
if(m_ScriptMode || !m_Local || !this->CacheVersionMatches() ||
!cmSystemTools::FileExists(systemFile.c_str()) )
{
// Check the state of the build system to see if we need to regenerate.
if(!this->CheckBuildSystem())
{
return 0;
}
// If we are doing global generate, we better set start and start
// output directory to the root of the project.
std::string oldstartdir = this->GetStartDirectory();
std::string oldstartoutputdir = this->GetStartOutputDirectory();
this->SetStartDirectory(this->GetHomeDirectory());
this->SetStartOutputDirectory(this->GetHomeOutputDirectory());
bool saveLocalFlag = m_Local;
m_Local = false;
ret = this->Configure();
if (ret || m_ScriptMode)
{
return ret;
}
ret = this->Generate();
std::string message = "Build files have been written to: ";
message += this->GetHomeOutputDirectory();
this->UpdateProgress(message.c_str(), -1);
if(ret)
{
return ret;
}
m_Local = saveLocalFlag;
this->SetStartDirectory(oldstartdir.c_str());
this->SetStartOutputDirectory(oldstartoutputdir.c_str());
}
// if we are local do the local thing
if (m_Local)
// now run the global generate
// Check the state of the build system to see if we need to regenerate.
if(!this->CheckBuildSystem())
{
ret = this->LocalGenerate();
return 0;
}
// If we are doing global generate, we better set start and start
// output directory to the root of the project.
std::string oldstartdir = this->GetStartDirectory();
std::string oldstartoutputdir = this->GetStartOutputDirectory();
this->SetStartDirectory(this->GetHomeDirectory());
this->SetStartOutputDirectory(this->GetHomeOutputDirectory());
ret = this->Configure();
if (ret || m_ScriptMode)
{
return ret;
}
ret = this->Generate();
std::string message = "Build files have been written to: ";
message += this->GetHomeOutputDirectory();
this->UpdateProgress(message.c_str(), -1);
if(ret)
{
return ret;
}
this->SetStartDirectory(oldstartdir.c_str());
this->SetStartOutputDirectory(oldstartoutputdir.c_str());
return ret;
}
@ -1342,36 +1325,6 @@ int cmake::Generate()
return 0;
}
int cmake::LocalGenerate()
{
// Read in the cache
m_CacheManager->LoadCache(this->GetHomeOutputDirectory());
// create the generator based on the cache if it isn't already there
const char* genName = m_CacheManager->GetCacheValue("CMAKE_GENERATOR");
if(genName)
{
m_GlobalGenerator = this->CreateGlobalGenerator(genName);
// set the global flag for unix style paths on cmSystemTools as
// soon as the generator is set. This allows gmake to be used
// on windows.
cmSystemTools::SetForceUnixPaths(m_GlobalGenerator->GetForceUnixPaths());
}
else
{
cmSystemTools::Error("Could local Generate called without the GENERATOR being specified in the CMakeCache");
return -1;
}
// do the local generate
m_GlobalGenerator->LocalGenerate();
if(cmSystemTools::GetErrorOccuredFlag())
{
return -1;
}
return 0;
}
unsigned int cmake::GetMajorVersion()
{
return cmMakefile::GetMajorVersion();

View File

@ -204,12 +204,6 @@ class cmake
/** Check if a command exists. */
bool CommandExists(const char* name) const;
/**
* Is cmake in the process of a local cmake invocation. If so, we know the
* cache is already configured and ready to go.
*/
bool GetLocal() { return m_Local; }
///! Parse command line arguments
void SetArgs(const std::vector<std::string>&);
@ -284,9 +278,6 @@ protected:
///! read in a cmake list file to initialize the cache
void ReadListFile(const char *path);
///! used by Run
int LocalGenerate();
/**
* Method called to check build system integrity at build time.
* Returns 1 if CMake should rerun and 0 otherwise.
@ -306,7 +297,6 @@ private:
ProgressCallback m_ProgressCallback;
void* m_ProgressCallbackClientData;
bool m_Verbose;
bool m_Local;
bool m_InTryCompile;
bool m_ScriptMode;
std::string m_CMakeCommand;