summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-03-12 11:01:35 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-03-16 17:30:38 +0100
commit1b7008a3d784f3f266368f824cb43d473a301ba1 (patch)
tree253b076320a97443a73e9ab3eace6c72938efd54
parente464e1eb8eb63c631fb0916c3ea4540a88d8aad3 (diff)
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>
-rw-r--r--cmake/QtBuild.cmake34
1 files changed, 8 insertions, 26 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index c32678a5cf..c8163ebdea 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_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"
+ 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")