diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-09-26 16:54:56 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-09-26 17:32:54 (GMT) |
commit | 1e83a963d8983f09f5fe6fbf7d268f920b4ed7d0 (patch) | |
tree | ac7da1df619640dea3423f2875641a1da9aefd92 /Source | |
parent | 12f0e13c5f546a721d893adedba327c18c5c9e5e (diff) | |
download | CMake-1e83a963d8983f09f5fe6fbf7d268f920b4ed7d0.zip CMake-1e83a963d8983f09f5fe6fbf7d268f920b4ed7d0.tar.gz CMake-1e83a963d8983f09f5fe6fbf7d268f920b4ed7d0.tar.bz2 |
QtAutogen: Split initializer methods into separate class.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 53 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 36 |
3 files changed, 55 insertions, 40 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 5848a88..a86c91c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1269,7 +1269,7 @@ bool cmGlobalGenerator::Compute() for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin(); it != autogenTargets.end(); ++it) { - cmQtAutoGenerators::SetupAutoGenerateTarget(*it); + cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*it); } #endif @@ -1451,7 +1451,7 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets() continue; } - cmQtAutoGenerators::InitializeAutogenSources(&ti->second); + cmQtAutoGeneratorInitializer::InitializeAutogenSources(&ti->second); targetNames.push_back(ti->second.GetName()); } for(std::vector<std::string>::iterator ti = targetNames.begin(); @@ -1459,7 +1459,7 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets() { cmTarget* target = this->LocalGenerators[i] ->GetMakefile()->FindTarget(*ti, true); - cmQtAutoGenerators::InitializeAutogenTarget( + cmQtAutoGeneratorInitializer::InitializeAutogenTarget( this->LocalGenerators[i], target); autogenTargets.push_back(target); } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 9bec68a..62b5cb1 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -180,11 +180,12 @@ static std::string cmQtAutoGeneratorsStripCR(std::string const& line) return line; } -std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf, +std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target, std::vector<std::string>& depends) { - std::string rccCommand = cmQtAutoGenerators::GetRccExecutable(target); + std::string rccCommand + = cmQtAutoGeneratorInitializer::GetRccExecutable(target); std::vector<std::string> qrcEntries; std::vector<std::string> command; @@ -250,7 +251,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf, return cmJoin(qrcEntries, "@list_sep@"); } -std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf, +std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf, std::vector<std::string>& depends) { const std::string qrcContents = ReadAll(sf->GetFullPath()); @@ -287,7 +288,7 @@ std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf, } -void cmQtAutoGenerators::InitializeAutogenSources(cmTarget* target) +void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); @@ -306,7 +307,8 @@ void cmQtAutoGenerators::InitializeAutogenSources(cmTarget* target) } } -void cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, +void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( + cmLocalGenerator* lg, cmTarget* target) { cmMakefile* makefile = target->GetMakefile(); @@ -437,11 +439,12 @@ void cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, { if (qtMajorVersion == "5") { - cmQtAutoGenerators::ListQt5RccInputs(sf, target, depends); + cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, target, + depends); } else { - cmQtAutoGenerators::ListQt4RccInputs(sf, depends); + cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends); } #if defined(_WIN32) && !defined(__CYGWIN__) // Cannot use PRE_BUILD because the resource files themselves @@ -526,7 +529,8 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target, defs += cmJoin(defines, ";"); } -void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) +void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( + cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); @@ -574,24 +578,25 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) || target->GetPropertyAsBool("AUTOUIC") || target->GetPropertyAsBool("AUTORCC")) { - cmQtAutoGenerators::SetupSourceFiles(target, skipMoc, + cmQtAutoGeneratorInitializer::SetupSourceFiles(target, skipMoc, mocSources, mocHeaders, skipUic); } makefile->AddDefinition("_cpp_files", cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str()); if (target->GetPropertyAsBool("AUTOMOC")) { - cmQtAutoGenerators::SetupAutoMocTarget(target, autogenTargetName, + cmQtAutoGeneratorInitializer::SetupAutoMocTarget(target, autogenTargetName, skipMoc, mocHeaders, configIncludes, configDefines); } if (target->GetPropertyAsBool("AUTOUIC")) { - cmQtAutoGenerators::SetupAutoUicTarget(target, skipUic, configUicOptions); + cmQtAutoGeneratorInitializer::SetupAutoUicTarget(target, skipUic, + configUicOptions); } if (target->GetPropertyAsBool("AUTORCC")) { - cmQtAutoGenerators::SetupAutoRccTarget(target); + cmQtAutoGeneratorInitializer::SetupAutoRccTarget(target); } const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); @@ -662,7 +667,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) } } -void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target, +void cmQtAutoGeneratorInitializer::SetupSourceFiles(cmTarget const* target, std::vector<std::string>& skipMoc, std::vector<std::string>& mocSources, std::vector<std::string>& mocHeaders, @@ -745,7 +750,7 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target, } } -void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, +void cmQtAutoGeneratorInitializer::SetupAutoMocTarget(cmTarget const* target, const std::string &autogenTargetName, std::vector<std::string> const& skipMoc, std::vector<std::string> const& mocHeaders, @@ -893,7 +898,7 @@ static void GetUicOpts(cmTarget const* target, const std::string& config, optString = cmJoin(opts, ";"); } -void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, +void cmQtAutoGeneratorInitializer::SetupAutoUicTarget(cmTarget const* target, std::vector<std::string> const& skipUic, std::map<std::string, std::string> &configUicOptions) { @@ -1000,7 +1005,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } } -void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts, +void cmQtAutoGeneratorInitializer::MergeRccOptions( + std::vector<std::string> &opts, const std::vector<std::string> &fileOpts, bool isQt5) { @@ -1043,7 +1049,7 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts, opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) +void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target) { std::string _rcc_files; const char* sepRccFiles = ""; @@ -1097,7 +1103,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { std::vector<std::string> optsVec; cmSystemTools::ExpandListArgument(prop, optsVec); - cmQtAutoGenerators::MergeRccOptions(rccOptions, optsVec, + cmQtAutoGeneratorInitializer::MergeRccOptions(rccOptions, optsVec, strcmp(qtVersion, "5") == 0); } @@ -1125,12 +1131,14 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { if (qtMajorVersion == "5") { - entriesList = cmQtAutoGenerators::ListQt5RccInputs(sf, target, + entriesList = cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, + target, depends); } else { - entriesList = cmQtAutoGenerators::ListQt4RccInputs(sf, depends); + entriesList = + cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends); } if (entriesList.empty()) { @@ -1155,10 +1163,11 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); makefile->AddDefinition("_qt_rcc_executable", - cmQtAutoGenerators::GetRccExecutable(target).c_str()); + cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str()); } -std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) +std::string cmQtAutoGeneratorInitializer::GetRccExecutable( + cmTarget const* target) { cmGeneratorTarget *gtgt = target->GetMakefile() ->GetGlobalGenerator() diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 5f8ee62..63b1c4a 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -25,12 +25,9 @@ class cmLocalGenerator; class cmTarget; class cmSourceFile; -class cmQtAutoGenerators +class cmQtAutoGeneratorInitializer { public: - cmQtAutoGenerators(); - bool Run(const std::string& targetDirectory, const std::string& config); - static void InitializeAutogenSources(cmTarget* target); static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target); static void SetupAutoGenerateTarget(cmTarget const* target); @@ -53,6 +50,26 @@ private: std::map<std::string, std::string> &configUicOptions); static void SetupAutoRccTarget(cmTarget const* target); + static void MergeRccOptions(std::vector<std::string> &opts, + const std::vector<std::string> &fileOpts, bool isQt5); + + static std::string GetRccExecutable(cmTarget const* target); + + static std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target, + std::vector<std::string>& depends); + + static std::string ListQt4RccInputs(cmSourceFile* sf, + std::vector<std::string>& depends); +}; + +class cmQtAutoGenerators +{ +public: + cmQtAutoGenerators(); + bool Run(const std::string& targetDirectory, const std::string& config); + +private: + bool ReadAutogenInfoFile(cmMakefile* makefile, const std::string& targetDirectory, const std::string& config); @@ -100,17 +117,6 @@ private: static void MergeUicOptions(std::vector<std::string> &opts, const std::vector<std::string> &fileOpts, bool isQt5); - static void MergeRccOptions(std::vector<std::string> &opts, - const std::vector<std::string> &fileOpts, bool isQt5); - - static std::string GetRccExecutable(cmTarget const* target); - - static std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target, - std::vector<std::string>& depends); - - static std::string ListQt4RccInputs(cmSourceFile* sf, - std::vector<std::string>& depends); - bool InputFilesNewerThanQrc(const std::string& qrcFile, const std::string& rccOutput); |