Fix add_qml_module URI
Make sure the URI name for qml modules correctly strips out the version number for instances such as QtQuick.Controls.2. Change-Id: I18e706b371323eeefdd6d7564b922265fa5cad3f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
a3e149d92a
commit
709538096c
@ -2018,8 +2018,6 @@ endfunction()
|
||||
# to the module's URI where '.' is replaced with '/'. Use this to override the
|
||||
# default substitution pattern.
|
||||
# VERSION: Version of the qml module
|
||||
# NAME: Override for the default import name used in the ${target}_qmltypes
|
||||
# target (optional)
|
||||
# RESOURCE_PREFIX: Resource import prefix to be prepended to the module's
|
||||
# target path.
|
||||
# QML_PLUGINDUMP_DEPENDENCIES: Path to a dependencies.json file to be consumed
|
||||
@ -2037,7 +2035,6 @@ function(add_qml_module target)
|
||||
URI
|
||||
TARGET_PATH
|
||||
VERSION
|
||||
NAME
|
||||
RESOURCE_PREFIX
|
||||
QML_PLUGINDUMP_DEPENDENCIES
|
||||
)
|
||||
@ -2108,7 +2105,7 @@ function(add_qml_module target)
|
||||
qt_add_qmltypes_target(${target}
|
||||
TARGET_PATH "${arg_TARGET_PATH}"
|
||||
IMPORT_VERSION "${arg_VERSION}"
|
||||
IMPORT_NAME "${arg_NAME}"
|
||||
IMPORT_NAME "${arg_URI}"
|
||||
QML_PLUGINDUMP_DEPENDENCIES "${arg_QML_PLUGINDUMP_DEPENDENCIES}")
|
||||
|
||||
qt_path_join(qml_module_install_dir ${QT_INSTALL_DIR} "${INSTALL_QMLDIR}/${arg_TARGET_PATH}")
|
||||
@ -2130,7 +2127,8 @@ function(add_qml_module target)
|
||||
if (NOT QT_BUILD_SHARED_LIBS)
|
||||
# only embed qmldir on static builds. Some qml modules may request
|
||||
# their qml files to be embedded into their binary
|
||||
string(REPLACE "." "_" qmldir_resource_name ${arg_URI})
|
||||
string(REPLACE "." "_" qmldir_resource_name ${arg_TARGET_PATH})
|
||||
string(REPLACE "/" "_" qmldir_resource_name ${qmldir_resource_name})
|
||||
set(qmldir_resource_name "${qmldir_resource_name}_qmldir")
|
||||
add_qt_resource(${target} ${uri_target}
|
||||
FILES "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
|
||||
|
@ -1955,22 +1955,24 @@ def write_qml_plugin(cm_fh: typing.IO[str],
|
||||
target_path = scope.get_string('TARGETPATH')
|
||||
if target_path:
|
||||
uri = target_path.replace('/','.')
|
||||
extra_lines.append('URI "{}"'.format(uri))
|
||||
import_name = scope.get_string('IMPORT_NAME')
|
||||
# Catch special cases such as foo.QtQuick.2.bar, which when converted
|
||||
# into a target path via cmake will result in foo/QtQuick/2/bar, which is
|
||||
# not what we want. So we supply the target path override.
|
||||
target_path_from_uri = uri.replace('.', '/')
|
||||
if target_path != target_path_from_uri:
|
||||
extra_lines.append('TARGET_PATH "{}"'.format(target_path))
|
||||
if import_name:
|
||||
extra_lines.append('URI "{}"'.format(import_name))
|
||||
else:
|
||||
uri = re.sub('\\.\\d+\\.', '.',uri)
|
||||
extra_lines.append('URI "{}"'.format(uri))
|
||||
|
||||
import_version = scope.get_string('IMPORT_VERSION')
|
||||
if import_version:
|
||||
import_version = import_version.replace("$$QT_MINOR_VERSION","${CMAKE_PROJECT_VERSION_MINOR}")
|
||||
extra_lines.append('VERSION "{}"'.format(import_version))
|
||||
|
||||
import_name = scope.get_string('IMPORT_NAME')
|
||||
if import_name:
|
||||
extra_lines.append('NAME "{}"'.format(import_name))
|
||||
plugindump_dep = scope.get_string('QML_PLUGINDUMP_DEPENDENCIES')
|
||||
|
||||
if plugindump_dep:
|
||||
|
Loading…
Reference in New Issue
Block a user