From 9254959ace4594528d9410570f4430e88763024e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 5 Aug 2025 17:05:25 +0200 Subject: [PATCH] CMake: Force build tools when cross-compiling for Windows ARM64 TLDR: We need force cross-build the compilation of WebEngine tools when cross-compiling for Windows ARM64, to ensure that native development on Windows ARM64 hosts can use the WebEngine tools. Long version: We have two packaging configurations for Windows ARM64. 1) we cross-compile 'Windows On Arm' Qt on an x64 Windows host. This configuration includes the WoA WebEngine libraries, but not the tools. 2) we build Windows on Arm Qt on a native arm64 windows host. This currently lacks the WebEngine libraries and tools, because it takes too much time to build them on native arm hosts in the CI. When installing WoA on a Windows host using the Qt online installer, there are three possible scenarios: a) Running the x64 installer on an x64 Windows host, to be able to cross-build projects targeting Windows on Arm. This will install an x64 MSVC host qt, and an arm64 WoA target Qt from case '1' above. The x64 qt includes the WebEngine libraries and tools, and the WoA qt only includes the libraries, but not the tools. For WoA project builds, the build system will use the x64 host tools. This works fine. b) Running the x64 installer on an arm64 Windows host. This is very similar to the 'a' case, except it involves emulation of the x64 host tools. This will install an x64 MSVC host qt, and an arm64 WoA target Qt. The x64 qt includes the WebEngine libraries and tools, and the WoA qt only includes the libraries, but not the tools. For WoA project builds, the build system will use the x64 host tools using /emulation/. This works fine, as long as x64 emulation is available and enabled. c) Running the arm64 installer on an arm64 Windows host. This will install the native arm64 WoA Qt from case '2' above. The arm64 qt includes arm libraries and tools from case '2', but that lacks the WebEngine libraries and tools. So the installer will also install the cross-compiled arm64 WebEngine libraries from case '1', but not the WebEngine tools (e.g. dict conversion tool). To ensure that scenario 'c' also gets WebEngine tools, we need to force build (cross-compile) the tools in scenario '1'. This patch achieves that by passing -DQT_FORCE_BUILD_TOOLS=ON , similar how we do it for yocto builds. Pick-to: 6.9 6.10 Task-number: QTBUG-138859 Change-Id: I8270731a4afef7ab9af8df63326fb838e02968e8 Reviewed-by: Michal Klocek Reviewed-by: Alexey Edelev --- coin/platform_configs/cmake_platforms.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coin/platform_configs/cmake_platforms.yaml b/coin/platform_configs/cmake_platforms.yaml index e187c257..66e5de9a 100644 --- a/coin/platform_configs/cmake_platforms.yaml +++ b/coin/platform_configs/cmake_platforms.yaml @@ -223,11 +223,12 @@ Configurations: Environment variables: [ 'Path={{.Env.MINGW_PATH}}\bin;{{.Env.Path}}', 'TARGET_CONFIGURE_ARGS=-debug-and-release -force-debug-info -platform win32-arm64-msvc -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-psql -no-sql-mimer -no-feature-run-opengl-tests', - 'TARGET_CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_ROOT_DIR_x64_arm64}}', + 'TARGET_CMAKE_ARGS=-DFEATURE_msvc_obj_debug_info=ON -DOPENSSL_ROOT_DIR={{.Env.OPENSSL_ROOT_DIR_x64_arm64}} -DQT_FORCE_BUILD_TOOLS=ON', 'NON_QTBASE_TARGET_CMAKE_ARGS=-DFEATURE_native_grpc=OFF -DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC_ARM64}} -DQT_DEPLOY_FFMPEG=TRUE', 'OPENSSL_CONF_x64={{.Env.OPENSSL_CONF_x64_arm64}}', 'OPENSSL_INCLUDE_x64={{.Env.OPENSSL_INCLUDE_x64_arm64}}', 'OPENSSL_LIB_x64={{.Env.OPENSSL_LIB_x64_arm64}}', + 'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_msvc_arm64}}', 'VCPKG_HOST_TRIPLET=x64-windows-qt', 'VCPKG_TARGET_TRIPLET=arm64-windows-qt', 'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}',