CMake: Add QT_CFLAGS_* when building x86simd tests

Change-Id: I5caa088d517cb9d3749c3ed8ef88a41552c1d340
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tobias Hunger 2019-03-12 21:55:58 +01:00 committed by Simon Hausmann
parent fbf98bf255
commit 64147fcb33
3 changed files with 22 additions and 7 deletions

View File

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

View File

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

View File

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