|
@@ -2,6 +2,7 @@
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
|
#include "cmQtAutoGenInitializer.h"
|
|
|
|
|
|
+#include <array>
|
|
|
#include <cstddef>
|
|
|
#include <deque>
|
|
|
#include <initializer_list>
|
|
@@ -17,6 +18,7 @@
|
|
|
#include <cm/algorithm>
|
|
|
#include <cm/iterator>
|
|
|
#include <cm/memory>
|
|
|
+#include <cm/string_view>
|
|
|
#include <cmext/algorithm>
|
|
|
#include <cmext/string_view>
|
|
|
|
|
@@ -301,15 +303,22 @@ bool InfoWriter::Save(std::string const& filename)
|
|
|
return fileStream.Close();
|
|
|
}
|
|
|
|
|
|
-void AddAutogenExecutableToDependencies(
|
|
|
- cmQtAutoGenInitializer::GenVarsT const& genVars,
|
|
|
- std::vector<std::string>& dependencies)
|
|
|
+cmQtAutoGen::ConfigStrings<std::vector<std::string>> generateListOptions(
|
|
|
+ cmQtAutoGen::ConfigStrings<cmQtAutoGen::CompilerFeaturesHandle> const&
|
|
|
+ executableFeatures,
|
|
|
+ bool IsMultiConfig)
|
|
|
{
|
|
|
- if (genVars.ExecutableTarget != nullptr) {
|
|
|
- dependencies.push_back(genVars.ExecutableTarget->Target->GetName());
|
|
|
- } else if (!genVars.Executable.empty()) {
|
|
|
- dependencies.push_back(genVars.Executable);
|
|
|
+ cmQtAutoGen::ConfigStrings<std::vector<std::string>> tempListOptions;
|
|
|
+ if (IsMultiConfig) {
|
|
|
+ for (auto const& executableFeature : executableFeatures.Config) {
|
|
|
+ tempListOptions.Config[executableFeature.first] =
|
|
|
+ executableFeature.second->ListOptions;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tempListOptions.Default = executableFeatures.Default->ListOptions;
|
|
|
}
|
|
|
+
|
|
|
+ return tempListOptions;
|
|
|
}
|
|
|
|
|
|
} // End of unnamed namespace
|
|
@@ -334,6 +343,42 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer(
|
|
|
this->Rcc.GlobalTarget = globalAutoRccTarget;
|
|
|
this->CrossConfig =
|
|
|
!this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty();
|
|
|
+ this->UseBetterGraph =
|
|
|
+ this->GenTarget->GetProperty("AUTOGEN_BETTER_GRAPH_MULTI_CONFIG").IsSet()
|
|
|
+ ? this->GenTarget->GetProperty("AUTOGEN_BETTER_GRAPH_MULTI_CONFIG").IsOn()
|
|
|
+ : (this->QtVersion >= IntegerVersion(6, 8));
|
|
|
+ // AUTOGEN_BETTER_GRAPH_MULTI_CONFIG is set explicitly because it is read by
|
|
|
+ // the qt library
|
|
|
+ this->GenTarget->Target->SetProperty("AUTOGEN_BETTER_GRAPH_MULTI_CONFIG",
|
|
|
+ this->UseBetterGraph ? "ON" : "OFF");
|
|
|
+}
|
|
|
+
|
|
|
+void cmQtAutoGenInitializer::AddAutogenExecutableToDependencies(
|
|
|
+ cmQtAutoGenInitializer::GenVarsT const& genVars,
|
|
|
+ std::vector<std::string>& dependencies) const
|
|
|
+{
|
|
|
+ if (genVars.ExecutableTarget != nullptr) {
|
|
|
+ dependencies.push_back(genVars.ExecutableTarget->Target->GetName());
|
|
|
+ } else if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ cm::string_view const& configGenexWithCommandConfig =
|
|
|
+ "$<COMMAND_CONFIG:$<$<CONFIG:";
|
|
|
+ cm::string_view const& configGenex = "$<$<CONFIG:";
|
|
|
+ cm::string_view const& configGenexEnd = ">";
|
|
|
+ cm::string_view const& configGenexEndWithCommandConfig = ">>";
|
|
|
+ auto genexBegin =
|
|
|
+ this->CrossConfig ? configGenexWithCommandConfig : configGenex;
|
|
|
+ auto genexEnd =
|
|
|
+ this->CrossConfig ? configGenexEndWithCommandConfig : configGenexEnd;
|
|
|
+ for (auto const& config : genVars.Executable.Config) {
|
|
|
+ auto executableWithConfig =
|
|
|
+ cmStrCat(genexBegin, config.first, ">:", config.second, genexEnd);
|
|
|
+ dependencies.emplace_back(std::move(executableWithConfig));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!genVars.Executable.Default.empty()) {
|
|
|
+ dependencies.push_back(genVars.Executable.Default);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
bool cmQtAutoGenInitializer::InitCustomTargets()
|
|
@@ -811,18 +856,30 @@ bool cmQtAutoGenInitializer::InitRcc()
|
|
|
return false;
|
|
|
}
|
|
|
// Evaluate test output on demand
|
|
|
- CompilerFeatures& features = *this->Rcc.ExecutableFeatures;
|
|
|
- if (!features.Evaluated) {
|
|
|
- // Look for list options
|
|
|
- if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) {
|
|
|
- if (features.HelpOutput.find("--list") != std::string::npos) {
|
|
|
- features.ListOptions.emplace_back("--list");
|
|
|
- } else if (features.HelpOutput.find("-list") != std::string::npos) {
|
|
|
- features.ListOptions.emplace_back("-list");
|
|
|
+ auto& features = this->Rcc.ExecutableFeatures;
|
|
|
+ auto checkAndAddOptions = [this](CompilerFeaturesHandle& feature) {
|
|
|
+ if (!feature->Evaluated) {
|
|
|
+ // Look for list options
|
|
|
+ if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) {
|
|
|
+ static std::array<std::string, 2> const listOptions{ { "--list",
|
|
|
+ "-list" } };
|
|
|
+ for (std::string const& opt : listOptions) {
|
|
|
+ if (feature->HelpOutput.find(opt) != std::string::npos) {
|
|
|
+ feature->ListOptions.emplace_back(opt);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ // Evaluation finished
|
|
|
+ feature->Evaluated = true;
|
|
|
}
|
|
|
- // Evaluation finished
|
|
|
- features.Evaluated = true;
|
|
|
+ };
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ checkAndAddOptions(features.Config[config]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ checkAndAddOptions(features.Default);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1158,8 +1215,14 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
|
|
// Path checksum
|
|
|
qrc.QrcPathChecksum = this->PathCheckSum.getPart(qrc.QrcFile);
|
|
|
// Output file name
|
|
|
- qrc.OutputFile = cmStrCat(this->Dir.Build, '/', qrc.QrcPathChecksum,
|
|
|
- "/qrc_", qrc.QrcName, ".cpp");
|
|
|
+ if (this->MultiConfig && !this->GlobalGen->IsXcode() &&
|
|
|
+ this->UseBetterGraph) {
|
|
|
+ qrc.OutputFile = cmStrCat(this->Dir.Build, '/', qrc.QrcPathChecksum,
|
|
|
+ "_$<CONFIG>", "/qrc_", qrc.QrcName, ".cpp");
|
|
|
+ } else {
|
|
|
+ qrc.OutputFile = cmStrCat(this->Dir.Build, '/', qrc.QrcPathChecksum,
|
|
|
+ "/qrc_", qrc.QrcName, ".cpp");
|
|
|
+ }
|
|
|
std::string const base = cmStrCat(this->Dir.Info, "/AutoRcc_",
|
|
|
qrc.QrcName, '_', qrc.QrcPathChecksum);
|
|
|
qrc.LockFile = cmStrCat(base, "_Lock.lock");
|
|
@@ -1191,11 +1254,25 @@ bool cmQtAutoGenInitializer::InitScanFiles()
|
|
|
for (Qrc& qrc : this->Rcc.Qrcs) {
|
|
|
if (!qrc.Generated) {
|
|
|
std::string error;
|
|
|
- RccLister const lister(this->Rcc.Executable,
|
|
|
- this->Rcc.ExecutableFeatures->ListOptions);
|
|
|
- if (!lister.list(qrc.QrcFile, qrc.Resources, error)) {
|
|
|
- cmSystemTools::Error(error);
|
|
|
- return false;
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ RccLister const lister(
|
|
|
+ this->Rcc.Executable.Config[config],
|
|
|
+ this->Rcc.ExecutableFeatures.Config[config]->ListOptions);
|
|
|
+ if (!lister.list(qrc.QrcFile, qrc.Resources.Config[config],
|
|
|
+ error)) {
|
|
|
+ cmSystemTools::Error(error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ RccLister const lister(
|
|
|
+ this->Rcc.Executable.Default,
|
|
|
+ this->Rcc.ExecutableFeatures.Default->ListOptions);
|
|
|
+ if (!lister.list(qrc.QrcFile, qrc.Resources.Default, error)) {
|
|
|
+ cmSystemTools::Error(error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1223,8 +1300,9 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
|
|
if (this->Moc.Enabled) {
|
|
|
this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true);
|
|
|
if (useDepfile) {
|
|
|
- if (this->MultiConfig && this->CrossConfig &&
|
|
|
- this->GlobalGen->GetName().find("Ninja") != std::string::npos) {
|
|
|
+ if (this->CrossConfig &&
|
|
|
+ this->GlobalGen->GetName().find("Ninja") != std::string::npos &&
|
|
|
+ !this->UseBetterGraph) {
|
|
|
// Make all mocs_compilation_<CONFIG>.cpp files byproducts of the
|
|
|
// ${target}_autogen/timestamp custom command.
|
|
|
// We cannot just use Moc.CompilationFileGenex here, because that
|
|
@@ -1267,28 +1345,11 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
|
|
// Compose command lines
|
|
|
// FIXME: Take advantage of our per-config mocs_compilation_$<CONFIG>.cpp
|
|
|
// instead of fiddling with the include directories
|
|
|
- std::vector<std::string> configs;
|
|
|
- this->GlobalGen->GetQtAutoGenConfigs(configs);
|
|
|
+
|
|
|
bool constexpr stdPipesUTF8 = true;
|
|
|
cmCustomCommandLines commandLines;
|
|
|
- if (!this->CrossConfig) {
|
|
|
- std::string autogenInfoFileConfig;
|
|
|
- if (this->MultiConfig) {
|
|
|
- autogenInfoFileConfig = "$<CONFIG>";
|
|
|
- } else {
|
|
|
- autogenInfoFileConfig = configs[0];
|
|
|
- }
|
|
|
- commandLines.push_back(cmMakeCommandLine(
|
|
|
- { cmSystemTools::GetCMakeCommand(), "-E", "cmake_autogen",
|
|
|
- this->AutogenTarget.InfoFile, autogenInfoFileConfig }));
|
|
|
-
|
|
|
- } else {
|
|
|
- for (auto const& config : configs) {
|
|
|
- commandLines.push_back(cmMakeCommandLine(
|
|
|
- { cmSystemTools::GetCMakeCommand(), "-E", "cmake_autogen",
|
|
|
- this->AutogenTarget.InfoFile, config }));
|
|
|
- }
|
|
|
- }
|
|
|
+ AddCMakeProcessToCommandLines(this->AutogenTarget.InfoFile, "cmake_autogen",
|
|
|
+ commandLines);
|
|
|
|
|
|
// Use PRE_BUILD on demand
|
|
|
bool usePRE_BUILD = false;
|
|
@@ -1456,18 +1517,47 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
|
|
|
|
|
AddAutogenExecutableToDependencies(this->Moc, dependencies);
|
|
|
AddAutogenExecutableToDependencies(this->Uic, dependencies);
|
|
|
-
|
|
|
+ std::string outputFile;
|
|
|
+ std::string depFile;
|
|
|
// Create the custom command that outputs the timestamp file.
|
|
|
- const char timestampFileName[] = "timestamp";
|
|
|
- const std::string outputFile =
|
|
|
- cmStrCat(this->Dir.Build, "/", timestampFileName);
|
|
|
- this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps");
|
|
|
- this->AutogenTarget.DepFileRuleName =
|
|
|
- cmStrCat(this->Dir.RelativeBuild, "/", timestampFileName);
|
|
|
- commandLines.push_back(cmMakeCommandLine(
|
|
|
- { cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile }));
|
|
|
-
|
|
|
- this->AddGeneratedSource(outputFile, this->Moc);
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ // create timestamp file with $<CONFIG> in the name so that
|
|
|
+ // every cmake_autogen target has its own timestamp file
|
|
|
+ std::string const configView = "$<CONFIG>";
|
|
|
+ std::string const timestampFileWithoutConfig = "timestamp_";
|
|
|
+ std::string const depFileWithoutConfig =
|
|
|
+ cmStrCat(this->Dir.Build, "/deps_");
|
|
|
+ std::string const timestampFileName =
|
|
|
+ timestampFileWithoutConfig + configView;
|
|
|
+ outputFile = cmStrCat(this->Dir.Build, "/", timestampFileName);
|
|
|
+ auto const depFileWithConfig =
|
|
|
+ cmStrCat(depFileWithoutConfig, configView);
|
|
|
+ depFile = depFileWithConfig;
|
|
|
+ commandLines.push_back(cmMakeCommandLine(
|
|
|
+ { cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile }));
|
|
|
+
|
|
|
+ ConfigString outputFileWithConfig;
|
|
|
+ for (std::string const& config : this->ConfigsList) {
|
|
|
+ auto tempTimestampFileName = timestampFileWithoutConfig + config;
|
|
|
+ auto tempDepFile = depFileWithoutConfig + config;
|
|
|
+ outputFileWithConfig.Config[config] = tempTimestampFileName;
|
|
|
+ this->AutogenTarget.DepFileRuleName.Config[config] =
|
|
|
+ cmStrCat(this->Dir.RelativeBuild, "/", tempTimestampFileName);
|
|
|
+ this->AutogenTarget.DepFile.Config[config] = tempDepFile;
|
|
|
+ }
|
|
|
+ this->AddGeneratedSource(outputFileWithConfig, this->Moc);
|
|
|
+ } else {
|
|
|
+ cm::string_view const timestampFileName = "timestamp";
|
|
|
+ outputFile = cmStrCat(this->Dir.Build, "/", timestampFileName);
|
|
|
+ this->AutogenTarget.DepFile.Default =
|
|
|
+ cmStrCat(this->Dir.Build, "/deps");
|
|
|
+ depFile = this->AutogenTarget.DepFile.Default;
|
|
|
+ this->AutogenTarget.DepFileRuleName.Default =
|
|
|
+ cmStrCat(this->Dir.RelativeBuild, "/", timestampFileName);
|
|
|
+ commandLines.push_back(cmMakeCommandLine(
|
|
|
+ { cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile }));
|
|
|
+ this->AddGeneratedSource(outputFile, this->Moc);
|
|
|
+ }
|
|
|
cc = cm::make_unique<cmCustomCommand>();
|
|
|
cc->SetOutputs(outputFile);
|
|
|
cc->SetByproducts(timestampByproducts);
|
|
@@ -1476,14 +1566,11 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
|
|
cc->SetComment(autogenComment.c_str());
|
|
|
cc->SetWorkingDirectory(this->Dir.Work.c_str());
|
|
|
cc->SetEscapeOldStyle(false);
|
|
|
- cc->SetDepfile(this->AutogenTarget.DepFile);
|
|
|
+ cc->SetDepfile(depFile);
|
|
|
cc->SetStdPipesUTF8(stdPipesUTF8);
|
|
|
this->LocalGen->AddCustomCommandToOutput(std::move(cc));
|
|
|
-
|
|
|
- // Alter variables for the autogen target which now merely wraps the
|
|
|
- // custom command
|
|
|
dependencies.clear();
|
|
|
- dependencies.emplace_back(outputFile);
|
|
|
+ dependencies.emplace_back(std::move(outputFile));
|
|
|
commandLines.clear();
|
|
|
autogenComment.clear();
|
|
|
}
|
|
@@ -1535,6 +1622,36 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+void cmQtAutoGenInitializer::AddCMakeProcessToCommandLines(
|
|
|
+ std::string const& infoFile, std::string const& processName,
|
|
|
+ cmCustomCommandLines& commandLines)
|
|
|
+{
|
|
|
+ if (this->CrossConfig && this->UseBetterGraph) {
|
|
|
+ commandLines.push_back(cmMakeCommandLine(
|
|
|
+ { cmSystemTools::GetCMakeCommand(), "-E", processName, infoFile,
|
|
|
+ "$<CONFIG>", "$<COMMAND_CONFIG:$<CONFIG>>" }));
|
|
|
+ } else if ((this->MultiConfig && this->GlobalGen->IsXcode()) ||
|
|
|
+ this->CrossConfig) {
|
|
|
+ for (std::string const& config : this->ConfigsList) {
|
|
|
+ commandLines.push_back(
|
|
|
+ cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
|
|
|
+ processName, infoFile, config }));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ std::string autoInfoFileConfig;
|
|
|
+ if (this->MultiConfig) {
|
|
|
+ autoInfoFileConfig = "$<CONFIG>";
|
|
|
+ } else {
|
|
|
+ std::vector<std::string> configs;
|
|
|
+ this->GlobalGen->GetQtAutoGenConfigs(configs);
|
|
|
+ autoInfoFileConfig = configs[0];
|
|
|
+ }
|
|
|
+ commandLines.push_back(
|
|
|
+ cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E", processName,
|
|
|
+ infoFile, autoInfoFileConfig }));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
{
|
|
|
for (Qrc const& qrc : this->Rcc.Qrcs) {
|
|
@@ -1555,18 +1672,7 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
ccDepends.push_back(qrc.InfoFile);
|
|
|
|
|
|
cmCustomCommandLines commandLines;
|
|
|
- if (this->MultiConfig) {
|
|
|
- // Build for all configurations
|
|
|
- for (std::string const& config : this->ConfigsList) {
|
|
|
- commandLines.push_back(
|
|
|
- cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
|
|
|
- "cmake_autorcc", qrc.InfoFile, config }));
|
|
|
- }
|
|
|
- } else {
|
|
|
- commandLines.push_back(
|
|
|
- cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
|
|
|
- "cmake_autorcc", qrc.InfoFile, "$<CONFIG>" }));
|
|
|
- }
|
|
|
+ AddCMakeProcessToCommandLines(qrc.InfoFile, "cmake_autorcc", commandLines);
|
|
|
|
|
|
std::string const ccComment =
|
|
|
cmStrCat("Automatic RCC for ",
|
|
@@ -1617,13 +1723,28 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
|
|
// Create custom rcc command
|
|
|
{
|
|
|
// Add the resource files to the dependencies
|
|
|
- for (std::string const& fileName : qrc.Resources) {
|
|
|
- // Add resource file to the custom command dependencies
|
|
|
- ccDepends.push_back(fileName);
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ // Add resource file to the custom command dependencies
|
|
|
+ auto resourceFilesWithConfig = cmStrCat(
|
|
|
+ "$<$<CONFIG:", config,
|
|
|
+ ">:", cmList{ qrc.Resources.Config.at(config) }.to_string(),
|
|
|
+ ">");
|
|
|
+ ccDepends.emplace_back(std::move(resourceFilesWithConfig));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (std::string const& fileName : qrc.Resources.Default) {
|
|
|
+ // Add resource file to the custom command dependencies
|
|
|
+ ccDepends.push_back(fileName);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if (!this->Rcc.ExecutableTargetName.empty()) {
|
|
|
ccDepends.push_back(this->Rcc.ExecutableTargetName);
|
|
|
}
|
|
|
+
|
|
|
+ AddAutogenExecutableToDependencies(this->Rcc, ccDepends);
|
|
|
+
|
|
|
cc->SetOutputs(ccOutput);
|
|
|
cc->SetDepends(ccDepends);
|
|
|
this->LocalGen->AddCustomCommandToOutput(std::move(cc));
|
|
@@ -1723,6 +1844,8 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
|
|
|
|
|
// General
|
|
|
info.SetBool("MULTI_CONFIG", this->MultiConfig);
|
|
|
+ info.SetBool("CROSS_CONFIG", this->CrossConfig);
|
|
|
+ info.SetBool("USE_BETTER_GRAPH", this->UseBetterGraph);
|
|
|
info.SetUInt("PARALLEL", this->AutogenTarget.Parallel);
|
|
|
#ifdef _WIN32
|
|
|
info.SetUInt("AUTOGEN_COMMAND_LINE_LENGTH_MAX",
|
|
@@ -1740,14 +1863,14 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
|
|
|
|
|
info.SetUInt("QT_VERSION_MAJOR", this->QtVersion.Major);
|
|
|
info.SetUInt("QT_VERSION_MINOR", this->QtVersion.Minor);
|
|
|
- info.Set("QT_MOC_EXECUTABLE", this->Moc.Executable);
|
|
|
- info.Set("QT_UIC_EXECUTABLE", this->Uic.Executable);
|
|
|
+ info.SetConfig("QT_MOC_EXECUTABLE", this->Moc.Executable);
|
|
|
+ info.SetConfig("QT_UIC_EXECUTABLE", this->Uic.Executable);
|
|
|
|
|
|
info.Set("CMAKE_EXECUTABLE", cmSystemTools::GetCMakeCommand());
|
|
|
info.SetConfig("SETTINGS_FILE", this->AutogenTarget.SettingsFile);
|
|
|
info.SetConfig("PARSE_CACHE_FILE", this->AutogenTarget.ParseCacheFile);
|
|
|
- info.Set("DEP_FILE", this->AutogenTarget.DepFile);
|
|
|
- info.Set("DEP_FILE_RULE_NAME", this->AutogenTarget.DepFileRuleName);
|
|
|
+ info.SetConfig("DEP_FILE", this->AutogenTarget.DepFile);
|
|
|
+ info.SetConfig("DEP_FILE_RULE_NAME", this->AutogenTarget.DepFileRuleName);
|
|
|
info.SetArray("CMAKE_LIST_FILES", this->Makefile->GetListFiles());
|
|
|
info.SetArray("HEADER_EXTENSIONS",
|
|
|
this->Makefile->GetCMakeInstance()->GetHeaderExtensions());
|
|
@@ -1874,6 +1997,8 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
|
|
|
|
|
|
// General
|
|
|
info.SetBool("MULTI_CONFIG", this->MultiConfig);
|
|
|
+ info.SetBool("CROSS_CONFIG", this->CrossConfig);
|
|
|
+ info.SetBool("USE_BETTER_GRAPH", this->UseBetterGraph);
|
|
|
info.SetUInt("VERBOSITY", this->Verbosity);
|
|
|
info.Set("GENERATOR", this->GlobalGen->GetName());
|
|
|
|
|
@@ -1890,16 +2015,17 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
|
|
|
info.SetConfig("INCLUDE_DIR", this->Dir.Include);
|
|
|
|
|
|
// rcc executable
|
|
|
- info.Set("RCC_EXECUTABLE", this->Rcc.Executable);
|
|
|
- info.SetArray("RCC_LIST_OPTIONS",
|
|
|
- this->Rcc.ExecutableFeatures->ListOptions);
|
|
|
+ info.SetConfig("RCC_EXECUTABLE", this->Rcc.Executable);
|
|
|
+ info.SetConfigArray(
|
|
|
+ "RCC_LIST_OPTIONS",
|
|
|
+ generateListOptions(this->Rcc.ExecutableFeatures, this->MultiConfig));
|
|
|
|
|
|
// qrc file
|
|
|
info.Set("SOURCE", qrc.QrcFile);
|
|
|
info.Set("OUTPUT_CHECKSUM", qrc.QrcPathChecksum);
|
|
|
info.Set("OUTPUT_NAME", cmSystemTools::GetFilenameName(qrc.OutputFile));
|
|
|
info.SetArray("OPTIONS", qrc.Options);
|
|
|
- info.SetArray("INPUTS", qrc.Resources);
|
|
|
+ info.SetConfigArray("INPUTS", qrc.Resources);
|
|
|
|
|
|
info.Save(qrc.InfoFile);
|
|
|
}
|
|
@@ -2244,16 +2370,32 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
|
|
|
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
|
|
cmGeneratorExpression ge(*this->Makefile->GetCMakeInstance(), lfbt);
|
|
|
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(val);
|
|
|
- genVars.Executable = cge->Evaluate(this->LocalGen, "");
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ genVars.Executable.Config[config] =
|
|
|
+ cge->Evaluate(this->LocalGen, config);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ genVars.Executable.Default = cge->Evaluate(this->LocalGen, "");
|
|
|
+ }
|
|
|
}
|
|
|
- if (genVars.Executable.empty() && !ignoreMissingTarget) {
|
|
|
+
|
|
|
+ if (genVars.Executable.Default.empty() &&
|
|
|
+ genVars.Executable.Config.empty() && !ignoreMissingTarget) {
|
|
|
print_err(prop + " evaluates to an empty value");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// Create empty compiler features.
|
|
|
- genVars.ExecutableFeatures =
|
|
|
- std::make_shared<cmQtAutoGen::CompilerFeatures>();
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ genVars.ExecutableFeatures.Config[config] =
|
|
|
+ std::make_shared<cmQtAutoGen::CompilerFeatures>();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ genVars.ExecutableFeatures.Default =
|
|
|
+ std::make_shared<cmQtAutoGen::CompilerFeatures>();
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -2278,15 +2420,39 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
|
|
|
genVars.ExecutableTargetName = targetName;
|
|
|
genVars.ExecutableTarget = genTarget;
|
|
|
if (genTarget->IsImported()) {
|
|
|
- genVars.Executable = genTarget->ImportedGetLocation("");
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ genVars.Executable.Config[config] =
|
|
|
+ genTarget->ImportedGetLocation(config);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ genVars.Executable.Default =
|
|
|
+ genTarget->ImportedGetLocation(this->ConfigDefault);
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
- genVars.Executable = genTarget->GetLocation("");
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ genVars.Executable.Config[config] = genTarget->GetLocation(config);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ genVars.Executable.Default =
|
|
|
+ genTarget->GetLocation(this->ConfigDefault);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
if (ignoreMissingTarget) {
|
|
|
// Create empty compiler features.
|
|
|
- genVars.ExecutableFeatures =
|
|
|
- std::make_shared<cmQtAutoGen::CompilerFeatures>();
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ genVars.ExecutableFeatures.Config[config] =
|
|
|
+ std::make_shared<cmQtAutoGen::CompilerFeatures>();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ genVars.ExecutableFeatures.Default =
|
|
|
+ std::make_shared<cmQtAutoGen::CompilerFeatures>();
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
print_err(cmStrCat("Could not find ", executable, " executable target ",
|
|
@@ -2299,10 +2465,22 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars,
|
|
|
{
|
|
|
std::string err;
|
|
|
genVars.ExecutableFeatures = this->GlobalInitializer->GetCompilerFeatures(
|
|
|
- executable, genVars.Executable, err);
|
|
|
- if (!genVars.ExecutableFeatures) {
|
|
|
- print_err(err);
|
|
|
- return false;
|
|
|
+ executable, genVars.Executable, err, this->MultiConfig,
|
|
|
+ this->UseBetterGraph);
|
|
|
+ if (this->MultiConfig && this->UseBetterGraph) {
|
|
|
+ for (auto const& config : this->ConfigsList) {
|
|
|
+ if (!genVars.ExecutableFeatures.Config[config]) {
|
|
|
+ if (!genVars.ExecutableFeatures.Config[config]) {
|
|
|
+ print_err(err);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!genVars.ExecutableFeatures.Default) {
|
|
|
+ print_err(err);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|