summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-08-20 10:33:57 +0200
committerMichal Klocek <michal.klocek@qt.io>2021-08-30 19:47:56 +0200
commit68e724bf48eab90aca310d700b4aad0127b61d35 (patch)
tree7ac33f0adf9d38fd4b639ee75192cf8748f9ee8b /tests/CMakeLists.txt
parentadd4dd7c1f50e09677f968a47c75309351e16743 (diff)
Rewrite gn-cmake integration
The previous gn-cmake integration was driven towards having the complete cmake build tree which included gn build artifacts. These were marked as IMPORTED in cmake build files, this way cmake "knew" all object files and static libs coming from gn. To achieve that we needed to run the cmake configure twice. First to feed gn with the build information from cmake and then the second run to import all the build information to cmake based on gn run. As a side effect of this the first run cmake was creating incomplete targets, so we could use generator expressions to gather all the data needed for gn run. The second run of cmake was able to create fully initialized targets. We used 'external project' to run cmake the second time. This approach worked well when doing "module" builds and having two targets, one in the main project and one in external was not an issue. Moreover, this approach could be integrated nicely since CI does only "module" builds. Unfortunately "top level" builds are implemented to import all qt targets into one build tree. This created issue for qtwebengine since fully initialized targets were 'hidden' by 'external project' and including half baked (dummy) targets from the main project resulted in bunch of issues related to the dependency tracking and build race conditions. Also using 'external project' complicated installation rules and in the end installation worked differently than in other modules. With current approach we use response files, so we hide all build artifacts coming from gn and feed cmake with those response files. This way we run the cmake configure once and we create all the targets once. Using rsp files hacks linker options in cmake, so this approach is sub-optimal, however allows to have working "top level" builds. It is worth mentioning here that the final module linking has to take place with cmake's part of build since doing one static lib in gn is not possible due to the toolchain limitation (msvc is not able to process static libs over 4Gb and has no support for thin archives, so only a shared lib is doable at time of writing) Following changes are made: * remove 'external project' for qtwebengine target, we keep it however for ninja ,gn and a host project * call gn from cmake in a scripting mode during build and not configure run, this way BUILD.gn is assembled as a build step so after generator expressions are executed * BUILD.gn is assembled now from 4 files: - root template BUILD.root.gn.in - compiler data gn_config_c.cmake, gn_config_cxx.cmake - sources data gn_cofnig_target.cmake * since we use gn wrapper script use gn.args file to pass arguments instead of a command line, so this file can be now easily modified when running gn and ninja 'manually' * since a script mode does not support handling of properties with TARGET as such, use the DIRECTORY scope in some of our functions which handle GN_TARGET * use qt_build_repo() in main CMakeFile and remove all coin and top level build hacks * remove 'external project' for examples and tests, this is no longer required as all qt targets are not hidden by external project * remove leftovers from gn feedback call used for GN_TARGET * improve installation rules, WebEgineCore target is not by default installed during build, therefore we need to copy resources and translations to root so tests and examples still can be built without a module being installed first * adjust GN lookup paths, we look for gn in main configure and during scripting mode when gn is executed Fixes: QTBUG-94349 Fixes: QTBUG-94709 Fixes: QTBUG-94922 Fixes: QTBUG-94997 Fixes: QTBUG-95051 Fixes: QTBUG-95152 Fixes: QTBUG-95158 Fixes: QTBUG-95972 Task-number: QTBUG-95231 Task-number: QTBUG-95590 Change-Id: I5e7a34287ee59d904103fe310fc7c6a36a8dfbc9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit bd75c51f2a7f7384d3303e86764211cb3e32f03d)
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt29
1 files changed, 1 insertions, 28 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ace11de4a..a8f031a5d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,28 +1 @@
-if(NOT QT_BUILD_STANDALONE_TESTS)
- cmake_minimum_required(VERSION 3.19)
-
- include(${CMAKE_CURRENT_LIST_DIR}/../.cmake.conf)
-
- project(QtWebEngineTests
- VERSION "${QT_REPO_MODULE_VERSION}"
- DESCRIPTION "Qt WebEngine Tests"
- HOMEPAGE_URL "https://qt.io/"
- LANGUAGES CXX C
- )
-
- # Make sure we use the fixed BASE argument of qt_add_resource.
- set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
-endif()
-
-find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
-find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Gui Widgets
- WebEngineCore WebEngineWidgets WebEngineQuick Pdf QuickWidgets Test QuickTest WebSockets
-)
-
-if(NOT QT_BUILD_STANDALONE_TESTS)
- qt_build_repo_begin()
- qt_build_tests()
- qt_build_repo_end()
-else()
- qt_build_tests()
-endif()
+qt_build_tests()