Use _qt_internal_collect_qml_root_paths to collect android dependencies
Add the _qt_internal_collect_qml_root_paths function that collects qml root paths and sets the QT_QML_ROOT_PATH property to the target based on the provided qml source files. Call _qt_internal_collect_qml_root_paths when adding QML source files to collect QML root paths for the qmlimportscanner when building Android applications. Pick-to: 6.2 Task-number: QTBUG-93340 Change-Id: Ica996e6043b5d1b403665a1316eff23dc97fdf44 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
c80c0d212f
commit
25ea9bbec2
|
@ -38,6 +38,9 @@ endif()
|
|||
# special case begin
|
||||
# export QT6_ADD_QML_MODULE to this project
|
||||
include(src/qml/Qt6QmlMacros.cmake)
|
||||
if(ANDROID)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/src/qml/Qt6AndroidQmlMacros.cmake")
|
||||
endif()
|
||||
# special case end
|
||||
|
||||
if(NOT QT_FEATURE_commandlineparser)
|
||||
|
|
|
@ -19,6 +19,15 @@ if (QT_FEATURE_qml_worker_script)
|
|||
)
|
||||
endif()
|
||||
|
||||
set(extra_cmake_files)
|
||||
set(extra_cmake_includes)
|
||||
if(ANDROID)
|
||||
list(APPEND extra_cmake_files
|
||||
"${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}AndroidQmlMacros.cmake")
|
||||
list(APPEND extra_cmake_includes
|
||||
"${INSTALL_CMAKE_NAMESPACE}AndroidQmlMacros.cmake")
|
||||
endif()
|
||||
|
||||
qt_internal_add_qml_module(Qml
|
||||
URI "QtQml"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
|
@ -381,8 +390,10 @@ qt_internal_add_qml_module(Qml
|
|||
"${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}qmldirTemplate.cmake.in"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}QmlPluginTemplate.cpp.in"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}QmlFindQmlscInternal.cmake"
|
||||
${extra_cmake_files}
|
||||
EXTRA_CMAKE_INCLUDES
|
||||
"${INSTALL_CMAKE_NAMESPACE}QmlFindQmlscInternal.cmake"
|
||||
${extra_cmake_includes}
|
||||
)
|
||||
|
||||
# Linking to the static qml plugin should also automatically link to the worker script
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# The function collects qml root paths and sets the QT_QML_ROOT_PATH property to the ${target}
|
||||
# based on the provided qml source files.
|
||||
function(_qt_internal_collect_qml_root_paths target)
|
||||
get_target_property(qml_root_paths ${target} QT_QML_ROOT_PATH)
|
||||
if(NOT qml_root_paths)
|
||||
set(qml_root_paths "")
|
||||
endif()
|
||||
foreach(file IN LISTS ARGN)
|
||||
get_filename_component(extension "${file}" LAST_EXT)
|
||||
if(NOT extension STREQUAL ".qml")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
get_filename_component(dir "${file}" DIRECTORY)
|
||||
get_filename_component(absolute_dir "${dir}" ABSOLUTE)
|
||||
list(APPEND qml_root_paths "${absolute_dir}")
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES qml_root_paths)
|
||||
set_target_properties(${target} PROPERTIES QT_QML_ROOT_PATH "${qml_root_paths}")
|
||||
endfunction()
|
|
@ -1597,6 +1597,10 @@ function(qt6_target_qml_sources target)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
if(ANDROID)
|
||||
_qt_internal_collect_qml_root_paths("${target}" ${arg_QML_FILES})
|
||||
endif()
|
||||
|
||||
if(non_qml_files)
|
||||
list(JOIN non_qml_files "\n " file_list)
|
||||
message(WARNING
|
||||
|
|
Loading…
Reference in New Issue