From 3ff6722934521151793e5ad798a48305fc5ec2fa Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Thu, 10 Mar 2005 13:39:38 -0500 Subject: [PATCH] ENH: cleanup by removing all the olf local generate junk that i not longer needed --- Source/cmExportLibraryDependencies.cxx | 7 -- Source/cmGlobalGenerator.cxx | 84 ++++++----------- Source/cmGlobalGenerator.h | 7 -- Source/cmGlobalVisualStudio7Generator.cxx | 5 - Source/cmGlobalVisualStudio7Generator.h | 7 -- Source/cmMakefile.cxx | 4 - Source/cmMakefile.h | 3 - Source/cmTryCompileCommand.cxx | 5 - Source/cmTryRunCommand.cxx | 5 - Source/cmake.cxx | 107 ++++++---------------- Source/cmake.h | 10 -- 11 files changed, 57 insertions(+), 187 deletions(-) diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index 16537a488..78a9485a2 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -45,13 +45,6 @@ bool cmExportLibraryDependenciesCommand::InitialPass(std::vector 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; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 66b54cac5..66c5b7991 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -108,13 +108,8 @@ void cmGlobalGenerator::EnableLanguage(std::vectorconst& 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::vectorconst& 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::vectorconst& 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::vectorconst& 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, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7cce34539..a16b88c2d 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -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. */ diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 2fda9de83..fb6e8c4d0 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -717,11 +717,6 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const char* name) cmCacheManager::INTERNAL); } -void cmGlobalVisualStudio7Generator::LocalGenerate() -{ - this->cmGlobalGenerator::LocalGenerate(); -} - std::vector *cmGlobalVisualStudio7Generator::GetConfigurations() { return &m_Configurations; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index f4b3d83a9..9a9199cd8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -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. */ diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b96201b40..2acf0df90 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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() diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index dd3c88b0f..a9f159c0a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -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); diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index 3972e2a6c..328c170ff 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -257,11 +257,6 @@ bool cmTryCompileCommand::InitialPass(std::vector const& argv) return false; } - if ( m_Makefile->GetLocal() ) - { - return true; - } - cmTryCompileCommand::CoreTryCompileCode(m_Makefile,argv,true); return true; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index a5d559921..f668ad96e 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -26,11 +26,6 @@ bool cmTryRunCommand::InitialPass(std::vector const& argv) return false; } - if ( m_Makefile->GetLocal() ) - { - return true; - } - // build an arg list for TryCompile and extract the runArgs std::vector tryCompile; std::string outputVariable; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bfb62819b..e09dca82b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -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& 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& 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& 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(); diff --git a/Source/cmake.h b/Source/cmake.h index 50024f732..ec553bd58 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -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&); @@ -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;