diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index 87fe4a55dd..030bcd90c9 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -413,17 +413,16 @@ function(qt_config_compile_test name) endfunction() function(qt_config_compile_test_x86simd extension label) - string(TOUPPER ${extension} extension_uppercase) if (DEFINED TEST_X86SIMD_${extension}) return() endif() - try_compile(TEST_X86SIMD_${extension} "${CMAKE_CURRENT_BINARY_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/x86_simd/main.cpp" - COMPILE_DEFINITIONS -DQT_COMPILER_SUPPORTS_${extension_uppercase} - OUTPUT_VARIABLE foo - ) - set(TEST_subarch_${extension} "${TEST_X86SIMD_${extension}}" CACHE INTERNAL "${label}" ) + try_compile("TEST_X86SIMD_${extension}" + "${CMAKE_CURRENT_BINARY_DIR}/config.tests/x86_simd_${extension}" + "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/x86_simd" + x86_simd + CMAKE_FLAGS "-DSIMD:string=${extension}") + set(TEST_subarch_${extension} "${TEST_X86SIMD_${extension}}" CACHE INTERNAL "${label}") endfunction() function(qt_make_features_available target) diff --git a/cmake/QtPlatformSupport.cmake b/cmake/QtPlatformSupport.cmake index 4f3103e304..45479a3a7e 100644 --- a/cmake/QtPlatformSupport.cmake +++ b/cmake/QtPlatformSupport.cmake @@ -33,6 +33,7 @@ set01(ANDROID_EMBEDDED ANDROID) # FIXME: How to identify this? set01(GCC CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set01(CLANG CMAKE_CXX_COMPILER_ID MATCHES "Clang") set01(ICC CMAKE_C_COMPILER MATCHES "icc|icl") +set01(QCC CMAKE_C_COMPILER MATCHES "qcc") # FIXME: How to identify this? if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(QT_64BIT TRUE) diff --git a/config.tests/x86_simd/CMakeLists.txt b/config.tests/x86_simd/CMakeLists.txt new file mode 100644 index 0000000000..b213cf10fc --- /dev/null +++ b/config.tests/x86_simd/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.14.0) +project(x86_simd LANGUAGES CXX) + +include(../../cmake/QtPlatformSupport.cmake) +include(../../cmake/QtCompilerOptimization.cmake) + +string(TOUPPER "${SIMD}" upper_simd) + +if(NOT DEFINED "QT_CFLAGS_${upper_simd}") + message(FATAL_ERROR "This compiler does not support ${SIMD}.") +endif() + +add_executable("SimdTest${SIMD}") +target_sources("SimdTest${SIMD}" PRIVATE main.cpp) +target_compile_options("SimdTest${SIMD}" PRIVATE ${QT_CFLAGS_${upper_simd}})