diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake index 8c2baeac0e..6a94515e60 100644 --- a/cmake/QtAutoDetect.cmake +++ b/cmake/QtAutoDetect.cmake @@ -441,6 +441,15 @@ function(qt_auto_detect_pch) option(BUILD_WITH_PCH "Build Qt using precompiled headers?" "${default_value}") endfunction() +function(qt_auto_detect_win32_arm) + if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "win32-arm64-msvc") + set(CMAKE_SYSTEM_NAME "Windows" CACHE STRING "") + set(CMAKE_SYSTEM_VERSION "10" CACHE STRING "") + set(CMAKE_SYSTEM_PROCESSOR "arm64" CACHE STRING "") + endif() +endfunction() + + qt_auto_detect_cmake_generator() qt_auto_detect_cyclic_toolchain() qt_auto_detect_cmake_config() @@ -451,3 +460,4 @@ qt_auto_detect_android() qt_auto_detect_vpckg() qt_auto_detect_pch() qt_auto_detect_wasm() +qt_auto_detect_win32_arm() diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake index f4ee35be31..2f4c23eb1e 100644 --- a/cmake/QtToolchainHelpers.cmake +++ b/cmake/QtToolchainHelpers.cmake @@ -46,6 +46,12 @@ function(qt_internal_create_toolchain_file) "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")") endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND CMAKE_SYSTEM_VERSION STREQUAL "10") + list(APPEND init_platform "set(CMAKE_SYSTEM_NAME Windows CACHE STRING \"\")") + list(APPEND init_platform "set(CMAKE_SYSTEM_VERSION 10 CACHE STRING \"\")") + list(APPEND init_platform "set(CMAKE_SYSTEM_PROCESSOR arm64 CACHE STRING \"\")") + endif() + # By default we don't want to allow mixing compilers for building different repositories, so we # embed the initially chosen compilers into the toolchain. # This is because on Windows compilers aren't easily mixed. diff --git a/coin/instructions/coin_module_build_template_v2.yaml b/coin/instructions/coin_module_build_template_v2.yaml index 731f19c648..9240842bb0 100644 --- a/coin/instructions/coin_module_build_template_v2.yaml +++ b/coin/instructions/coin_module_build_template_v2.yaml @@ -21,6 +21,9 @@ instructions: - condition: property property: target.osVersion not_in_values: [QEMU, WebAssembly] + - condition: property + property: features + not_contains_value: "TargetBuildOnly" - type: Group instructions: - !include "{{qt/qtbase}}/cmake_cross_compilation_module_build_instructions.yaml" @@ -33,6 +36,16 @@ instructions: # We don't currently build tests for Android other than qtbase repo in_values: [QEMU] enable_if: - condition: property - property: target.osVersion - in_values: [IOS_ANY, Android_ANY, QEMU, QNX_710, WebAssembly] + condition: or + conditions: + - condition: property + property: target.osVersion + in_values: [IOS_ANY, Android_ANY, QEMU, QNX_710, WebAssembly] + - condition: and + conditions: + - condition: property + property: host.compiler + equals_value: MSVC2019 + - condition: property + property: target.arch + equals_value: ARM64 diff --git a/coin/instructions/coin_qtbase_build_template_v2.yaml b/coin/instructions/coin_qtbase_build_template_v2.yaml index 3f6c09524f..1df85b6874 100644 --- a/coin/instructions/coin_qtbase_build_template_v2.yaml +++ b/coin/instructions/coin_qtbase_build_template_v2.yaml @@ -14,6 +14,9 @@ instructions: - condition: property property: target.osVersion not_in_values: [QEMU, WebAssembly] + - condition: property + property: features + not_contains_value: "TargetBuildOnly" - type: Group instructions: - !include "{{qt/qtbase}}/cmake_cross_compilation_qtbase_build_instructions.yaml" @@ -25,6 +28,16 @@ instructions: property: target.osVersion in_values: [Android_ANY, QEMU] enable_if: - condition: property + condition: or + conditions: + - condition: property property: target.osVersion in_values: [IOS_ANY, Android_ANY, QEMU, QNX_710, WebAssembly] + - condition: and + conditions: + - condition: property + property: host.compiler + equals_value: MSVC2019 + - condition: property + property: target.arch + equals_value: ARM64 diff --git a/coin/instructions/prepare_building_env.yaml b/coin/instructions/prepare_building_env.yaml index e389b6c1db..22669d6e50 100644 --- a/coin/instructions/prepare_building_env.yaml +++ b/coin/instructions/prepare_building_env.yaml @@ -93,6 +93,13 @@ instructions: - condition: property property: host.arch equals_property: X86_64 + - type: EnvironmentVariable + variableName: TARGET_ARCHITECTURE + variableValue: x64_arm64 + enable_if: + condition: property + property: target.arch + equals_value: ARM64 - type: EnvironmentVariable # HACK. Overwrite TARGET_ARCHITECTURE as we do not use standard MSVC cross # compilation targets here. The target architecture will be detected by Qt. @@ -259,6 +266,22 @@ instructions: property: target.osVersion equals_value: QEMU + # Windows on Arm, cross-compilation with MSVC + - type: Group + enable_if: + condition: and + conditions: + - condition: property + property: host.compiler + equals_value: MSVC2019 + - condition: property + property: target.arch + equals_value: ARM64 + instructions: + - type: EnvironmentVariable + variableName: TARGET_ENV_PREFIX + variableValue: "c:\\users\\qt\\prefix.bat" + # QNX variables - type: Group enable_if: @@ -292,4 +315,3 @@ instructions: property: host.os equals_value: Linux -