CMake: Fix Windows VM Test Runs

Simplify the handling of simd specific sources. The previous
implementation was causing simd instructions to bleed into the main
library.

The tests were failing because the avx instruction were leaking into
Qt6Gui due to the previous problem. This in turn caused any test which
required Qt6Gui code run to crash since it is not possible to run avx
instruction in the VMs.

This patch also disables PCH for the simd sources as they result in
warnings related related to using PCH header not compiled for the
architecture in question. The latter can cause the build to fail in
conjunction with warnings as errors.

Change-Id: I1be98f2f5e967f33793d6a2e6134a24ef1709566
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
This commit is contained in:
Leander Beernaert 2020-03-12 11:01:35 +01:00
parent e464e1eb8e
commit 1b7008a3d7

View File

@ -3407,33 +3407,15 @@ function(qt_add_simd_part target)
endif() endif()
string(TOUPPER "QT_CFLAGS_${arg_SIMD}" simd_flags) string(TOUPPER "QT_CFLAGS_${arg_SIMD}" simd_flags)
if (NOT TARGET "${name}") foreach(source IN LISTS arg_SOURCES)
add_library("${name}" OBJECT) set_property(SOURCE "${source}" APPEND
endif() PROPERTY COMPILE_OPTIONS
target_sources("${name}" PRIVATE ${arg_SOURCES}) ${${simd_flags}}
target_include_directories("${name}" PRIVATE ${arg_COMPILE_FLAGS}
${arg_INCLUDE_DIRECTORIES}
$<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>)
target_compile_options("${name}" PRIVATE
${${simd_flags}}
${arg_COMPILE_FLAGS}
$<TARGET_PROPERTY:${target},COMPILE_OPTIONS>)
target_compile_definitions("${name}" PRIVATE
$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>)
target_link_libraries("${target}" PRIVATE "${name}")
# Add a link-only dependency on the parent library, to force copying of framework headers
# before trying to compile a source file.
target_link_libraries("${name}" PRIVATE
$<FILTER:$<TARGET_PROPERTY:${target},LINK_LIBRARIES>,EXCLUDE,^${target}_simd_>)
if(NOT BUILD_SHARED_LIBS)
qt_install(
TARGETS ${name}
EXPORT "${INSTALL_CMAKE_NAMESPACE}Targets"
) )
endif() endforeach()
set_source_files_properties(${arg_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
target_sources(${target} PRIVATE ${arg_SOURCES})
else() else()
if(QT_CMAKE_DEBUG_EXTEND_TARGET) if(QT_CMAKE_DEBUG_EXTEND_TARGET)
message("qt_add_simd_part(${target} SIMD ${arg_SIMD} ...): Skipped") message("qt_add_simd_part(${target} SIMD ${arg_SIMD} ...): Skipped")