mirror of
https://github.com/reactos/CMake.git
synced 2025-03-05 18:37:46 +00:00
Autogen: Make cmQtAutoGeneratorInitializer an instantiable class
Remove the cmQtAutoGenDigest classes and make cmQtAutoGeneratorInitializer instantiable instead.
This commit is contained in:
parent
75819b8626
commit
2a85b5ac76
@ -311,7 +311,6 @@ set(SRCS
|
||||
cmPropertyMap.h
|
||||
cmQtAutoGen.cxx
|
||||
cmQtAutoGen.h
|
||||
cmQtAutoGenDigest.h
|
||||
cmQtAutoGenerator.cxx
|
||||
cmQtAutoGenerator.h
|
||||
cmQtAutoGeneratorInitializer.cxx
|
||||
|
@ -1314,7 +1314,10 @@ bool cmGlobalGenerator::Compute()
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
// Iterate through all targets and set up automoc for those which have
|
||||
// the AUTOMOC, AUTOUIC or AUTORCC property set
|
||||
cmQtAutoGenDigestUPV autogenDigests = this->CreateQtAutoGeneratorsTargets();
|
||||
auto autogenInits = this->CreateQtAutoGenInitializers();
|
||||
for (auto& autoGen : autogenInits) {
|
||||
autoGen->InitCustomTargets();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Add generator specific helper commands
|
||||
@ -1335,10 +1338,11 @@ bool cmGlobalGenerator::Compute()
|
||||
}
|
||||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
for (cmQtAutoGenDigestUP const& digest : autogenDigests) {
|
||||
cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*digest);
|
||||
for (auto& autoGen : autogenInits) {
|
||||
autoGen->SetupCustomTargets();
|
||||
autoGen.reset(nullptr);
|
||||
}
|
||||
autogenDigests.clear();
|
||||
autogenInits.clear();
|
||||
#endif
|
||||
|
||||
for (cmLocalGenerator* localGen : this->LocalGenerators) {
|
||||
@ -1469,9 +1473,10 @@ bool cmGlobalGenerator::ComputeTargetDepends()
|
||||
return true;
|
||||
}
|
||||
|
||||
cmQtAutoGenDigestUPV cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
|
||||
std::vector<std::unique_ptr<cmQtAutoGeneratorInitializer>>
|
||||
cmGlobalGenerator::CreateQtAutoGenInitializers()
|
||||
{
|
||||
cmQtAutoGenDigestUPV autogenDigests;
|
||||
std::vector<std::unique_ptr<cmQtAutoGeneratorInitializer>> autogenInits;
|
||||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
for (cmLocalGenerator* localGen : this->LocalGenerators) {
|
||||
@ -1507,25 +1512,12 @@ cmQtAutoGenDigestUPV cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
cmQtAutoGenDigestUP digest(new cmQtAutoGenDigest(target));
|
||||
digest->QtVersionMajor = std::move(qtVersionMajor);
|
||||
digest->QtVersionMinor =
|
||||
cmQtAutoGeneratorInitializer::GetQtMinorVersion(
|
||||
target, digest->QtVersionMajor);
|
||||
digest->MocEnabled = mocEnabled;
|
||||
digest->UicEnabled = uicEnabled;
|
||||
digest->RccEnabled = rccEnabled;
|
||||
autogenDigests.emplace_back(std::move(digest));
|
||||
}
|
||||
autogenInits.emplace_back(new cmQtAutoGeneratorInitializer(
|
||||
target, mocEnabled, uicEnabled, rccEnabled, qtVersionMajor));
|
||||
}
|
||||
}
|
||||
// Initialize autogen targets
|
||||
for (const cmQtAutoGenDigestUP& digest : autogenDigests) {
|
||||
cmQtAutoGeneratorInitializer::InitializeAutogenTarget(*digest);
|
||||
}
|
||||
#endif
|
||||
return autogenDigests;
|
||||
return autogenInits;
|
||||
}
|
||||
|
||||
cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "cmCustomCommandLines.h"
|
||||
#include "cmExportSetMap.h"
|
||||
#include "cmQtAutoGenDigest.h"
|
||||
#include "cmStateSnapshot.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmTarget.h"
|
||||
@ -33,6 +32,7 @@ class cmLinkLineComputer;
|
||||
class cmLocalGenerator;
|
||||
class cmMakefile;
|
||||
class cmOutputConverter;
|
||||
class cmQtAutoGeneratorInitializer;
|
||||
class cmSourceFile;
|
||||
class cmStateDirectory;
|
||||
class cmake;
|
||||
@ -433,7 +433,8 @@ protected:
|
||||
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
|
||||
|
||||
// Qt auto generators
|
||||
cmQtAutoGenDigestUPV CreateQtAutoGeneratorsTargets();
|
||||
std::vector<std::unique_ptr<cmQtAutoGeneratorInitializer>>
|
||||
CreateQtAutoGenInitializers();
|
||||
|
||||
std::string SelectMakeProgram(const std::string& makeProgram,
|
||||
const std::string& makeDefault = "") const;
|
||||
|
@ -1,66 +0,0 @@
|
||||
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#ifndef cmQtAutoGenDigest_h
|
||||
#define cmQtAutoGenDigest_h
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class cmGeneratorTarget;
|
||||
|
||||
class cmQtAutoGenDigestQrc
|
||||
{
|
||||
public:
|
||||
cmQtAutoGenDigestQrc()
|
||||
: Generated(false)
|
||||
, Unique(false)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
std::string QrcFile;
|
||||
std::string QrcName;
|
||||
std::string PathChecksum;
|
||||
std::string InfoFile;
|
||||
std::string SettingsFile;
|
||||
std::string RccFile;
|
||||
bool Generated;
|
||||
bool Unique;
|
||||
std::vector<std::string> Options;
|
||||
std::vector<std::string> Resources;
|
||||
};
|
||||
|
||||
/** \class cmQtAutoGenDigest
|
||||
* \brief Filtered set of QtAutogen variables for a specific target
|
||||
*/
|
||||
class cmQtAutoGenDigest
|
||||
{
|
||||
public:
|
||||
cmQtAutoGenDigest(cmGeneratorTarget* target)
|
||||
: Target(target)
|
||||
, MocEnabled(false)
|
||||
, UicEnabled(false)
|
||||
, RccEnabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
cmGeneratorTarget* Target;
|
||||
std::string QtVersionMajor;
|
||||
std::string QtVersionMinor;
|
||||
bool MocEnabled;
|
||||
bool UicEnabled;
|
||||
bool RccEnabled;
|
||||
std::vector<std::string> Headers;
|
||||
std::vector<std::string> Sources;
|
||||
std::vector<cmQtAutoGenDigestQrc> Qrcs;
|
||||
};
|
||||
|
||||
// Utility types
|
||||
typedef std::unique_ptr<cmQtAutoGenDigest> cmQtAutoGenDigestUP;
|
||||
typedef std::vector<cmQtAutoGenDigestUP> cmQtAutoGenDigestUPV;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -4,9 +4,12 @@
|
||||
#define cmQtAutoGeneratorInitializer_h
|
||||
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
#include "cmQtAutoGenDigest.h"
|
||||
#include "cmQtAutoGen.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class cmGeneratorTarget;
|
||||
|
||||
@ -17,8 +20,75 @@ public:
|
||||
static std::string GetQtMinorVersion(cmGeneratorTarget const* target,
|
||||
std::string const& qtVersionMajor);
|
||||
|
||||
static void InitializeAutogenTarget(cmQtAutoGenDigest& digest);
|
||||
static void SetupAutoGenerateTarget(cmQtAutoGenDigest const& digest);
|
||||
class Qrc
|
||||
{
|
||||
public:
|
||||
Qrc()
|
||||
: Generated(false)
|
||||
, Unique(false)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
std::string QrcFile;
|
||||
std::string QrcName;
|
||||
std::string PathChecksum;
|
||||
std::string InfoFile;
|
||||
std::string SettingsFile;
|
||||
std::string RccFile;
|
||||
bool Generated;
|
||||
bool Unique;
|
||||
std::vector<std::string> Options;
|
||||
std::vector<std::string> Resources;
|
||||
};
|
||||
|
||||
public:
|
||||
cmQtAutoGeneratorInitializer(cmGeneratorTarget* target, bool mocEnabled,
|
||||
bool uicEnabled, bool rccEnabled,
|
||||
std::string const& qtVersionMajor);
|
||||
|
||||
void InitCustomTargets();
|
||||
void SetupCustomTargets();
|
||||
|
||||
private:
|
||||
void SetupCustomTargetsMoc();
|
||||
void SetupCustomTargetsUic();
|
||||
|
||||
std::vector<std::string> AddGeneratedSource(std::string const& filename,
|
||||
cmQtAutoGen::Generator genType);
|
||||
|
||||
bool QtVersionGreaterOrEqual(unsigned long requestMajor,
|
||||
unsigned long requestMinor) const;
|
||||
|
||||
private:
|
||||
cmGeneratorTarget* Target;
|
||||
bool MocEnabled;
|
||||
bool UicEnabled;
|
||||
bool RccEnabled;
|
||||
std::string QtVersionMajor;
|
||||
std::string QtVersionMinor;
|
||||
// Configurations
|
||||
std::string ConfigDefault;
|
||||
std::vector<std::string> ConfigsList;
|
||||
cmQtAutoGen::MultiConfig MultiConfig;
|
||||
// Names
|
||||
std::string AutogenTargetName;
|
||||
std::string AutogenFolder;
|
||||
std::string AutogenInfoFile;
|
||||
std::string AutogenSettingsFile;
|
||||
// Directories
|
||||
std::string DirInfo;
|
||||
std::string DirBuild;
|
||||
std::string DirWork;
|
||||
// Sources
|
||||
std::vector<std::string> Headers;
|
||||
std::vector<std::string> Sources;
|
||||
std::set<std::string> MocSkip;
|
||||
std::set<std::string> UicSkip;
|
||||
std::map<std::string, std::string> ConfigMocIncludes;
|
||||
std::map<std::string, std::string> ConfigMocDefines;
|
||||
std::map<std::string, std::string> ConfigUicOptions;
|
||||
std::vector<Qrc> Qrcs;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -142,14 +142,9 @@ bool cmQtAutoGeneratorMocUic::InitInfoFile(cmMakefile* makefile)
|
||||
}
|
||||
|
||||
this->SettingsFile = InfoGetConfig("AM_SETTINGS_FILE");
|
||||
if (!this->SettingsFile.empty()) {
|
||||
if (this->MultiConfig != cmQtAutoGen::SINGLE) {
|
||||
this->SettingsFile = cmQtAutoGen::AppendFilenameSuffix(
|
||||
this->SettingsFile, this->ConfigSuffix);
|
||||
}
|
||||
} else {
|
||||
if (this->SettingsFile.empty()) {
|
||||
this->LogFileError(cmQtAutoGen::GEN, this->GetInfoFile(),
|
||||
"Settings file is missing");
|
||||
"Settings file name missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -69,12 +69,6 @@ bool cmQtAutoGeneratorRcc::InfoFileRead(cmMakefile* makefile)
|
||||
}
|
||||
|
||||
this->SettingsFile = InfoGetConfig("ARCC_SETTINGS_FILE");
|
||||
if (!this->SettingsFile.empty()) {
|
||||
if (this->MultiConfig != cmQtAutoGen::SINGLE) {
|
||||
this->SettingsFile = cmQtAutoGen::AppendFilenameSuffix(
|
||||
this->SettingsFile, this->ConfigSuffix);
|
||||
}
|
||||
}
|
||||
|
||||
// - Files and directories
|
||||
this->ProjectSourceDir = InfoGet("ARCC_CMAKE_SOURCE_DIR");
|
||||
|
Loading…
x
Reference in New Issue
Block a user