From 890ddd254087da9a6008e9fe5639ffd3a35f1b8b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 22 Mar 2019 15:17:02 +0100 Subject: Fix AUTOMOC and friends to run only once the tools are built While building on macOS, AUTOMOC sometimes hanged indefinitely. The problem was that AUTOMOC was executed for the qmacstyle plugin before moc was actually built. Because of an upstream bug in CMake, AUTOMOC was caught in a deadlock without reporting that spawning the moc process failed. Specifically if a libuv spawn() call failed, the condition variable for a waiting thread was not notified, and the thread kept waiting forever for the process launch to finish. Fix the dependency by setting the AUTOGEN_TARGET_DEPENDS property on all targets that have AUTOGEN tools enabled. This makes sure that moc and friends are built before they are used. Also add some special cases to disable autogen tools on certain targets to break cycles between targets. Fixes: QTBUG-74636 Change-Id: I6e689e63cba1962525f169f332a58498d173c0a6 Reviewed-by: Simon Hausmann Reviewed-by: Mikhail Svetkin --- cmake/QtBuild.cmake | 1 + src/corelib/CMakeLists.txt | 2 ++ src/tools/uic/CMakeLists.txt | 2 ++ 3 files changed, 5 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index dd9d5b1693..bc07da27ba 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -321,6 +321,7 @@ function(qt_autogen_tools target) PROPERTIES AUTO${captitalAutogenTool} ON AUTO${captitalAutogenTool}_EXECUTABLE "$") + set_property(TARGET ${target} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS Qt::${autogen_tool}) endforeach() set_directory_properties(PROPERTIES diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 3484e2b15e..e1d827d0ee 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -242,6 +242,8 @@ add_qt_module(Core ZLIB::ZLIB PUBLIC_LIBRARIES # special case: Qt::Platform + DISABLE_AUTOGEN_TOOLS # special case: + uic # ANDROID_BUNDLED_JAR_DEPENDENCIES = "jar/QtAndroid.jar" # ANDROID_LIB_DEPENDENCIES = "plugins/platforms/android/libqtforandroid.so" # ANDROID_PERMISSIONS = "android.permission.INTERNET" "android.permission.WRITE_EXTERNAL_STORAGE" diff --git a/src/tools/uic/CMakeLists.txt b/src/tools/uic/CMakeLists.txt index 46826b7d52..15ef92a2b4 100644 --- a/src/tools/uic/CMakeLists.txt +++ b/src/tools/uic/CMakeLists.txt @@ -27,6 +27,8 @@ add_qt_tool(uic QT_UIC_CPP_GENERATOR INCLUDE_DIRECTORIES cpp + DISABLE_AUTOGEN_TOOLS # special case: + uic rcc # QMAKE_TARGET_DESCRIPTION = "Qt User Interface Compiler" # _LOADED = "qt_tool" # _OPTION = "host_build" -- cgit v1.2.3