Commit b2798594 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'autogen_variables_in_structs'

3aa11f31 Autogen: Use integers to store the Qt version
1d87c9f3

 Autogen: Initializer: Group variables in structs
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2286
parents 91c9a522 3aa11f31
Pipeline #114190 passed with stage
in 0 seconds
......@@ -34,6 +34,7 @@
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmQtAutoGen.h"
#include "cmQtAutoGenInitializer.h"
#include "cmSourceFile.h"
#include "cmState.h"
......@@ -1495,15 +1496,14 @@ bool cmGlobalGenerator::QtAutoGen()
continue;
}
std::string qtVersionMajor =
cmQtAutoGenInitializer::GetQtMajorVersion(target);
auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
// don't do anything if there is no Qt4 or Qt5Core (which contains moc)
if (qtVersionMajor != "4" && qtVersionMajor != "5") {
if (qtVersion.Major != 4 && qtVersion.Major != 5) {
continue;
}
autogenInits.emplace_back(cm::make_unique<cmQtAutoGenInitializer>(
target, mocEnabled, uicEnabled, rccEnabled, qtVersionMajor));
target, mocEnabled, uicEnabled, rccEnabled, qtVersion));
}
}
......
......@@ -28,6 +28,32 @@ public:
RCC
};
/// @brief Integer version
struct IntegerVersion
{
unsigned int Major = 0;
unsigned int Minor = 0;
IntegerVersion() = default;
IntegerVersion(unsigned int major, unsigned int minor)
: Major(major)
, Minor(minor)
{
}
bool operator>(IntegerVersion const version)
{
return (this->Major > version.Major) ||
((this->Major == version.Major) && (this->Minor > version.Minor));
}
bool operator>=(IntegerVersion const version)
{
return (this->Major > version.Major) ||
((this->Major == version.Major) && (this->Minor >= version.Minor));
}
};
public:
/// @brief Returns the generator name
static std::string const& GeneratorName(GeneratorT genType);
......
This diff is collapsed.
......@@ -18,10 +18,6 @@ class cmTarget;
class cmQtAutoGenInitializer : public cmQtAutoGen
{
public:
static std::string GetQtMajorVersion(cmGeneratorTarget const* target);
static std::string GetQtMinorVersion(cmGeneratorTarget const* target,
std::string const& qtVersionMajor);
/// @brief Rcc job information
class Qrc
{
......@@ -48,9 +44,11 @@ public:
};
public:
static IntegerVersion GetQtVersion(cmGeneratorTarget const* target);
cmQtAutoGenInitializer(cmGeneratorTarget* target, bool mocEnabled,
bool uicEnabled, bool rccEnabled,
std::string const& qtVersionMajor);
IntegerVersion const& qtVersion);
bool InitCustomTargets();
bool SetupCustomTargets();
......@@ -69,9 +67,6 @@ private:
void AddGeneratedSource(std::string const& filename, GeneratorT genType);
bool QtVersionGreaterOrEqual(unsigned long requestMajor,
unsigned long requestMinor) const;
bool GetMocExecutable();
bool GetUicExecutable();
bool GetRccExecutable();
......@@ -82,39 +77,46 @@ private:
private:
cmGeneratorTarget* Target;
// Configuration
IntegerVersion QtVersion;
bool MultiConfig = false;
// Qt
std::string QtVersionMajor;
std::string QtVersionMinor;
// Configurations
std::string ConfigDefault;
std::vector<std::string> ConfigsList;
std::string Parallel;
std::string Verbosity;
// Names
std::string AutogenTargetName;
std::string AutogenFolder;
std::string AutogenInfoFile;
std::string AutogenSettingsFile;
std::map<std::string, std::string> AutogenConfigSettingsFile;
std::set<std::string> AutogenDependFiles;
std::set<cmTarget*> AutogenDependTargets;
// Directories
std::string DirInfo;
std::string DirBuild;
std::string DirWork;
std::string DirInclude;
std::map<std::string, std::string> DirConfigInclude;
// Moc and UIC
std::string TargetsFolder;
/// @brief Common directories
struct
{
std::string Info;
std::string Build;
std::string Work;
std::string Include;
std::map<std::string, std::string> ConfigInclude;
} Dir;
/// @brief Autogen target variables
struct
{
// Sources
std::string Name;
// Settings
std::string Parallel;
// Configuration files
std::string InfoFile;
std::string SettingsFile;
std::map<std::string, std::string> ConfigSettingsFile;
// Dependencies
std::set<std::string> DependFiles;
std::set<cmTarget*> DependTargets;
// Sources to process
std::vector<std::string> Headers;
std::vector<std::string> Sources;
std::vector<std::string> HeadersGenerated;
std::vector<std::string> SourcesGenerated;
} MocUic;
// Moc
} AutogenTarget;
/// @brief Moc only variables
struct
{
bool Enabled = false;
......@@ -127,7 +129,8 @@ private:
std::map<std::string, std::string> ConfigDefines;
std::string MocsCompilation;
} Moc;
// Uic
///@brief Uic only variables
struct
{
bool Enabled = false;
......@@ -139,7 +142,8 @@ private:
std::vector<std::string> FileFiles;
std::vector<std::vector<std::string>> FileOptions;
} Uic;
// Rcc
/// @brief Rcc only variables
struct
{
bool Enabled = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment