diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-08-09 11:42:37 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-08-09 11:47:25 +0000 |
commit | 73ba2ba2def56b9eba852b1f7e884925e713535d (patch) | |
tree | 1115a36332d094c2f56fec918f291efa376dfce9 /util/cmake | |
parent | f55c6a4cb082a6dbd6e65a0696a998478febde27 (diff) |
Simplify resource embedding for qml modules
* Add support for a QT_RESOURCE_PREFIX target property, that
add_qt_resource respects. This makes it convenient to add files
to the resource system for a project without the need to repeat
prefixes. In qmake land with multiple resources they're repeated
in the foo.prefix variables or in the prefix attribute in .qrc
files.
* Since /qt-project.org/imports is in the default QML import search path
and the hierarchy under the import search paths is "regulated",
we might as well make add_qml_module set QT_RESOURCE_PREFIX on
the target. We can compute the correct value for that. This
allows removing the redundant prefix from the add_qt_resource()
calls for the qml files.
Change-Id: Ic15130dc9e432340fc3edf93e35f2a803b4b40eb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Diffstat (limited to 'util/cmake')
-rwxr-xr-x | util/cmake/pro2cmake.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 78fd4fd1ce..794b2ec2ef 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -2097,8 +2097,6 @@ def write_qml_plugin(cm_fh: typing.IO[str], if plugindump_dep: extra_lines.append('QML_PLUGINDUMP_DEPENDENCIES "{}"'.format(plugindump_dep)) - # This is only required because of qmldir - extra_lines.append('RESOURCE_PREFIX "/qt-project.org/imports"') def write_qml_plugin_qml_files(cm_fh: typing.IO[str], target: str, @@ -2116,15 +2114,11 @@ def write_qml_plugin_qml_files(cm_fh: typing.IO[str], target_path_mangled = target_path.replace('/', '_') target_path_mangled = target_path_mangled.replace('.', '_') resource_name = 'qmake_' + target_path_mangled - prefix = '/qt-project.org/imports/' + target_path - cm_fh.write('\n{}add_qt_resource({} {}\n{}PREFIX\n{}"{}"\n{}FILES\n{}${{qml_files}}\n)\n'.format( + cm_fh.write('\n{}add_qt_resource({} {}\n{}FILES\n{}${{qml_files}}\n)\n'.format( spaces(indent), target, resource_name, spaces(indent + 1), - spaces(indent + 2), - prefix, - spaces(indent + 1), spaces(indent + 2))) cm_fh.write('\nqt_install_qml_files({}\n FILES ${{qml_files}}\n)\n\n'.format( |