diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-08-31 20:26:47 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-09-07 15:53:19 (GMT) |
commit | f23a24c2878ffc0b6f769d5a61509b254d082c03 (patch) | |
tree | 2a32a37d144efd9ef976685201b88e1b8e83a5aa | |
parent | 37ef18a468149ba579b96a763ea3042a360652d7 (diff) | |
download | CMake-f23a24c2878ffc0b6f769d5a61509b254d082c03.zip CMake-f23a24c2878ffc0b6f769d5a61509b254d082c03.tar.gz CMake-f23a24c2878ffc0b6f769d5a61509b254d082c03.tar.bz2 |
Autogen: Use list of lists functions for UIC options
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 9 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 68 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 2 |
3 files changed, 30 insertions, 49 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index c7747b8..ed01a3c 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -487,7 +487,7 @@ static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest, // Uic files options { std::vector<std::string> uiFileFiles; - std::vector<std::string> uiFileOptions; + std::vector<std::vector<std::string>> uiFileOptions; { const std::string uiExt = "ui"; const std::vector<cmSourceFile*>& srcFiles = makefile->GetSourceFiles(); @@ -496,14 +496,15 @@ static void SetupAutoTargetUic(const cmQtAutoGenDigest& digest, const std::string& fPath = sf->GetFullPath(); if (sf->GetExtension() == uiExt) { // Check if the files has uic options - std::string uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); + const std::string uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); if (!uicOpts.empty()) { const std::string absFile = cmSystemTools::GetRealPath(fPath); // Check if file isn't skipped if (setup.UicSkip.count(absFile) == 0) { uiFileFiles.push_back(absFile); - cmSystemTools::ReplaceString(uicOpts, ";", cmQtAutoGen::listSep); - uiFileOptions.push_back(uicOpts); + std::vector<std::string> optsVec; + cmSystemTools::ExpandListArgument(uicOpts, optsVec); + uiFileOptions.push_back(std::move(optsVec)); } } } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 8dc6420..71e51bd 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -200,26 +200,6 @@ static bool ListContains(const std::vector<std::string>& list, return (std::find(list.begin(), list.end(), entry) != list.end()); } -static std::string JoinOptionsList(const std::vector<std::string>& opts) -{ - return cmOutputConverter::EscapeForCMake(cmJoin(opts, ";")); -} - -static std::string JoinOptionsMap( - const std::map<std::string, std::string>& opts) -{ - std::string result; - for (const auto& item : opts) { - if (!result.empty()) { - result += cmQtAutoGen::listSep; - } - result += item.first; - result += "==="; - result += item.second; - } - return result; -} - // -- Class methods cmQtAutoGenerators::cmQtAutoGenerators() @@ -433,18 +413,17 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( InfoGetConfig(makefile, "AM_UIC_TARGET_OPTIONS", config, this->UicTargetOptions); { - std::vector<std::string> uicFilesVec; - std::vector<std::string> uicOptionsVec; - InfoGet(makefile, "AM_UIC_OPTIONS_FILES", uicFilesVec); - InfoGet(makefile, "AM_UIC_OPTIONS_OPTIONS", uicOptionsVec); + auto uicFiles = InfoGetList(makefile, "AM_UIC_OPTIONS_FILES"); + auto uicOptions = InfoGetLists(makefile, "AM_UIC_OPTIONS_OPTIONS"); // Compare list sizes - if (uicFilesVec.size() == uicOptionsVec.size()) { - for (std::vector<std::string>::iterator - fileIt = uicFilesVec.begin(), - optionIt = uicOptionsVec.begin(); - fileIt != uicFilesVec.end(); ++fileIt, ++optionIt) { - cmSystemTools::ReplaceString(*optionIt, cmQtAutoGen::listSep, ";"); - this->UicOptions[*fileIt] = *optionIt; + if (uicFiles.size() == uicOptions.size()) { + auto fitEnd = uicFiles.cend(); + auto fit = uicFiles.begin(); + auto oit = uicOptions.begin(); + while (fit != fitEnd) { + this->UicOptions[*fit] = std::move(*oit); + ++fit; + ++oit; } } else { this->LogError( @@ -519,15 +498,15 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile) std::string str; str += this->MocExecutable; str += sep; - str += JoinOptionsList(this->MocDefinitions); + str += cmJoin(this->MocDefinitions, ";"); str += sep; - str += JoinOptionsList(this->MocIncludePaths); + str += cmJoin(this->MocIncludePaths, ";"); str += sep; - str += JoinOptionsList(this->MocOptions); + str += cmJoin(this->MocOptions, ";"); str += sep; str += this->IncludeProjectDirsBefore ? "TRUE" : "FALSE"; str += sep; - str += JoinOptionsList(this->MocPredefsCmd); + str += cmJoin(this->MocPredefsCmd, ";"); str += sep; this->SettingsStringMoc = crypt.HashString(str); } @@ -535,9 +514,13 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile) std::string str; str += this->UicExecutable; str += sep; - str += JoinOptionsList(this->UicTargetOptions); - str += sep; - str += JoinOptionsMap(this->UicOptions); + str += cmJoin(this->UicTargetOptions, ";"); + for (const auto& item : this->UicOptions) { + str += sep; + str += item.first; + str += sep; + str += cmJoin(item.second, ";"); + } str += sep; this->SettingsStringUic = crypt.HashString(str); } @@ -550,7 +533,7 @@ void cmQtAutoGenerators::SettingsFileRead(cmMakefile* makefile) str += sep; str += rccJob.RccFile; str += sep; - str += JoinOptionsList(rccJob.Options); + str += cmJoin(rccJob.Options, ";"); } str += sep; this->SettingsStringRcc = crypt.HashString(str); @@ -1566,12 +1549,9 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName, cmd.push_back(this->UicExecutable); { std::vector<std::string> allOpts = this->UicTargetOptions; - std::map<std::string, std::string>::const_iterator optionIt = - this->UicOptions.find(uiInputFile); + auto optionIt = this->UicOptions.find(uiInputFile); if (optionIt != this->UicOptions.end()) { - std::vector<std::string> fileOpts; - cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); - cmQtAutoGen::UicMergeOptions(allOpts, fileOpts, + cmQtAutoGen::UicMergeOptions(allOpts, optionIt->second, (this->QtMajorVersion == "5")); } cmd.insert(cmd.end(), allOpts.begin(), allOpts.end()); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 975b0b6..12d526b 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -229,7 +229,7 @@ private: bool UicRunFailed; std::vector<std::string> UicSkipList; std::vector<std::string> UicTargetOptions; - std::map<std::string, std::string> UicOptions; + std::map<std::string, std::vector<std::string>> UicOptions; std::vector<std::string> UicSearchPaths; cmsys::RegularExpression UicRegExpInclude; // -- Rcc |