Add install directory for plugins without type

When we run into a plugin that does not have a type and is not a
qml plugin, we try to see if we can find the target installation path
and provide INSTALL_DIRECTORY AND ARCHIVE_INSTALL_DIRECTORY to the
add_qt_plugin call.

We run into this frequently with the unit tests.

This patch also changes add_qt_plugin() to use the value provided in
INSTALL_DIRECTORY for ARCHIVE_INSTALL_DIRECTORY if no value is provided
for the latter.

Change-Id: I61278904a4d2d72308079cd362bd085b4e2f540c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Leander Beernaert 2019-10-10 14:21:02 +02:00
parent fbf2759598
commit b42feb02ce
2 changed files with 8 additions and 3 deletions

View File

@ -1783,9 +1783,9 @@ function(add_qt_plugin target)
"${output_directory_default}" output_directory) "${output_directory_default}" output_directory)
qt_internal_check_directory_or_type(INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" "${arg_TYPE}" qt_internal_check_directory_or_type(INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}" "${arg_TYPE}"
"${install_directory_default}" install_directory) "${install_directory_default}" install_directory)
qt_internal_check_directory_or_type(ARCHIVE_INSTALL_DIRECTORY if (NOT arg_ARCHIVE_INSTALL_DIRECTORY AND arg_INSTALL_DIRECTORY)
"${arg_ARCHIVE_INSTALL_DIRECTORY}" "${arg_TYPE}" set(arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}")
"${archive_install_directory_default}" archive_install_directory) endif()
if(arg_STATIC OR NOT BUILD_SHARED_LIBS) if(arg_STATIC OR NOT BUILD_SHARED_LIBS)
add_library("${target}" STATIC) add_library("${target}" STATIC)

View File

@ -3106,6 +3106,11 @@ def write_plugin(cm_fh, scope, *, indent: int = 0) -> str:
elif is_qml_plugin: elif is_qml_plugin:
plugin_function_name = "add_qml_module" plugin_function_name = "add_qml_module"
qmldir = write_qml_plugin(cm_fh, plugin_name, scope, indent=indent, extra_lines=extra) qmldir = write_qml_plugin(cm_fh, plugin_name, scope, indent=indent, extra_lines=extra)
else:
target_path = scope.expandString('target.path')
target_path = replace_path_constants(target_path, scope)
if target_path:
extra.append(f'INSTALL_DIRECTORY "{target_path}"')
plugin_class_name = scope.get_string("PLUGIN_CLASS_NAME") plugin_class_name = scope.get_string("PLUGIN_CLASS_NAME")
if plugin_class_name: if plugin_class_name: