summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-07-02 10:57:22 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-07-02 15:35:17 +0200
commitf6a07dfcb792f6311a1648d709759763ce6e4a3f (patch)
tree52b70ab3d558352cba6e5283606ae5ea14fac094 /cmake
parente278d721920c6bf2b05b0fa36e2097f691451a4a (diff)
CMake: Write QT_CPU_FEATURES to qmodule.pri
To achieve this, we save the result of the subarch test in the cache variable TEST_subarch_result and use this value as the right hand side of the QT_CPU_FEATURES.xxx assignment. The Qt6HostInfo package now sets the variable QT6_HOST_INFO_SUBARCHS which will be used for the host_build scope in qmodule.pri when cross-building. Change-Id: I2c25f205bfc0692aef0d6f43ff4e542d27e1b948 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBaseConfigureTests.cmake2
-rw-r--r--cmake/QtBuild.cmake18
-rw-r--r--cmake/QtHostInfoConfig.cmake.in1
3 files changed, 20 insertions, 1 deletions
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake
index ab53ad28b7..8a9392e580 100644
--- a/cmake/QtBaseConfigureTests.cmake
+++ b/cmake/QtBaseConfigureTests.cmake
@@ -72,6 +72,8 @@ function(qt_run_config_test_architecture)
set(TEST_architecture_arch "${_architecture}" CACHE INTERNAL "Target machine architecture")
list(APPEND QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT TEST_architecture_arch)
set(TEST_subarch 1 CACHE INTERNAL "Ran machine subArchitecture test")
+ set(TEST_subarch_result "${_sub_architecture}" CACHE INTERNAL "Target sub-architectures")
+ list(APPEND QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT TEST_subarch_result)
foreach(it ${_sub_architecture})
# Equivalent to qmake's QT_CPU_FEATURES.$arch.
set(TEST_arch_${TEST_architecture_arch}_subarch_${it} 1 CACHE INTERNAL "Target sub architecture result")
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index cc5020fd9b..f27212d4d1 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -1309,7 +1309,23 @@ function(qt_generate_global_module_pri_file)
qt_correct_config(corrected_private_config "${private_config}")
list(JOIN corrected_private_config " " private_config_joined)
- set(content "QT.global_private.enabled_features = ${corrected_enabled_features}
+ set(content "")
+ set(arch "${TEST_architecture_arch}")
+ list(JOIN TEST_subarch_result " " subarchs)
+ if(CMAKE_CROSSCOMPILING)
+ set(host_arch "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_ARCH}")
+ list(JOIN QT${PROJECT_VERSION_MAJOR}_HOST_INFO_SUBARCHS " " host_subarchs)
+ string(APPEND content "host_build {
+ QT_CPU_FEATURES.${host_arch} = ${host_subarchs}
+} else {
+ QT_CPU_FEATURES.${arch} = ${subarchs}
+}
+")
+ else()
+ string(APPEND content "QT_CPU_FEATURES.${arch} = ${subarchs}\n")
+ endif()
+
+ string(APPEND content "QT.global_private.enabled_features = ${corrected_enabled_features}
QT.global_private.disabled_features = ${corrected_disabled_features}
CONFIG += ${private_config_joined}
")
diff --git a/cmake/QtHostInfoConfig.cmake.in b/cmake/QtHostInfoConfig.cmake.in
index cbc2335499..cec9552c77 100644
--- a/cmake/QtHostInfoConfig.cmake.in
+++ b/cmake/QtHostInfoConfig.cmake.in
@@ -17,4 +17,5 @@ set(@var_prefix@TESTSDIR "@INSTALL_TESTSDIR@")
set(@var_prefix@DESCRIPTIONSDIR "@INSTALL_DESCRIPTIONSDIR@")
set(@var_prefix@QMAKE_MKSPEC "@QT_QMAKE_TARGET_MKSPEC@")
set(@var_prefix@ARCH "@TEST_architecture_arch@")
+set(@var_prefix@SUBARCHS "@TEST_subarch_result@")
set(@var_prefix@BUILDABI "@TEST_buildAbi@")