Merge topic 'refactor-qt-autogen'

15c02cf1 QtAutogen: Port API to cmGeneratorTarget.
f7738fd1 cmLocalGenerator: Constify target in API.
b2054e16 QtAutogen: Port global generator to cmGeneratorTarget.
1e757c31 QtAutogen: Use a target type between loops.
5fb73017 QtAutogen: Make some private statics file static.
86f7fc5d QtAutogen: Move SetupAutoRccTarget method.
2aa3f500 QtAutogen: Move MergeRccOptions method.
59b91107 QtAutogen: Move GetRccExecutable method.
7254f645 QtAutogen: Move SetupAutoUicTarget method.
975b7539 QtAutogen: Move GetUicOpts method.
f75ec604 QtAutogen: Move SetupAutoMocTarget method.
f3158e45 QtAutogen: Move GetCompileDefinitionsAndDirectories method.
493b17f8 QtAutogen: Move SetupSourceFiles method.
This commit is contained in:
Brad King 2015-10-06 10:58:58 -04:00 committed by CMake Topic Stage
commit 9d5bfa53e6
6 changed files with 607 additions and 668 deletions

View File

@ -1251,7 +1251,7 @@ bool cmGlobalGenerator::Compute()
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have // Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set // the AUTOMOC, AUTOUIC or AUTORCC property set
std::vector<cmTarget const*> autogenTargets = std::vector<cmGeneratorTarget const*> autogenTargets =
this->CreateQtAutoGeneratorsTargets(); this->CreateQtAutoGeneratorsTargets();
#endif #endif
@ -1264,8 +1264,8 @@ bool cmGlobalGenerator::Compute()
} }
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin(); for (std::vector<cmGeneratorTarget const*>::iterator it =
it != autogenTargets.end(); ++it) autogenTargets.begin(); it != autogenTargets.end(); ++it)
{ {
cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*it); cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*it);
} }
@ -1403,18 +1403,18 @@ bool cmGlobalGenerator::ComputeTargetDepends()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::vector<const cmTarget*> std::vector<const cmGeneratorTarget*>
cmGlobalGenerator::CreateQtAutoGeneratorsTargets() cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
{ {
std::vector<const cmTarget*> autogenTargets; std::vector<const cmGeneratorTarget*> autogenTargets;
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{ {
cmTargets& targets = cmTargets& targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets(); this->LocalGenerators[i]->GetMakefile()->GetTargets();
std::vector<std::string> targetNames; std::vector<cmGeneratorTarget*> filteredTargets;
targetNames.reserve(targets.size()); filteredTargets.reserve(targets.size());
for(cmTargets::iterator ti = targets.begin(); for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
@ -1449,17 +1449,17 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
continue; continue;
} }
cmQtAutoGeneratorInitializer::InitializeAutogenSources(&ti->second); cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second);
targetNames.push_back(ti->second.GetName());
cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt);
filteredTargets.push_back(gt);
} }
for(std::vector<std::string>::iterator ti = targetNames.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = filteredTargets.begin();
ti != targetNames.end(); ++ti) ti != filteredTargets.end(); ++ti)
{ {
cmTarget* target = this->LocalGenerators[i]
->GetMakefile()->FindTarget(*ti, true);
cmQtAutoGeneratorInitializer::InitializeAutogenTarget( cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
this->LocalGenerators[i], target); this->LocalGenerators[i], *ti);
autogenTargets.push_back(target); autogenTargets.push_back(*ti);
} }
} }
#endif #endif

View File

@ -384,7 +384,7 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
std::vector<cmTarget const*> CreateQtAutoGeneratorsTargets(); std::vector<const cmGeneratorTarget*> CreateQtAutoGeneratorsTargets();
std::string SelectMakeProgram(const std::string& makeProgram, std::string SelectMakeProgram(const std::string& makeProgram,
const std::string& makeDefault = "") const; const std::string& makeDefault = "") const;

View File

@ -1180,7 +1180,7 @@ void cmLocalGenerator::AddCompileOptions(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target, cmGeneratorTarget const* target,
const std::string& lang, const std::string& lang,
const std::string& config, const std::string& config,
bool stripImplicitInclDirs bool stripImplicitInclDirs

View File

@ -171,7 +171,7 @@ public:
/** Get the include flags for the current makefile and language. */ /** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs, void GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target, cmGeneratorTarget const* target,
const std::string& lang = "C", const std::string& lang = "C",
const std::string& config = "", const std::string& config = "",
bool stripImplicitInclDirs = true) const; bool stripImplicitInclDirs = true) const;

File diff suppressed because it is too large Load Diff

View File

@ -21,47 +21,16 @@
#include <map> #include <map>
class cmSourceFile; class cmSourceFile;
class cmTarget; class cmGeneratorTarget;
class cmLocalGenerator; class cmLocalGenerator;
class cmQtAutoGeneratorInitializer class cmQtAutoGeneratorInitializer
{ {
public: public:
static void InitializeAutogenSources(cmTarget* target); static void InitializeAutogenSources(cmGeneratorTarget* target);
static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target); static void InitializeAutogenTarget(cmLocalGenerator* lg,
static void SetupAutoGenerateTarget(cmTarget const* target); cmGeneratorTarget* target);
static void SetupAutoGenerateTarget(cmGeneratorTarget 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