From 7f3cb3884d844cfe578fae43f0cf02694b98487a Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Fri, 17 Dec 2021 14:55:56 +0200 Subject: [PATCH] sdk: use Qt's own qt.toolchain.cmake in build scripts qt-cmake* helper build scripts by default use Qt's generated qt.toolchain.cmake as the CMAKE_TOOLCHAIN_FILE. Keep this behavior and patch qt.toolchain.cmake so that will chain-load our Qt6Toolchain.cmake. qt.toolchain.cmake includes bits that are needed for the conan integration to work correctly with the sdk. Pick-to: 6.3 6.2 Change-Id: I89a5e152324178151ba8a5ab4734d542fa4c995c Reviewed-by: Mikko Gronoff --- classes/populate_sdk_qt6_base.bbclass | 12 ++------ ...OLCHAIN_RELOCATABLE-paths-in-qt.tool.patch | 29 +++++++++++++++++++ recipes-qt/qt6/qtbase_git.bb | 7 ++--- 3 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 recipes-qt/qt6/qtbase/0004-Do-not-use-QT_TOOLCHAIN_RELOCATABLE-paths-in-qt.tool.patch diff --git a/classes/populate_sdk_qt6_base.bbclass b/classes/populate_sdk_qt6_base.bbclass index a792159..e7cc4d3 100644 --- a/classes/populate_sdk_qt6_base.bbclass +++ b/classes/populate_sdk_qt6_base.bbclass @@ -96,15 +96,9 @@ set(CMAKE_TOOLCHAIN_FILE "${SDKPATHNATIVE}/usr/share/cmake/OEToolchainConfig.cma include("\${CMAKE_TOOLCHAIN_FILE}") EOF - # override qt-cmake - cat > ${SDK_OUTPUT}${SDKPATHNATIVE}${QT6_INSTALL_BINDIR}/qt-cmake < +Date: Thu, 16 Dec 2021 13:10:48 +0200 +Subject: [PATCH] Do not use QT_TOOLCHAIN_RELOCATABLE paths in + qt.toolchain.cmake + +The calculated paths for QT_TOOLCHAIN_RELOCATABLE paths point to +host sysroot which must not be used when cross-compiling other projects. + +Upstream-Status: Inappropriate [embedded specific] +--- + cmake/qt.toolchain.cmake.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in +index 5e9acd66b8..451de99633 100644 +--- a/cmake/qt.toolchain.cmake.in ++++ b/cmake/qt.toolchain.cmake.in +@@ -68,8 +68,8 @@ get_filename_component(QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR "${CMAKE_CURRENT_LIST_ + # Instead of collapsing the search prefix (which is the case when one is a subdir of the other), + # it concatenates them creating an invalid path. Workaround it by setting the root path to the + # Qt install prefix, and the prefix path to the lib/cmake subdir. +-list(PREPEND CMAKE_PREFIX_PATH "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}") +-list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX}") ++#list(PREPEND CMAKE_PREFIX_PATH "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}") ++#list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX}") + + # Let CMake load our custom platform modules. + # CMake-provided platform modules take precedence. diff --git a/recipes-qt/qt6/qtbase_git.bb b/recipes-qt/qt6/qtbase_git.bb index 3bfcf8b..947a93c 100644 --- a/recipes-qt/qt6/qtbase_git.bb +++ b/recipes-qt/qt6/qtbase_git.bb @@ -17,6 +17,7 @@ SRC_URI += "\ file://0001-Add-linux-oe-g-platform.patch \ file://0002-qlibraryinfo-allow-to-set-qt.conf-from-the-outside-u.patch \ file://0003-tests-disable-failing-tests.patch \ + file://0004-Do-not-use-QT_TOOLCHAIN_RELOCATABLE-paths-in-qt.tool.patch \ file://0001-catch_p_p.h-don-t-use-MINSIGSTKSZ.patch \ file://0005-Exclude-sources-from-HEADER_MODULE-if-cmake-version-.patch \ " @@ -155,10 +156,8 @@ set(QT_HOST_PATH "\$ENV{OECORE_NATIVE_SYSROOT}/usr" CACHE PATH "") set(QT_BUILD_TOOLS_WHEN_CROSSCOMPILING "TRUE" CACHE BOOL "") EOF - sed -i ${D}${QT6_INSTALL_BINDIR}/* \ - -e 's|${RECIPE_SYSROOT_NATIVE}|${SDKPATHNATIVE}|' \ - -e '/^toolchain_path=/s|.*|toolchain_path=${SDKPATHNATIVE}/usr/share/cmake/Qt6Toolchain.cmake|' - + sed -i ${D}${QT6_INSTALL_BINDIR}/* ${D}${QT6_INSTALL_LIBDIR}/cmake/Qt6/qt.toolchain.cmake \ + -e 's|${RECIPE_SYSROOT_NATIVE}|${SDKPATHNATIVE}|' } INSANE_SKIP:${PN}-ptest += "arch"