summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2023-12-14 17:23:38 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2023-12-17 20:31:48 +0100
commit571201603acc731330c9af42a3aca9cda41d38fd (patch)
treec495756b129a1221cebe71d4d798a8f41089bccf
parent75964763660cb131a0afe7b0bc051fd901939821 (diff)
CMake: Deploy correct arch files when cross-compiling to arm Windows
When cross-compiling a user project from x86_64 to arm64 MSVC Windows target, during deployment we need to deploy arm libraries. By default because we use an x86_64 windeployqt, it always deploys x86_64 libraries. Make sure to pass the path to the target WoA qtpaths.bat file to windeployqt, so it deploys arm libraries. Pick-to: 6.5 6.6 6.7 Fixes: QTBUG-119619 Change-Id: Ib3b5498ae906726d1f9e0919333c102898b48ea9 Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/corelib/Qt6CoreDeploySupport.cmake7
-rw-r--r--src/corelib/Qt6CoreMacros.cmake15
2 files changed, 22 insertions, 0 deletions
diff --git a/src/corelib/Qt6CoreDeploySupport.cmake b/src/corelib/Qt6CoreDeploySupport.cmake
index e189b26538..6560a23e1b 100644
--- a/src/corelib/Qt6CoreDeploySupport.cmake
+++ b/src/corelib/Qt6CoreDeploySupport.cmake
@@ -404,6 +404,13 @@ function(qt6_deploy_runtime_dependencies)
if(arg_NO_COMPILER_RUNTIME)
list(APPEND tool_options --no-compiler-runtime)
endif()
+
+ # Specify path to target Qt's qtpaths .exe or .bat file, so windeployqt deploys the correct
+ # libraries when cross-compiling from x86_64 to arm64 windows.
+ if(__QT_DEPLOY_TARGET_QT_PATHS_PATH)
+ list(APPEND tool_options --qtpaths "${__QT_DEPLOY_TARGET_QT_PATHS_PATH}")
+ endif()
+
list(APPEND tool_options ${arg_DEPLOY_TOOL_OPTIONS})
elseif(__QT_DEPLOY_SYSTEM_NAME STREQUAL Darwin)
set(extra_binaries_option "-executable=")
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index e80bf0bbac..c4e7e81564 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -2863,6 +2863,20 @@ function(_qt_internal_setup_deploy_support)
endif()
endif()
+ # Generate path to the target (not host) qtpaths file. Needed for windeployqt when
+ # cross-compiling from an x86_64 host to an arm64 target, so it knows which architecture
+ # libraries should be deployed.
+ if(CMAKE_HOST_WIN32)
+ if(CMAKE_CROSSCOMPILING)
+ set(qt_paths_ext ".bat")
+ else()
+ set(qt_paths_ext ".exe")
+ endif()
+ else()
+ set(qt_paths_ext "")
+ endif()
+ set(target_qtpaths_path "${QT6_INSTALL_PREFIX}/${QT6_INSTALL_BINS}/qtpaths${qt_paths_ext}")
+
file(GENERATE OUTPUT "${QT_DEPLOY_SUPPORT}" CONTENT
"cmake_minimum_required(VERSION 3.16...3.21)
@@ -2909,6 +2923,7 @@ set(__QT_DEPLOY_QT_INSTALL_PREFIX \"${QT6_INSTALL_PREFIX}\")
set(__QT_DEPLOY_QT_INSTALL_BINS \"${QT6_INSTALL_BINS}\")
set(__QT_DEPLOY_QT_INSTALL_PLUGINS \"${QT6_INSTALL_PLUGINS}\")
set(__QT_DEPLOY_QT_INSTALL_TRANSLATIONS \"${QT6_INSTALL_TRANSLATIONS}\")
+set(__QT_DEPLOY_TARGET_QT_PATHS_PATH \"${target_qtpaths_path}\")
set(__QT_DEPLOY_PLUGINS \"\")
set(__QT_DEPLOY_MUST_ADJUST_PLUGINS_RPATH \"${must_adjust_plugins_rpath}\")
set(__QT_DEPLOY_USE_PATCHELF \"${QT_DEPLOY_USE_PATCHELF}\")