Autogen: Fix Ninja Multi-Config dependency graph regression

In commit 5363bebc1e (Autogen: Fix compilation of unchanged source files,
2024-07-16, v3.31.0-rc1~328^2) we relied on Ninja Multi-Config dependency graph
optimizations from commit 7c39dabdbc (Autogen: AUTO*_EXECUTABLE: add support
for per-config values, 2023-10-18, v3.29.0-rc1~105^2~1).  However, those graph
optimizations are conditional on versions of Qt that enable
[`AUTOGEN_BETTER_GRAPH_MULTI_CONFIG`](https://codereview.qt-project.org/c/qt/qtbase/+/513648).

`UseBetterGraph` should be checked to add ui files to `timestampByproducts`.

Fixes: #26475
This commit is contained in:
Orkun Tokdemir
2024-11-26 11:44:43 +01:00
committed by Brad King
parent 3cac48e8cd
commit 8a526f6a44
2 changed files with 20 additions and 6 deletions

View File

@@ -1340,12 +1340,25 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
}
if (this->Uic.Enabled) {
// Make all ui_*.h files byproducts of the ${target}_autogen/timestamp
// custom command if the generation of depfile is enabled.
auto& byProducts = useDepfile ? timestampByproducts : autogenByproducts;
for (auto const& file : this->Uic.UiHeaders) {
this->AddGeneratedSource(file.first, this->Uic);
byProducts.push_back(file.second);
auto const useAdvancedUicGraph = [this]() -> bool {
if (this->MultiConfig && this->GlobalGen->IsNinja()) {
return this->UseBetterGraph;
}
return true;
}();
if (useAdvancedUicGraph) {
// Make all ui_*.h files byproducts of the ${target}_autogen/timestamp
// custom command if the generation of depfile is enabled.
auto& byProducts = useDepfile ? timestampByproducts : autogenByproducts;
for (auto const& file : this->Uic.UiHeaders) {
this->AddGeneratedSource(file.first, this->Uic);
byProducts.push_back(file.second);
}
} else {
for (auto const& file : this->Uic.UiHeaders) {
this->AddGeneratedSource(file.first, this->Uic);
autogenByproducts.push_back(file.second);
}
}
}

View File

@@ -6,6 +6,7 @@ if (DEFINED with_qt_version)
-Dwith_qt_version=${with_qt_version}
"-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
"-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON"
)
if (QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
macro(set_test_variables_for_unwanted_builds)