summaryrefslogtreecommitdiffstats
path: root/config.tests
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-03-21 13:14:09 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-03-21 17:47:01 +0000
commitba7c62eed53b2304c54643cbddc29db887fcd869 (patch)
treed2d91e7c3489c576569df8f7aafb97fdace0952e /config.tests
parent25f67fbb073c8bedf26e165f52abacf3e20a6a94 (diff)
Fix sub-architecture (instruction sets / SIMD) handling
In qmake there are at least 2 things to know regarding sub-architectures and instruction sets. Which instruction sets does the compiler know to compile for, represented by the various config.tests and features in qtbase/configure.json. And which instructions sets are enabled by the compiler by default, represented by the configure.json "architecture" test and accessed via QT_CPU_FEATURES.$$arch qmake argument. Before this patch there was some mishandling of the above concepts in CMake code. The former can now be checked in CMake with via TEST_subarch_foo and QT_FEATURE_foo (where foo is sse2, etc). The latter can now be checked by TEST_arch_${TEST_architecture_arch}_subarch_foo (where foo is sse2, etc and the main arch is dynamyicall evaluated). The configurejson2cmake script was adjusted to take care of the above changes, and the cmake files were regenerated as well. Change-Id: Ifbf558242e320cafae50da388eee56fa5de2a50c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'config.tests')
-rw-r--r--config.tests/x86_simd/CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/config.tests/x86_simd/CMakeLists.txt b/config.tests/x86_simd/CMakeLists.txt
index b213cf10fc..b624b7bc95 100644
--- a/config.tests/x86_simd/CMakeLists.txt
+++ b/config.tests/x86_simd/CMakeLists.txt
@@ -4,12 +4,20 @@ project(x86_simd LANGUAGES CXX)
include(../../cmake/QtPlatformSupport.cmake)
include(../../cmake/QtCompilerOptimization.cmake)
+# FIXME: Make the this project handle a list of SIMD entries.
+# FIXME: Make this project handle appending of the cflags (similar to the qmake project).
+# This is needed for the x86SimdAlways configure test (
+# aka we test to see if setting no SIMD (-msse2) cflags at all, will result in their implicit
+# addition by the compiler).
string(TOUPPER "${SIMD}" upper_simd)
if(NOT DEFINED "QT_CFLAGS_${upper_simd}")
- message(FATAL_ERROR "This compiler does not support ${SIMD}.")
+ # Don't use CMake error() because a configure error also fails the try_compile() call.
+ # Instead use a compile flag that doesn't exist to force a compiler error.
+ set(QT_CFLAGS_${upper_simd} "--qt-cflags-not-found")
endif()
add_executable("SimdTest${SIMD}")
target_sources("SimdTest${SIMD}" PRIVATE main.cpp)
target_compile_options("SimdTest${SIMD}" PRIVATE ${QT_CFLAGS_${upper_simd}})
+target_compile_definitions("SimdTest${SIMD}" PRIVATE QT_COMPILER_SUPPORTS_${upper_simd})