From 1b7008a3d784f3f266368f824cb43d473a301ba1 Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Thu, 12 Mar 2020 11:01:35 +0100 Subject: [PATCH] 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 Reviewed-by: Leander Beernaert --- cmake/QtBuild.cmake | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index c32678a5cf1..c8163ebdea6 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -3407,33 +3407,15 @@ function(qt_add_simd_part target) endif() string(TOUPPER "QT_CFLAGS_${arg_SIMD}" simd_flags) - if (NOT TARGET "${name}") - add_library("${name}" OBJECT) - endif() - target_sources("${name}" PRIVATE ${arg_SOURCES}) - target_include_directories("${name}" PRIVATE - ${arg_INCLUDE_DIRECTORIES} - $) - target_compile_options("${name}" PRIVATE - ${${simd_flags}} - ${arg_COMPILE_FLAGS} - $) - target_compile_definitions("${name}" PRIVATE - $) - - 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 - $,EXCLUDE,^${target}_simd_>) - - if(NOT BUILD_SHARED_LIBS) - qt_install( - TARGETS ${name} - EXPORT "${INSTALL_CMAKE_NAMESPACE}Targets" + foreach(source IN LISTS arg_SOURCES) + set_property(SOURCE "${source}" APPEND + PROPERTY COMPILE_OPTIONS + ${${simd_flags}} + ${arg_COMPILE_FLAGS} ) - endif() + endforeach() + set_source_files_properties(${arg_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE) + target_sources(${target} PRIVATE ${arg_SOURCES}) else() if(QT_CMAKE_DEBUG_EXTEND_TARGET) message("qt_add_simd_part(${target} SIMD ${arg_SIMD} ...): Skipped")