From 5c058c8f12742dcb96b2e22b43208f345a865fbf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 24 Sep 2013 20:07:45 +0200 Subject: [PATCH] Rename the cmQtAutomoc class to cmQtAutoGenerators. It will be extended to process .ui and .qrc files too. --- Source/CMakeLists.txt | 4 +- Source/cmGlobalGenerator.cxx | 14 +++--- Source/cmGlobalGenerator.h | 2 +- ...cmQtAutomoc.cxx => cmQtAutoGenerators.cxx} | 46 ++++++++++--------- .../{cmQtAutomoc.h => cmQtAutoGenerators.h} | 10 ++-- Source/cmcmd.cxx | 4 +- 6 files changed, 42 insertions(+), 38 deletions(-) rename Source/{cmQtAutomoc.cxx => cmQtAutoGenerators.cxx} (96%) rename Source/{cmQtAutomoc.h => cmQtAutoGenerators.h} (95%) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 01e4f881d..e13a304a2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -250,8 +250,8 @@ set(SRCS cmPropertyDefinitionMap.h cmPropertyMap.cxx cmPropertyMap.h - cmQtAutomoc.cxx - cmQtAutomoc.h + cmQtAutoGenerators.cxx + cmQtAutoGenerators.h cmRST.cxx cmRST.h cmScriptGenerator.h diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fb205bece..f92fe6028 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -18,7 +18,7 @@ #include "cmExternalMakefileProjectGenerator.h" #include "cmake.h" #include "cmMakefile.h" -#include "cmQtAutomoc.h" +#include "cmQtAutoGenerators.h" #include "cmSourceFile.h" #include "cmVersion.h" #include "cmTargetExport.h" @@ -1049,8 +1049,8 @@ void cmGlobalGenerator::Generate() } // Iterate through all targets and set up automoc for those which have - // the AUTOMOC property set - this->CreateAutomocTargets(); + // the AUTOMOC, AUTOUIC or AUTORCC property set + this->CreateQtAutoGeneratorsTargets(); // For each existing cmLocalGenerator unsigned int i; @@ -1206,10 +1206,10 @@ bool cmGlobalGenerator::CheckTargets() } //---------------------------------------------------------------------------- -void cmGlobalGenerator::CreateAutomocTargets() +void cmGlobalGenerator::CreateQtAutoGeneratorsTargets() { #ifdef CMAKE_BUILD_WITH_CMAKE - typedef std::vector > Automocs; + typedef std::vector > Automocs; Automocs automocs; for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { @@ -1227,7 +1227,7 @@ void cmGlobalGenerator::CreateAutomocTargets() { if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported()) { - cmQtAutomoc automoc; + cmQtAutoGenerators automoc; if(automoc.InitializeMocSourceFile(&target)) { automocs.push_back(std::make_pair(automoc, &target)); @@ -1239,7 +1239,7 @@ void cmGlobalGenerator::CreateAutomocTargets() for (Automocs::iterator it = automocs.begin(); it != automocs.end(); ++it) { - it->first.SetupAutomocTarget(it->second); + it->first.SetupAutoGenerateTarget(it->second); } #endif } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c930b2b6e..773da3865 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -319,7 +319,7 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS(); bool CheckTargets(); - void CreateAutomocTargets(); + void CreateQtAutoGeneratorsTargets(); // Fill the ProjectMap, this must be called after LocalGenerators diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutoGenerators.cxx similarity index 96% rename from Source/cmQtAutomoc.cxx rename to Source/cmQtAutoGenerators.cxx index 651e0ad67..24f4498af 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -29,7 +29,7 @@ #include #endif -#include "cmQtAutomoc.h" +#include "cmQtAutoGenerators.h" static bool requiresMocing(const std::string& text, std::string ¯oName) @@ -113,7 +113,7 @@ static void copyTargetProperty(cmTarget* destinationTarget, } -cmQtAutomoc::cmQtAutomoc() +cmQtAutoGenerators::cmQtAutoGenerators() :Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0) ,ColorOutput(true) ,RunMocFailed(false) @@ -135,7 +135,7 @@ cmQtAutomoc::cmQtAutomoc() } } -bool cmQtAutomoc::InitializeMocSourceFile(cmTarget* target) +bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); // don't do anything if there is no Qt4 or Qt5Core (which contains moc): @@ -201,7 +201,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target, } } -void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) +void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); const char* targetName = target->GetName(); @@ -466,7 +466,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } -bool cmQtAutomoc::Run(const char* targetDirectory, const char *config) +bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config) { bool success = true; cmake cm; @@ -492,7 +492,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory, const char *config) } -cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm, +cmGlobalGenerator* cmQtAutoGenerators::CreateGlobalGenerator(cmake* cm, const char* targetDirectory) { cmGlobalGenerator* gg = new cmGlobalGenerator(); @@ -509,7 +509,7 @@ cmGlobalGenerator* cmQtAutomoc::CreateGlobalGenerator(cmake* cm, } -bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, +bool cmQtAutoGenerators::ReadAutomocInfoFile(cmMakefile* makefile, const char* targetDirectory, const char *config) { @@ -569,7 +569,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, } -std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile) +std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile) { std::string s; s += makefile->GetSafeDefinition("AM_MOC_COMPILE_DEFINITIONS"); @@ -586,7 +586,7 @@ std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile) } -bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile, +bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, const char* targetDirectory) { std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); @@ -602,7 +602,8 @@ bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile, } -void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory) +void +cmQtAutoGenerators::WriteOldMocDefinitionsFile(const char* targetDirectory) { std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); @@ -619,7 +620,7 @@ void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory) } -void cmQtAutomoc::Init() +void cmQtAutoGenerators::Init() { this->OutMocCppFilename = this->Builddir; this->OutMocCppFilename += this->TargetName; @@ -706,7 +707,7 @@ void cmQtAutomoc::Init() } -bool cmQtAutomoc::RunAutomoc(cmMakefile* makefile) +bool cmQtAutoGenerators::RunAutomoc(cmMakefile* makefile) { if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str()) || (this->OldCompileSettingsStr != this->CurrentCompileSettingsStr)) @@ -830,7 +831,7 @@ bool cmQtAutomoc::RunAutomoc(cmMakefile* makefile) } -void cmQtAutomoc::ParseCppFile(const std::string& absFilename, +void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, const std::vector& headerExtensions, std::map& includedMocs) { @@ -1011,7 +1012,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, } -void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, +void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, const std::vector& headerExtensions, std::map& includedMocs) { @@ -1124,7 +1125,8 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, } -void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, +void +cmQtAutoGenerators::SearchHeadersForCppFile(const std::string& absFilename, const std::vector& headerExtensions, std::set& absHeaders) { @@ -1160,7 +1162,7 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, } -void cmQtAutomoc::ParseHeaders(const std::set& absHeaders, +void cmQtAutoGenerators::ParseHeaders(const std::set& absHeaders, const std::map& includedMocs, std::map& notIncludedMocs) { @@ -1194,7 +1196,7 @@ void cmQtAutomoc::ParseHeaders(const std::set& absHeaders, } -bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, +bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, const std::string& mocFileName) { const std::string mocFilePath = this->Builddir + mocFileName; @@ -1271,7 +1273,7 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, } -std::string cmQtAutomoc::Join(const std::vector& lst, +std::string cmQtAutoGenerators::Join(const std::vector& lst, char separator) { if (lst.empty()) @@ -1291,13 +1293,15 @@ std::string cmQtAutomoc::Join(const std::vector& lst, } -bool cmQtAutomoc::StartsWith(const std::string& str, const std::string& with) +bool cmQtAutoGenerators::StartsWith(const std::string& str, + const std::string& with) { return (str.substr(0, with.length()) == with); } -bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with) +bool cmQtAutoGenerators::EndsWith(const std::string& str, + const std::string& with) { if (with.length() > (str.length())) { @@ -1307,7 +1311,7 @@ bool cmQtAutomoc::EndsWith(const std::string& str, const std::string& with) } -std::string cmQtAutomoc::ReadAll(const std::string& filename) +std::string cmQtAutoGenerators::ReadAll(const std::string& filename) { std::ifstream file(filename.c_str()); cmsys_ios::stringstream stream; diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutoGenerators.h similarity index 95% rename from Source/cmQtAutomoc.h rename to Source/cmQtAutoGenerators.h index ebeeb0eee..ef38a5b73 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutoGenerators.h @@ -11,20 +11,20 @@ See the License for more information. ============================================================================*/ -#ifndef cmQtAutomoc_h -#define cmQtAutomoc_h +#ifndef cmQtAutoGenerators_h +#define cmQtAutoGenerators_h class cmGlobalGenerator; class cmMakefile; -class cmQtAutomoc +class cmQtAutoGenerators { public: - cmQtAutomoc(); + cmQtAutoGenerators(); bool Run(const char* targetDirectory, const char *config); bool InitializeMocSourceFile(cmTarget* target); - void SetupAutomocTarget(cmTarget* target); + void SetupAutoGenerateTarget(cmTarget* target); private: cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9814aeaee..2fba5dc82 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -13,7 +13,7 @@ #include "cmMakefile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" -#include "cmQtAutomoc.h" +#include "cmQtAutoGenerators.h" #include "cmVersion.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -634,7 +634,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) } else if (args[1] == "cmake_automoc") { - cmQtAutomoc automoc; + cmQtAutoGenerators automoc; const char *config = args[3].empty() ? 0 : args[3].c_str(); bool automocSuccess = automoc.Run(args[2].c_str(), config); return automocSuccess ? 0 : 1;