aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-01-24 13:46:58 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-03 08:46:02 +0000
commit4cbbe17dedd0274e0e46c523d0f868a87ae7e957 (patch)
treeb7394e8e609a453cf0eddaf1571408d40a5a9800 /src
parent1140e5551ebb6f67252ba4af193015e5d4ceaaf0 (diff)
qmltc: Rely on QQmlJSResourceFileMapper
Similarly to qmllint, we should use QQmlJSResourceFileMapper in qmltc. This should in theory allow us to avoid implicit import dir vs qmldir path issues (where the former comes from source dir while the latter comes from build dir) At present, it does not seem to be the case, however. But this is to be addressed separately Task-number: QTBUG-100103 Change-Id: Ie85799cb0a4b8b1620964000bc5939e9d046678e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 8a72c684464a48595337b01ada5605f612f7971e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/qml/Qt6QmlMacros.cmake14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake
index 5cfc44c40e..a9898af84e 100644
--- a/src/qml/Qt6QmlMacros.cmake
+++ b/src/qml/Qt6QmlMacros.cmake
@@ -1073,6 +1073,8 @@ function(qt6_target_compile_qml_to_cpp target)
get_target_property(output_dir ${target} QT_QML_MODULE_OUTPUT_DIRECTORY)
set(qmldir_file ${output_dir}/qmldir)
+ # TODO: we still need to specify the qmldir here for _explicit_ imports of
+ # own module. in theory this could be pushed to the user side
list(APPEND common_args "-i" ${qmldir_file})
foreach(import_path IN LISTS arg_IMPORT_PATHS)
@@ -1130,6 +1132,12 @@ function(qt6_target_compile_qml_to_cpp target)
endif()
endforeach()
+ # qmltc needs qrc files to supply to the QQmlJSResourceFileMapper
+ _qt_internal_genex_getjoinedproperty(qrc_args ${target}
+ _qt_generated_qrc_files "--resource$<SEMICOLON>" "$<SEMICOLON>"
+ )
+ list(APPEND common_args ${qrc_args})
+
foreach(qml_file_src IN LISTS arg_QML_FILES)
if(NOT qml_file_src MATCHES "\\.(qml)$")
list(APPEND non_qml_files ${qml_file_src})
@@ -1137,10 +1145,6 @@ function(qt6_target_compile_qml_to_cpp target)
endif()
get_filename_component(file_absolute ${qml_file_src} ABSOLUTE)
- __qt_get_relative_resource_path_for_file(file_resource_path ${qml_file_src})
-
- # we ensured earlier that prefix always ends with "/"
- file(TO_CMAKE_PATH "${prefix}${file_resource_path}" file_resource_path)
get_filename_component(file_basename ${file_absolute} NAME_WLE) # extension is always .qml
string(REGEX REPLACE "[$#?]+" "_" compiled_file ${file_basename})
@@ -1169,7 +1173,6 @@ function(qt6_target_compile_qml_to_cpp target)
${qmltc_executable}
--header "${compiled_header}"
--impl "${compiled_cpp}"
- --resource-path "${file_resource_path}"
${common_args}
${file_absolute}
COMMAND_EXPAND_LISTS
@@ -1177,6 +1180,7 @@ function(qt6_target_compile_qml_to_cpp target)
${qmltc_executable}
"${file_absolute}"
${qml_module_files}
+ $<TARGET_PROPERTY:${target},_qt_generated_qrc_files>
)
set_source_files_properties(${compiled_header} ${compiled_cpp}