Build: Get rid of custom dependency tracking for plugins

Instead of PUBLIC_DEPENDS, our build system would keep record and track
recursive plugin dependencies manually, by attaching a custom property
to the targets that reference the targets it depends on. Then it used
DEPENDS to add all these recursive dependencies.

Get rid of this custom reimplementation of PUBLIC_DEPENDS and just use
that instead. This needs a fix that we should not separately export the
licensechecker plugin when doing a super-repository build. Otherwise
external plugins configured with the result cannot find the licensechecker
target, which is referenced by the vxworks target that is exported
together with the QtCreatorConfig.

Change-Id: I1444a0b16e5519f5310f9c0ffdfc49481ac228a4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2024-09-04 15:15:09 +02:00
parent f72b5a1a5c
commit e4431beb8c
2 changed files with 8 additions and 37 deletions

View File

@@ -352,6 +352,11 @@ function(add_qtc_plugin target_name)
message(FATAL_ERROR "add_qtc_plugin had unparsed arguments") message(FATAL_ERROR "add_qtc_plugin had unparsed arguments")
endif() endif()
# ignore _arg_EXPORT for main repository and super repository build
if (QTC_MERGE_BINARY_DIR)
set(_arg_EXPORT "")
endif()
update_cached_list(__QTC_PLUGINS "${target_name}") update_cached_list(__QTC_PLUGINS "${target_name}")
set(name ${target_name}) set(name ${target_name})
@@ -401,8 +406,6 @@ function(add_qtc_plugin target_name)
endif() endif()
# Generate dependency list: # Generate dependency list:
find_dependent_plugins(_DEP_PLUGINS ${_arg_PLUGIN_DEPENDS})
set(_arg_DEPENDENCY_STRING "\"Dependencies\" : [\n") set(_arg_DEPENDENCY_STRING "\"Dependencies\" : [\n")
foreach(i IN LISTS _arg_PLUGIN_DEPENDS) foreach(i IN LISTS _arg_PLUGIN_DEPENDS)
get_property(_v TARGET "${i}" PROPERTY QTC_PLUGIN_VERSION) get_property(_v TARGET "${i}" PROPERTY QTC_PLUGIN_VERSION)
@@ -526,8 +529,8 @@ function(add_qtc_plugin target_name)
PUBLIC_SYSTEM_INCLUDES ${_arg_PUBLIC_SYSTEM_INCLUDES} PUBLIC_SYSTEM_INCLUDES ${_arg_PUBLIC_SYSTEM_INCLUDES}
DEFINES ${DEFAULT_DEFINES} ${_arg_DEFINES} ${TEST_DEFINES} DEFINES ${DEFAULT_DEFINES} ${_arg_DEFINES} ${TEST_DEFINES}
PUBLIC_DEFINES ${_arg_PUBLIC_DEFINES} PUBLIC_DEFINES ${_arg_PUBLIC_DEFINES}
DEPENDS ${_arg_DEPENDS} ${_DEP_PLUGINS} ${IMPLICIT_DEPENDS} DEPENDS ${_arg_DEPENDS} ${IMPLICIT_DEPENDS}
PUBLIC_DEPENDS ${_arg_PUBLIC_DEPENDS} PUBLIC_DEPENDS ${_arg_PUBLIC_DEPENDS} ${_arg_PLUGIN_DEPENDS}
EXPLICIT_MOC ${_arg_EXPLICIT_MOC} EXPLICIT_MOC ${_arg_EXPLICIT_MOC}
SKIP_AUTOMOC ${_arg_SKIP_AUTOMOC} SKIP_AUTOMOC ${_arg_SKIP_AUTOMOC}
EXTRA_TRANSLATIONS ${_arg_EXTRA_TRANSLATIONS} EXTRA_TRANSLATIONS ${_arg_EXTRA_TRANSLATIONS}
@@ -577,7 +580,6 @@ function(add_qtc_plugin target_name)
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
CXX_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON VISIBILITY_INLINES_HIDDEN ON
QTC_PLUGIN_DEPENDS "${_arg_PLUGIN_DEPENDS}"
QTC_PLUGIN_VERSION "${_arg_VERSION}" QTC_PLUGIN_VERSION "${_arg_VERSION}"
BUILD_RPATH "${_PLUGIN_RPATH};${CMAKE_BUILD_RPATH}" BUILD_RPATH "${_PLUGIN_RPATH};${CMAKE_BUILD_RPATH}"
INSTALL_RPATH "${_PLUGIN_RPATH};${CMAKE_INSTALL_RPATH}" INSTALL_RPATH "${_PLUGIN_RPATH};${CMAKE_INSTALL_RPATH}"
@@ -592,7 +594,7 @@ function(add_qtc_plugin target_name)
) )
set_property(TARGET ${target_name} APPEND PROPERTY EXPORT_PROPERTIES set_property(TARGET ${target_name} APPEND PROPERTY EXPORT_PROPERTIES
"QTC_PLUGIN_CLASS_NAME;QTC_PLUGIN_DEPENDS;QTC_PLUGIN_VERSION") "QTC_PLUGIN_CLASS_NAME;QTC_PLUGIN_VERSION")
if (NOT _arg_SKIP_PCH) if (NOT _arg_SKIP_PCH)
enable_pch(${target_name}) enable_pch(${target_name})

View File

@@ -356,37 +356,6 @@ function(add_qtc_depends target_name)
endforeach() endforeach()
endfunction() endfunction()
function(find_dependent_plugins varName)
set(_RESULT ${ARGN})
foreach(i ${ARGN})
if(NOT TARGET ${i})
continue()
endif()
set(_deps)
get_property(_deps TARGET "${i}" PROPERTY QTC_PLUGIN_DEPENDS)
if (_deps)
set(_fixed_deps "")
foreach(_dep ${_deps})
if(NOT TARGET ${_dep} AND TARGET "QtCreator::${_dep}")
list(APPEND _fixed_deps "QtCreator::${_dep}")
else()
list(APPEND _fixed_deps ${_dep})
endif()
endforeach()
find_dependent_plugins(_REC ${_fixed_deps})
list(APPEND _RESULT ${_REC})
endif()
endforeach()
if (_RESULT)
list(REMOVE_DUPLICATES _RESULT)
list(SORT _RESULT)
endif()
set("${varName}" ${_RESULT} PARENT_SCOPE)
endfunction()
function(enable_pch target) function(enable_pch target)
if (BUILD_WITH_PCH) if (BUILD_WITH_PCH)
# Skip PCH for targets that do not use the expected visibility settings: # Skip PCH for targets that do not use the expected visibility settings: