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>
This commit is contained in:
Joerg Bornemann 2020-07-02 10:57:22 +02:00
parent e278d72192
commit f6a07dfcb7
3 changed files with 20 additions and 1 deletions

View File

@ -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")

View File

@ -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}
")

View File

@ -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@")