mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-02 04:02:23 +03:00
Autogen: Initializer: Group variables in structs
This commit is contained in:
1 parent
cd8b094d1d
commit
1d87c9f318
2 files changed
+189
-163
No files matched your search
+154
-140
@@ -177,7 +177,6 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer(
|
||||
cmGeneratorTarget* target, bool mocEnabled, bool uicEnabled, bool rccEnabled,
|
||||
std::string const& qtVersionMajor)
|
||||
: Target(target)
|
||||
, MultiConfig(false)
|
||||
, QtVersionMajor(qtVersionMajor)
|
||||
{
|
||||
Moc.Enabled = mocEnabled;
|
||||
@@ -194,6 +193,13 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
|
||||
cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
|
||||
|
||||
// Configurations
|
||||
this->MultiConfig = globalGen->IsMultiConfig();
|
||||
this->ConfigDefault = makefile->GetConfigurations(this->ConfigsList);
|
||||
if (this->ConfigsList.empty()) {
|
||||
this->ConfigsList.push_back(this->ConfigDefault);
|
||||
}
|
||||
|
||||
// Verbosity
|
||||
this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE");
|
||||
if (!this->Verbosity.empty()) {
|
||||
@@ -205,89 +211,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
}
|
||||
}
|
||||
|
||||
// Configurations
|
||||
this->MultiConfig = globalGen->IsMultiConfig();
|
||||
this->ConfigDefault = makefile->GetConfigurations(this->ConfigsList);
|
||||
if (this->ConfigsList.empty()) {
|
||||
this->ConfigsList.push_back(this->ConfigDefault);
|
||||
}
|
||||
|
||||
// Parallel processing
|
||||
this->Parallel = this->Target->GetSafeProperty("AUTOGEN_PARALLEL");
|
||||
if (this->Parallel.empty() || (this->Parallel == "AUTO")) {
|
||||
// Autodetect number of CPUs
|
||||
this->Parallel = std::to_string(GetParallelCPUCount());
|
||||
}
|
||||
|
||||
// Autogen target name
|
||||
this->AutogenTargetName = this->Target->GetName();
|
||||
this->AutogenTargetName += "_autogen";
|
||||
|
||||
// Autogen directories
|
||||
{
|
||||
// Collapsed current binary directory
|
||||
std::string const cbd = cmSystemTools::CollapseFullPath(
|
||||
"", makefile->GetCurrentBinaryDirectory());
|
||||
|
||||
// Autogen info dir
|
||||
this->DirInfo = cbd;
|
||||
this->DirInfo += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
|
||||
this->DirInfo += '/';
|
||||
this->DirInfo += this->AutogenTargetName;
|
||||
this->DirInfo += ".dir";
|
||||
cmSystemTools::ConvertToUnixSlashes(this->DirInfo);
|
||||
|
||||
// Autogen build dir
|
||||
this->DirBuild = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR");
|
||||
if (this->DirBuild.empty()) {
|
||||
this->DirBuild = cbd;
|
||||
this->DirBuild += '/';
|
||||
this->DirBuild += this->AutogenTargetName;
|
||||
}
|
||||
cmSystemTools::ConvertToUnixSlashes(this->DirBuild);
|
||||
// Remove build directories on cleanup
|
||||
AddCleanFile(makefile, this->DirBuild);
|
||||
|
||||
// Working directory
|
||||
this->DirWork = cbd;
|
||||
cmSystemTools::ConvertToUnixSlashes(this->DirWork);
|
||||
|
||||
// Include directory
|
||||
this->DirInclude = this->DirBuild;
|
||||
this->DirInclude += "/include";
|
||||
if (this->MultiConfig) {
|
||||
this->DirInclude += "_$<CONFIG>";
|
||||
}
|
||||
if (this->MultiConfig) {
|
||||
for (std::string const& cfg : this->ConfigsList) {
|
||||
std::string& dir = this->DirConfigInclude[cfg];
|
||||
dir = this->DirBuild;
|
||||
dir += "/include_";
|
||||
dir += cfg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Autogen info and settings files
|
||||
{
|
||||
this->AutogenInfoFile = this->DirInfo;
|
||||
this->AutogenInfoFile += "/AutogenInfo.cmake";
|
||||
|
||||
this->AutogenSettingsFile = this->DirInfo;
|
||||
this->AutogenSettingsFile += "/AutogenOldSettings.txt";
|
||||
|
||||
if (this->MultiConfig) {
|
||||
for (std::string const& cfg : this->ConfigsList) {
|
||||
std::string& filename = this->AutogenConfigSettingsFile[cfg];
|
||||
filename = AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg);
|
||||
AddCleanFile(makefile, filename);
|
||||
}
|
||||
} else {
|
||||
AddCleanFile(makefile, this->AutogenSettingsFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Autogen target FOLDER property
|
||||
// Targets FOLDER
|
||||
{
|
||||
const char* folder =
|
||||
makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
|
||||
@@ -300,20 +224,103 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
folder = this->Target->GetProperty("FOLDER");
|
||||
}
|
||||
if (folder != nullptr) {
|
||||
this->AutogenFolder = folder;
|
||||
this->TargetsFolder = folder;
|
||||
}
|
||||
}
|
||||
|
||||
// Common directories
|
||||
{
|
||||
// Collapsed current binary directory
|
||||
std::string const cbd = cmSystemTools::CollapseFullPath(
|
||||
"", makefile->GetCurrentBinaryDirectory());
|
||||
|
||||
// Info directory
|
||||
this->Dir.Info = cbd;
|
||||
this->Dir.Info += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
|
||||
this->Dir.Info += '/';
|
||||
this->Dir.Info += this->Target->GetName();
|
||||
this->Dir.Info += "_autogen";
|
||||
this->Dir.Info += ".dir";
|
||||
cmSystemTools::ConvertToUnixSlashes(this->Dir.Info);
|
||||
|
||||
// Build directory
|
||||
this->Dir.Build = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR");
|
||||
if (this->Dir.Build.empty()) {
|
||||
this->Dir.Build = cbd;
|
||||
this->Dir.Build += '/';
|
||||
this->Dir.Build += this->Target->GetName();
|
||||
this->Dir.Build += "_autogen";
|
||||
}
|
||||
cmSystemTools::ConvertToUnixSlashes(this->Dir.Build);
|
||||
// Cleanup build directory
|
||||
AddCleanFile(makefile, this->Dir.Build);
|
||||
|
||||
// Working directory
|
||||
this->Dir.Work = cbd;
|
||||
cmSystemTools::ConvertToUnixSlashes(this->Dir.Work);
|
||||
|
||||
// Include directory
|
||||
this->Dir.Include = this->Dir.Build;
|
||||
this->Dir.Include += "/include";
|
||||
if (this->MultiConfig) {
|
||||
this->Dir.Include += "_$<CONFIG>";
|
||||
}
|
||||
// Per config include directories
|
||||
if (this->MultiConfig) {
|
||||
for (std::string const& cfg : this->ConfigsList) {
|
||||
std::string& dir = this->Dir.ConfigInclude[cfg];
|
||||
dir = this->Dir.Build;
|
||||
dir += "/include_";
|
||||
dir += cfg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Moc, Uic and _autogen target settings
|
||||
if (this->Moc.Enabled || this->Uic.Enabled) {
|
||||
// Init moc specific settings
|
||||
if (this->Moc.Enabled && !InitMoc()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Init uic specific settings
|
||||
if (this->Uic.Enabled && !InitUic()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Autogen target name
|
||||
this->AutogenTarget.Name = this->Target->GetName();
|
||||
this->AutogenTarget.Name += "_autogen";
|
||||
|
||||
// Autogen target parallel processing
|
||||
this->AutogenTarget.Parallel =
|
||||
this->Target->GetSafeProperty("AUTOGEN_PARALLEL");
|
||||
if (this->AutogenTarget.Parallel.empty() ||
|
||||
(this->AutogenTarget.Parallel == "AUTO")) {
|
||||
// Autodetect number of CPUs
|
||||
this->AutogenTarget.Parallel = std::to_string(GetParallelCPUCount());
|
||||
}
|
||||
|
||||
// Autogen target info and settings files
|
||||
{
|
||||
this->AutogenTarget.InfoFile = this->Dir.Info;
|
||||
this->AutogenTarget.InfoFile += "/AutogenInfo.cmake";
|
||||
|
||||
this->AutogenTarget.SettingsFile = this->Dir.Info;
|
||||
this->AutogenTarget.SettingsFile += "/AutogenOldSettings.txt";
|
||||
|
||||
if (this->MultiConfig) {
|
||||
for (std::string const& cfg : this->ConfigsList) {
|
||||
std::string& filename = this->AutogenTarget.ConfigSettingsFile[cfg];
|
||||
filename =
|
||||
AppendFilenameSuffix(this->AutogenTarget.SettingsFile, "_" + cfg);
|
||||
AddCleanFile(makefile, filename);
|
||||
}
|
||||
} else {
|
||||
AddCleanFile(makefile, this->AutogenTarget.SettingsFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Autogen target: Compute user defined dependencies
|
||||
{
|
||||
std::string const deps =
|
||||
@@ -325,14 +332,15 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
// Allow target and file dependencies
|
||||
auto* depTarget = makefile->FindTargetToUse(depName);
|
||||
if (depTarget != nullptr) {
|
||||
this->AutogenDependTargets.insert(depTarget);
|
||||
this->AutogenTarget.DependTargets.insert(depTarget);
|
||||
} else {
|
||||
this->AutogenDependFiles.insert(depName);
|
||||
this->AutogenTarget.DependFiles.insert(depName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Init rcc specific settings
|
||||
if (this->Rcc.Enabled && !InitRcc()) {
|
||||
return false;
|
||||
@@ -341,7 +349,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
// Add autogen include directory to the origin target INCLUDE_DIRECTORIES
|
||||
if (this->Moc.Enabled || this->Uic.Enabled ||
|
||||
(this->Rcc.Enabled && this->MultiConfig)) {
|
||||
this->Target->AddIncludeDirectory(this->DirInclude, true);
|
||||
this->Target->AddIncludeDirectory(this->Dir.Include, true);
|
||||
}
|
||||
|
||||
// Scan files
|
||||
@@ -368,7 +376,7 @@ bool cmQtAutoGenInitializer::InitMoc()
|
||||
cmLocalGenerator* localGen = this->Target->GetLocalGenerator();
|
||||
|
||||
// Mocs compilation file
|
||||
this->Moc.MocsCompilation = this->DirBuild;
|
||||
this->Moc.MocsCompilation = this->Dir.Build;
|
||||
this->Moc.MocsCompilation += "/mocs_compilation.cpp";
|
||||
|
||||
// Moc predefs command
|
||||
@@ -552,15 +560,15 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
const bool generated = sf->GetPropertyAsBool("GENERATED");
|
||||
if (fileType == cmSystemTools::HEADER_FILE_FORMAT) {
|
||||
if (generated) {
|
||||
this->MocUic.HeadersGenerated.push_back(absPath);
|
||||
this->AutogenTarget.HeadersGenerated.push_back(absPath);
|
||||
} else {
|
||||
this->MocUic.Headers.push_back(absPath);
|
||||
this->AutogenTarget.Headers.push_back(absPath);
|
||||
}
|
||||
} else {
|
||||
if (generated) {
|
||||
this->MocUic.SourcesGenerated.push_back(absPath);
|
||||
this->AutogenTarget.SourcesGenerated.push_back(absPath);
|
||||
} else {
|
||||
this->MocUic.Sources.push_back(absPath);
|
||||
this->AutogenTarget.Sources.push_back(absPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -631,8 +639,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
}
|
||||
|
||||
// Process GENERATED sources and headers
|
||||
if (!this->MocUic.SourcesGenerated.empty() ||
|
||||
!this->MocUic.HeadersGenerated.empty()) {
|
||||
if (!this->AutogenTarget.SourcesGenerated.empty() ||
|
||||
!this->AutogenTarget.HeadersGenerated.empty()) {
|
||||
// Check status of policy CMP0071
|
||||
bool policyAccept = false;
|
||||
bool policyWarn = false;
|
||||
@@ -655,13 +663,15 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
|
||||
if (policyAccept) {
|
||||
// Accept GENERATED sources
|
||||
for (std::string const& absFile : this->MocUic.HeadersGenerated) {
|
||||
this->MocUic.Headers.push_back(absFile);
|
||||
this->AutogenDependFiles.insert(absFile);
|
||||
for (std::string const& absFile :
|
||||
this->AutogenTarget.HeadersGenerated) {
|
||||
this->AutogenTarget.Headers.push_back(absFile);
|
||||
this->AutogenTarget.DependFiles.insert(absFile);
|
||||
}
|
||||
for (std::string const& absFile : this->MocUic.SourcesGenerated) {
|
||||
this->MocUic.Sources.push_back(absFile);
|
||||
this->AutogenDependFiles.insert(absFile);
|
||||
for (std::string const& absFile :
|
||||
this->AutogenTarget.SourcesGenerated) {
|
||||
this->AutogenTarget.Sources.push_back(absFile);
|
||||
this->AutogenTarget.DependFiles.insert(absFile);
|
||||
}
|
||||
} else {
|
||||
if (policyWarn) {
|
||||
@@ -682,10 +692,12 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
}
|
||||
msg += "For compatibility, CMake is excluding the GENERATED source "
|
||||
"file(s):\n";
|
||||
for (const std::string& absFile : this->MocUic.HeadersGenerated) {
|
||||
for (const std::string& absFile :
|
||||
this->AutogenTarget.HeadersGenerated) {
|
||||
msg.append(" ").append(Quoted(absFile)).append("\n");
|
||||
}
|
||||
for (const std::string& absFile : this->MocUic.SourcesGenerated) {
|
||||
for (const std::string& absFile :
|
||||
this->AutogenTarget.SourcesGenerated) {
|
||||
msg.append(" ").append(Quoted(absFile)).append("\n");
|
||||
}
|
||||
msg += "from processing by ";
|
||||
@@ -704,8 +716,10 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
}
|
||||
// Sort headers and sources
|
||||
if (this->Moc.Enabled || this->Uic.Enabled) {
|
||||
std::sort(this->MocUic.Headers.begin(), this->MocUic.Headers.end());
|
||||
std::sort(this->MocUic.Sources.begin(), this->MocUic.Sources.end());
|
||||
std::sort(this->AutogenTarget.Headers.begin(),
|
||||
this->AutogenTarget.Headers.end());
|
||||
std::sort(this->AutogenTarget.Sources.begin(),
|
||||
this->AutogenTarget.Sources.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,7 +748,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile);
|
||||
// RCC output file name
|
||||
{
|
||||
std::string rccFile = this->DirBuild + "/";
|
||||
std::string rccFile = this->Dir.Build + "/";
|
||||
rccFile += qrc.PathChecksum;
|
||||
rccFile += "/qrc_";
|
||||
rccFile += qrc.QrcName;
|
||||
@@ -742,7 +756,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
||||
qrc.RccFile = std::move(rccFile);
|
||||
}
|
||||
{
|
||||
std::string base = this->DirInfo;
|
||||
std::string base = this->Dir.Info;
|
||||
base += "/RCC";
|
||||
base += qrc.QrcName;
|
||||
if (!qrc.Unique) {
|
||||
@@ -811,7 +825,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
|
||||
|
||||
// Register info file as generated by CMake
|
||||
makefile->AddCMakeOutputFile(this->AutogenInfoFile);
|
||||
makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile);
|
||||
|
||||
// Files provided by the autogen target
|
||||
std::vector<std::string> autogenProvides;
|
||||
@@ -846,7 +860,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
currentLine.push_back(cmSystemTools::GetCMakeCommand());
|
||||
currentLine.push_back("-E");
|
||||
currentLine.push_back("cmake_autogen");
|
||||
currentLine.push_back(this->AutogenInfoFile);
|
||||
currentLine.push_back(this->AutogenTarget.InfoFile);
|
||||
currentLine.push_back("$<CONFIGURATION>");
|
||||
commandLines.push_back(std::move(currentLine));
|
||||
}
|
||||
@@ -863,14 +877,14 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
// Disable PRE_BUILD in some cases
|
||||
if (usePRE_BUILD) {
|
||||
// Cannot use PRE_BUILD with file depends
|
||||
if (!this->AutogenDependFiles.empty()) {
|
||||
if (!this->AutogenTarget.DependFiles.empty()) {
|
||||
usePRE_BUILD = false;
|
||||
}
|
||||
}
|
||||
// Create the autogen target/command
|
||||
if (usePRE_BUILD) {
|
||||
// Add additional autogen target dependencies to origin target
|
||||
for (cmTarget* depTarget : this->AutogenDependTargets) {
|
||||
for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
|
||||
this->Target->Target->AddUtility(depTarget->GetName(), makefile);
|
||||
}
|
||||
|
||||
@@ -883,7 +897,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
const std::vector<std::string> no_deps;
|
||||
cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps,
|
||||
commandLines, autogenComment.c_str(),
|
||||
this->DirWork.c_str());
|
||||
this->Dir.Work.c_str());
|
||||
cc.SetEscapeOldStyle(false);
|
||||
cc.SetEscapeAllowMakeVars(true);
|
||||
this->Target->Target->AddPreBuildCommand(cc);
|
||||
@@ -911,17 +925,17 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
}
|
||||
for (auto const& item : commonTargets) {
|
||||
if (item.second == this->ConfigsList.size()) {
|
||||
this->AutogenDependTargets.insert(item.first->Target);
|
||||
this->AutogenTarget.DependTargets.insert(item.first->Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create autogen target
|
||||
cmTarget* autogenTarget = makefile->AddUtilityCommand(
|
||||
this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true,
|
||||
this->DirWork.c_str(), /*byproducts=*/autogenProvides,
|
||||
std::vector<std::string>(this->AutogenDependFiles.begin(),
|
||||
this->AutogenDependFiles.end()),
|
||||
this->AutogenTarget.Name, cmMakefile::TargetOrigin::Generator, true,
|
||||
this->Dir.Work.c_str(), /*byproducts=*/autogenProvides,
|
||||
std::vector<std::string>(this->AutogenTarget.DependFiles.begin(),
|
||||
this->AutogenTarget.DependFiles.end()),
|
||||
commandLines, false, autogenComment.c_str());
|
||||
// Create autogen generator target
|
||||
localGen->AddGeneratorTarget(
|
||||
@@ -932,17 +946,17 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
autogenTarget->AddUtility(depName, makefile);
|
||||
}
|
||||
// Add additional autogen target dependencies to autogen target
|
||||
for (cmTarget* depTarget : this->AutogenDependTargets) {
|
||||
for (cmTarget* depTarget : this->AutogenTarget.DependTargets) {
|
||||
autogenTarget->AddUtility(depTarget->GetName(), makefile);
|
||||
}
|
||||
|
||||
// Set FOLDER property in autogen target
|
||||
if (!this->AutogenFolder.empty()) {
|
||||
autogenTarget->SetProperty("FOLDER", this->AutogenFolder.c_str());
|
||||
if (!this->TargetsFolder.empty()) {
|
||||
autogenTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
|
||||
}
|
||||
|
||||
// Add autogen target to the origin target dependencies
|
||||
this->Target->Target->AddUtility(this->AutogenTargetName, makefile);
|
||||
this->Target->Target->AddUtility(this->AutogenTarget.Name, makefile);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1004,15 +1018,15 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
||||
|
||||
cmTarget* autoRccTarget = makefile->AddUtilityCommand(
|
||||
ccName, cmMakefile::TargetOrigin::Generator, true,
|
||||
this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false,
|
||||
this->Dir.Work.c_str(), ccOutput, ccDepends, commandLines, false,
|
||||
ccComment.c_str());
|
||||
// Create autogen generator target
|
||||
localGen->AddGeneratorTarget(
|
||||
new cmGeneratorTarget(autoRccTarget, localGen));
|
||||
|
||||
// Set FOLDER property in autogen target
|
||||
if (!this->AutogenFolder.empty()) {
|
||||
autoRccTarget->SetProperty("FOLDER", this->AutogenFolder.c_str());
|
||||
if (!this->TargetsFolder.empty()) {
|
||||
autoRccTarget->SetProperty("FOLDER", this->TargetsFolder.c_str());
|
||||
}
|
||||
}
|
||||
// Add autogen target to the origin target dependencies
|
||||
@@ -1034,7 +1048,7 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
||||
makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends,
|
||||
/*main_dependency*/ std::string(),
|
||||
commandLines, ccComment.c_str(),
|
||||
this->DirWork.c_str());
|
||||
this->Dir.Work.c_str());
|
||||
}
|
||||
// Reconfigure when .qrc file changes
|
||||
makefile->AddCMakeDependFile(qrc.QrcFile);
|
||||
@@ -1047,9 +1061,9 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
||||
bool cmQtAutoGenInitializer::SetupCustomTargets()
|
||||
{
|
||||
// Create info directory on demand
|
||||
if (!cmSystemTools::MakeDirectory(this->DirInfo)) {
|
||||
if (!cmSystemTools::MakeDirectory(this->Dir.Info)) {
|
||||
std::string emsg = ("AutoGen: Could not create directory: ");
|
||||
emsg += Quoted(this->DirInfo);
|
||||
emsg += Quoted(this->Dir.Info);
|
||||
cmSystemTools::Error(emsg.c_str());
|
||||
return false;
|
||||
}
|
||||
@@ -1076,7 +1090,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
|
||||
cmGeneratedFileStream ofs;
|
||||
ofs.SetCopyIfDifferent(true);
|
||||
ofs.Open(this->AutogenInfoFile, false, true);
|
||||
ofs.Open(this->AutogenTarget.InfoFile, false, true);
|
||||
if (ofs) {
|
||||
// Utility lambdas
|
||||
auto CWrite = [&ofs](const char* key, std::string const& value) {
|
||||
@@ -1117,7 +1131,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
// Write
|
||||
ofs << "# Meta\n";
|
||||
CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE");
|
||||
CWrite("AM_PARALLEL", this->Parallel);
|
||||
CWrite("AM_PARALLEL", this->AutogenTarget.Parallel);
|
||||
CWrite("AM_VERBOSITY", this->Verbosity);
|
||||
|
||||
ofs << "# Directories\n";
|
||||
@@ -1127,15 +1141,15 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR"));
|
||||
CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE",
|
||||
MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"));
|
||||
CWrite("AM_BUILD_DIR", this->DirBuild);
|
||||
CWrite("AM_INCLUDE_DIR", this->DirInclude);
|
||||
CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude);
|
||||
CWrite("AM_BUILD_DIR", this->Dir.Build);
|
||||
CWrite("AM_INCLUDE_DIR", this->Dir.Include);
|
||||
CWriteMap("AM_INCLUDE_DIR", this->Dir.ConfigInclude);
|
||||
|
||||
ofs << "# Files\n";
|
||||
CWriteList("AM_SOURCES", this->MocUic.Sources);
|
||||
CWriteList("AM_HEADERS", this->MocUic.Headers);
|
||||
CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile);
|
||||
CWriteMap("AM_SETTINGS_FILE", this->AutogenConfigSettingsFile);
|
||||
CWriteList("AM_SOURCES", this->AutogenTarget.Sources);
|
||||
CWriteList("AM_HEADERS", this->AutogenTarget.Headers);
|
||||
CWrite("AM_SETTINGS_FILE", this->AutogenTarget.SettingsFile);
|
||||
CWriteMap("AM_SETTINGS_FILE", this->AutogenTarget.ConfigSettingsFile);
|
||||
|
||||
ofs << "# Qt\n";
|
||||
CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor);
|
||||
@@ -1170,7 +1184,7 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
}
|
||||
} else {
|
||||
std::string err = "AutoGen: Could not write file ";
|
||||
err += this->AutogenInfoFile;
|
||||
err += this->AutogenTarget.InfoFile;
|
||||
cmSystemTools::Error(err.c_str());
|
||||
return false;
|
||||
}
|
||||
@@ -1207,9 +1221,9 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
|
||||
CWriteMap("ARCC_SETTINGS_FILE", qrc.ConfigSettingsFile);
|
||||
|
||||
ofs << "# Directories\n";
|
||||
CWrite("ARCC_BUILD_DIR", this->DirBuild);
|
||||
CWrite("ARCC_INCLUDE_DIR", this->DirInclude);
|
||||
CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude);
|
||||
CWrite("ARCC_BUILD_DIR", this->Dir.Build);
|
||||
CWrite("ARCC_INCLUDE_DIR", this->Dir.Include);
|
||||
CWriteMap("ARCC_INCLUDE_DIR", this->Dir.ConfigInclude);
|
||||
|
||||
ofs << "# Rcc executable\n";
|
||||
CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable);
|
||||
|
||||
@@ -82,39 +82,49 @@ private:
|
||||
|
||||
private:
|
||||
cmGeneratorTarget* Target;
|
||||
bool MultiConfig = false;
|
||||
|
||||
// Qt
|
||||
std::string QtVersionMajor;
|
||||
std::string QtVersionMinor;
|
||||
// Configurations
|
||||
|
||||
// Configuration
|
||||
bool MultiConfig = false;
|
||||
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
|
||||
{
|
||||
// Sources
|
||||
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
|
||||
{
|
||||
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 +137,8 @@ private:
|
||||
std::map<std::string, std::string> ConfigDefines;
|
||||
std::string MocsCompilation;
|
||||
} Moc;
|
||||
// Uic
|
||||
|
||||
///@brief Uic only variables
|
||||
struct
|
||||
{
|
||||
bool Enabled = false;
|
||||
@@ -139,7 +150,8 @@ private:
|
||||
std::vector<std::string> FileFiles;
|
||||
std::vector<std::vector<std::string>> FileOptions;
|
||||
} Uic;
|
||||
// Rcc
|
||||
|
||||
/// @brief Rcc only variables
|
||||
struct
|
||||
{
|
||||
bool Enabled = false;
|
||||
|
||||
Reference in new issue
Block a user