QtAutogen: Make some methods static.

This commit is contained in:
Stephen Kelly 2015-09-20 16:40:49 +02:00
parent 6210ec644a
commit e791c85419
3 changed files with 29 additions and 26 deletions

View File

@ -1439,10 +1439,10 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
|| target.GetPropertyAsBool("AUTORCC")) || target.GetPropertyAsBool("AUTORCC"))
&& !target.IsImported()) && !target.IsImported())
{ {
cmQtAutoGenerators autogen; if(cmQtAutoGenerators::InitializeAutogenTarget(
if(autogen.InitializeAutogenTarget(this->LocalGenerators[i], this->LocalGenerators[i], &target))
&target))
{ {
cmQtAutoGenerators autogen;
autogens.push_back(std::make_pair(autogen, &target)); autogens.push_back(std::make_pair(autogen, &target));
} }
} }

View File

@ -184,7 +184,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
cmTarget const* target, cmTarget const* target,
std::vector<std::string>& depends) std::vector<std::string>& depends)
{ {
std::string rccCommand = this->GetRccExecutable(target); std::string rccCommand = cmQtAutoGenerators::GetRccExecutable(target);
std::vector<std::string> qrcEntries; std::vector<std::string> qrcEntries;
std::vector<std::string> command; std::vector<std::string> command;
@ -434,11 +434,11 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
{ {
if (qtMajorVersion == "5") if (qtMajorVersion == "5")
{ {
this->ListQt5RccInputs(sf, target, depends); cmQtAutoGenerators::ListQt5RccInputs(sf, target, depends);
} }
else else
{ {
this->ListQt4RccInputs(sf, depends); cmQtAutoGenerators::ListQt4RccInputs(sf, depends);
} }
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
// Cannot use PRE_BUILD because the resource files themselves // Cannot use PRE_BUILD because the resource files themselves
@ -573,23 +573,24 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
|| target->GetPropertyAsBool("AUTOUIC") || target->GetPropertyAsBool("AUTOUIC")
|| target->GetPropertyAsBool("AUTORCC")) || target->GetPropertyAsBool("AUTORCC"))
{ {
this->SetupSourceFiles(target, skipMoc, mocSources, mocHeaders, skipUic); cmQtAutoGenerators::SetupSourceFiles(target, skipMoc,
mocSources, mocHeaders, skipUic);
} }
makefile->AddDefinition("_cpp_files", makefile->AddDefinition("_cpp_files",
cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str()); cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str());
if (target->GetPropertyAsBool("AUTOMOC")) if (target->GetPropertyAsBool("AUTOMOC"))
{ {
this->SetupAutoMocTarget(target, autogenTargetName, cmQtAutoGenerators::SetupAutoMocTarget(target, autogenTargetName,
skipMoc, mocHeaders, skipMoc, mocHeaders,
configIncludes, configDefines); configIncludes, configDefines);
} }
if (target->GetPropertyAsBool("AUTOUIC")) if (target->GetPropertyAsBool("AUTOUIC"))
{ {
this->SetupAutoUicTarget(target, skipUic, configUicOptions); cmQtAutoGenerators::SetupAutoUicTarget(target, skipUic, configUicOptions);
} }
if (target->GetPropertyAsBool("AUTORCC")) if (target->GetPropertyAsBool("AUTORCC"))
{ {
this->SetupAutoRccTarget(target); cmQtAutoGenerators::SetupAutoRccTarget(target);
} }
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
@ -1095,7 +1096,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
{ {
std::vector<std::string> optsVec; std::vector<std::string> optsVec;
cmSystemTools::ExpandListArgument(prop, optsVec); cmSystemTools::ExpandListArgument(prop, optsVec);
this->MergeRccOptions(rccOptions, optsVec, cmQtAutoGenerators::MergeRccOptions(rccOptions, optsVec,
strcmp(qtVersion, "5") == 0); strcmp(qtVersion, "5") == 0);
} }
@ -1123,11 +1124,12 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
{ {
if (qtMajorVersion == "5") if (qtMajorVersion == "5")
{ {
entriesList = this->ListQt5RccInputs(sf, target, depends); entriesList = cmQtAutoGenerators::ListQt5RccInputs(sf, target,
depends);
} }
else else
{ {
entriesList = this->ListQt4RccInputs(sf, depends); entriesList = cmQtAutoGenerators::ListQt4RccInputs(sf, depends);
} }
if (entriesList.empty()) if (entriesList.empty())
{ {
@ -1152,7 +1154,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
makefile->AddDefinition("_qt_rcc_executable", makefile->AddDefinition("_qt_rcc_executable",
this->GetRccExecutable(target).c_str()); cmQtAutoGenerators::GetRccExecutable(target).c_str());
} }
std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target) std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
@ -2248,7 +2250,8 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
{ {
std::vector<std::string> fileOpts; std::vector<std::string> fileOpts;
cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5"); cmQtAutoGenerators::MergeUicOptions(opts, fileOpts,
this->QtMajorVersion == "5");
} }
command.insert(command.end(), opts.begin(), opts.end()); command.insert(command.end(), opts.begin(), opts.end());

View File

@ -31,26 +31,26 @@ public:
cmQtAutoGenerators(); cmQtAutoGenerators();
bool Run(const std::string& targetDirectory, const std::string& config); bool Run(const std::string& targetDirectory, const std::string& config);
bool InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target); static bool InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
void SetupAutoGenerateTarget(cmTarget const* target); static void SetupAutoGenerateTarget(cmTarget const* target);
private: private:
void SetupSourceFiles(cmTarget const* target, static void SetupSourceFiles(cmTarget const* target,
std::vector<std::string>& skipMoc, std::vector<std::string>& skipMoc,
std::vector<std::string>& mocSources, std::vector<std::string>& mocSources,
std::vector<std::string>& mocHeaders, std::vector<std::string>& mocHeaders,
std::vector<std::string>& skipUic); std::vector<std::string>& skipUic);
void SetupAutoMocTarget(cmTarget const* target, static void SetupAutoMocTarget(cmTarget const* target,
const std::string &autogenTargetName, const std::string &autogenTargetName,
const std::vector<std::string>& skipMoc, const std::vector<std::string>& skipMoc,
const std::vector<std::string>& mocHeaders, const std::vector<std::string>& mocHeaders,
std::map<std::string, std::string> &configIncludes, std::map<std::string, std::string> &configIncludes,
std::map<std::string, std::string> &configDefines); std::map<std::string, std::string> &configDefines);
void SetupAutoUicTarget(cmTarget const* target, static void SetupAutoUicTarget(cmTarget const* target,
const std::vector<std::string>& skipUic, const std::vector<std::string>& skipUic,
std::map<std::string, std::string> &configUicOptions); std::map<std::string, std::string> &configUicOptions);
void SetupAutoRccTarget(cmTarget const* target); static void SetupAutoRccTarget(cmTarget const* target);
bool ReadAutogenInfoFile(cmMakefile* makefile, bool ReadAutogenInfoFile(cmMakefile* makefile,
const std::string& targetDirectory, const std::string& targetDirectory,
@ -96,18 +96,18 @@ private:
bool EndsWith(const std::string& str, const std::string& with); bool EndsWith(const std::string& str, const std::string& with);
bool StartsWith(const std::string& str, const std::string& with); bool StartsWith(const std::string& str, const std::string& with);
void MergeUicOptions(std::vector<std::string> &opts, static void MergeUicOptions(std::vector<std::string> &opts,
const std::vector<std::string> &fileOpts, bool isQt5); const std::vector<std::string> &fileOpts, bool isQt5);
void MergeRccOptions(std::vector<std::string> &opts, static void MergeRccOptions(std::vector<std::string> &opts,
const std::vector<std::string> &fileOpts, bool isQt5); const std::vector<std::string> &fileOpts, bool isQt5);
std::string GetRccExecutable(cmTarget const* target); static std::string GetRccExecutable(cmTarget const* target);
std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target, static std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target,
std::vector<std::string>& depends); std::vector<std::string>& depends);
std::string ListQt4RccInputs(cmSourceFile* sf, static std::string ListQt4RccInputs(cmSourceFile* sf,
std::vector<std::string>& depends); std::vector<std::string>& depends);
bool InputFilesNewerThanQrc(const std::string& qrcFile, bool InputFilesNewerThanQrc(const std::string& qrcFile,