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 <simon.hausmann@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
This commit is contained in:
Alexandru Croitor 2019-03-22 15:17:02 +01:00
parent 5fd30d0a18
commit 890ddd2540
3 changed files with 5 additions and 0 deletions

View File

@ -321,6 +321,7 @@ function(qt_autogen_tools target)
PROPERTIES
AUTO${captitalAutogenTool} ON
AUTO${captitalAutogenTool}_EXECUTABLE "$<TARGET_FILE:Qt::${autogen_tool}>")
set_property(TARGET ${target} APPEND PROPERTY AUTOGEN_TARGET_DEPENDS Qt::${autogen_tool})
endforeach()
set_directory_properties(PROPERTIES

View File

@ -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"

View File

@ -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"