QtAutogen: Make some private statics file static.

This commit is contained in:
Stephen Kelly 2015-10-05 19:21:48 +02:00
parent 86f7fc5d55
commit 5fb730174d
2 changed files with 27 additions and 72 deletions

View File

@ -25,7 +25,7 @@
# include "cmGlobalVisualStudioGenerator.h" # include "cmGlobalVisualStudioGenerator.h"
#endif #endif
void cmQtAutoGeneratorInitializer::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,
@ -130,7 +130,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
defs += cmJoin(defines, ";"); defs += cmJoin(defines, ";");
} }
void cmQtAutoGeneratorInitializer::SetupAutoMocTarget(cmTarget const* target, static void SetupAutoMocTarget(cmTarget const* target,
const std::string &autogenTargetName, const std::string &autogenTargetName,
std::vector<std::string> const& skipMoc, std::vector<std::string> const& skipMoc,
std::vector<std::string> const& mocHeaders, std::vector<std::string> const& mocHeaders,
@ -233,7 +233,7 @@ static void GetUicOpts(cmTarget const* target, const std::string& config,
optString = cmJoin(opts, ";"); optString = cmJoin(opts, ";");
} }
void cmQtAutoGeneratorInitializer::SetupAutoUicTarget(cmTarget const* target, static void SetupAutoUicTarget(cmTarget const* target,
std::vector<std::string> const& skipUic, std::vector<std::string> const& skipUic,
std::map<std::string, std::string> &configUicOptions) std::map<std::string, std::string> &configUicOptions)
{ {
@ -340,8 +340,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoUicTarget(cmTarget const* target,
} }
} }
std::string cmQtAutoGeneratorInitializer::GetRccExecutable( static std::string GetRccExecutable(cmTarget const* target)
cmTarget const* target)
{ {
cmGeneratorTarget *gtgt = target->GetMakefile() cmGeneratorTarget *gtgt = target->GetMakefile()
->GetGlobalGenerator() ->GetGlobalGenerator()
@ -391,8 +390,7 @@ std::string cmQtAutoGeneratorInitializer::GetRccExecutable(
return std::string(); return std::string();
} }
void cmQtAutoGeneratorInitializer::MergeRccOptions( static void MergeRccOptions(std::vector<std::string> &opts,
std::vector<std::string> &opts,
const std::vector<std::string> &fileOpts, const std::vector<std::string> &fileOpts,
bool isQt5) bool isQt5)
{ {
@ -435,7 +433,7 @@ void cmQtAutoGeneratorInitializer::MergeRccOptions(
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
} }
std::string cmQtAutoGeneratorInitializer::GetAutogenTargetName( std::string GetAutogenTargetName(
cmTarget const* target) cmTarget const* target)
{ {
std::string autogenTargetName = target->GetName(); std::string autogenTargetName = target->GetName();
@ -443,14 +441,14 @@ std::string cmQtAutoGeneratorInitializer::GetAutogenTargetName(
return autogenTargetName; return autogenTargetName;
} }
std::string cmQtAutoGeneratorInitializer::GetAutogenTargetDir( std::string GetAutogenTargetDir(
cmTarget const* target) cmTarget const* target)
{ {
cmMakefile* makefile = target->GetMakefile(); cmMakefile* makefile = target->GetMakefile();
std::string targetDir = makefile->GetCurrentBinaryDirectory(); std::string targetDir = makefile->GetCurrentBinaryDirectory();
targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
targetDir += "/"; targetDir += "/";
targetDir += cmQtAutoGeneratorInitializer::GetAutogenTargetName(target); targetDir += GetAutogenTargetName(target);
targetDir += ".dir/"; targetDir += ".dir/";
return targetDir; return targetDir;
} }
@ -486,12 +484,12 @@ static std::string ReadAll(const std::string& filename)
return stream.str(); return stream.str();
} }
std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf, static std::string ListQt5RccInputs(cmSourceFile* sf,
cmTarget const* target, cmTarget const* target,
std::vector<std::string>& depends) std::vector<std::string>& depends)
{ {
std::string rccCommand std::string rccCommand
= cmQtAutoGeneratorInitializer::GetRccExecutable(target); = GetRccExecutable(target);
std::vector<std::string> qrcEntries; std::vector<std::string> qrcEntries;
std::vector<std::string> command; std::vector<std::string> command;
@ -557,7 +555,7 @@ std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf,
return cmJoin(qrcEntries, "@list_sep@"); return cmJoin(qrcEntries, "@list_sep@");
} }
std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf, static std::string ListQt4RccInputs(cmSourceFile* sf,
std::vector<std::string>& depends) std::vector<std::string>& depends)
{ {
const std::string qrcContents = ReadAll(sf->GetFullPath()); const std::string qrcContents = ReadAll(sf->GetFullPath());
@ -593,7 +591,7 @@ std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf,
return entriesList; return entriesList;
} }
void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target) static void SetupAutoRccTarget(cmTarget const* target)
{ {
std::string _rcc_files; std::string _rcc_files;
const char* sepRccFiles = ""; const char* sepRccFiles = "";
@ -647,7 +645,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
{ {
std::vector<std::string> optsVec; std::vector<std::string> optsVec;
cmSystemTools::ExpandListArgument(prop, optsVec); cmSystemTools::ExpandListArgument(prop, optsVec);
cmQtAutoGeneratorInitializer::MergeRccOptions(rccOptions, optsVec, MergeRccOptions(rccOptions, optsVec,
strcmp(qtVersion, "5") == 0); strcmp(qtVersion, "5") == 0);
} }
@ -675,14 +673,11 @@ void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
{ {
if (qtMajorVersion == "5") if (qtMajorVersion == "5")
{ {
entriesList = cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, entriesList = ListQt5RccInputs(sf, target, depends);
target,
depends);
} }
else else
{ {
entriesList = entriesList = ListQt4RccInputs(sf, depends);
cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends);
} }
if (entriesList.empty()) if (entriesList.empty())
{ {
@ -707,7 +702,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
cmOutputConverter::EscapeForCMake(rccFileOptions).c_str()); cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
makefile->AddDefinition("_qt_rcc_executable", makefile->AddDefinition("_qt_rcc_executable",
cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str()); GetRccExecutable(target).c_str());
} }
void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target) void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target)
@ -716,8 +711,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target)
if (target->GetPropertyAsBool("AUTOMOC")) if (target->GetPropertyAsBool("AUTOMOC"))
{ {
std::string automocTargetName = std::string automocTargetName = GetAutogenTargetName(target);
cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
std::string mocCppFile = makefile->GetCurrentBinaryDirectory(); std::string mocCppFile = makefile->GetCurrentBinaryDirectory();
mocCppFile += "/"; mocCppFile += "/";
mocCppFile += automocTargetName; mocCppFile += automocTargetName;
@ -743,11 +737,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
} }
// create a custom target for running generators at buildtime: // create a custom target for running generators at buildtime:
std::string autogenTargetName = std::string autogenTargetName = GetAutogenTargetName(target);
cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
std::string targetDir = std::string targetDir = GetAutogenTargetDir(target);
cmQtAutoGeneratorInitializer::GetAutogenTargetDir(target);
cmCustomCommandLine currentLine; cmCustomCommandLine currentLine;
currentLine.push_back(cmSystemTools::GetCMakeCommand()); currentLine.push_back(cmSystemTools::GetCMakeCommand());
@ -864,12 +856,11 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
{ {
if (qtMajorVersion == "5") if (qtMajorVersion == "5")
{ {
cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, target, ListQt5RccInputs(sf, target, depends);
depends);
} }
else else
{ {
cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends); 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
@ -942,16 +933,14 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
static_cast<void>(varScope); static_cast<void>(varScope);
// create a custom target for running generators at buildtime: // create a custom target for running generators at buildtime:
std::string autogenTargetName = std::string autogenTargetName = GetAutogenTargetName(target);
cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
makefile->AddDefinition("_moc_target_name", makefile->AddDefinition("_moc_target_name",
cmOutputConverter::EscapeForCMake(autogenTargetName).c_str()); cmOutputConverter::EscapeForCMake(autogenTargetName).c_str());
makefile->AddDefinition("_origin_target_name", makefile->AddDefinition("_origin_target_name",
cmOutputConverter::EscapeForCMake(target->GetName()).c_str()); cmOutputConverter::EscapeForCMake(target->GetName()).c_str());
std::string targetDir = std::string targetDir = GetAutogenTargetDir(target);
cmQtAutoGeneratorInitializer::GetAutogenTargetDir(target);
const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR"); const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
if (!qtVersion) if (!qtVersion)
@ -983,25 +972,23 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
|| target->GetPropertyAsBool("AUTOUIC") || target->GetPropertyAsBool("AUTOUIC")
|| target->GetPropertyAsBool("AUTORCC")) || target->GetPropertyAsBool("AUTORCC"))
{ {
cmQtAutoGeneratorInitializer::SetupSourceFiles(target, skipMoc, SetupSourceFiles(target, skipMoc, mocSources, mocHeaders, skipUic);
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"))
{ {
cmQtAutoGeneratorInitializer::SetupAutoMocTarget(target, autogenTargetName, SetupAutoMocTarget(target, autogenTargetName,
skipMoc, mocHeaders, skipMoc, mocHeaders,
configIncludes, configDefines); configIncludes, configDefines);
} }
if (target->GetPropertyAsBool("AUTOUIC")) if (target->GetPropertyAsBool("AUTOUIC"))
{ {
cmQtAutoGeneratorInitializer::SetupAutoUicTarget(target, skipUic, SetupAutoUicTarget(target, skipUic, configUicOptions);
configUicOptions);
} }
if (target->GetPropertyAsBool("AUTORCC")) if (target->GetPropertyAsBool("AUTORCC"))
{ {
cmQtAutoGeneratorInitializer::SetupAutoRccTarget(target); SetupAutoRccTarget(target);
} }
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");

View File

@ -30,38 +30,6 @@ public:
static void InitializeAutogenSources(cmTarget* target); static void InitializeAutogenSources(cmTarget* target);
static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target); static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
static void SetupAutoGenerateTarget(cmTarget const* target); static void SetupAutoGenerateTarget(cmTarget const* target);
static std::string GetAutogenTargetName(cmTarget const* target);
static std::string GetAutogenTargetDir(cmTarget const* target);
private:
static void SetupSourceFiles(cmTarget const* target,
std::vector<std::string>& skipMoc,
std::vector<std::string>& mocSources,
std::vector<std::string>& mocHeaders,
std::vector<std::string>& skipUic);
static void SetupAutoMocTarget(cmTarget const* target,
const std::string &autogenTargetName,
const std::vector<std::string>& skipMoc,
const std::vector<std::string>& mocHeaders,
std::map<std::string, std::string> &configIncludes,
std::map<std::string, std::string> &configDefines);
static void SetupAutoUicTarget(cmTarget const* target,
const std::vector<std::string>& skipUic,
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);
}; };
#endif #endif