diff options
author | Michal Klocek <michal.klocek@qt.io> | 2021-08-20 10:33:57 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2021-08-30 19:47:56 +0200 |
commit | 68e724bf48eab90aca310d700b4aad0127b61d35 (patch) | |
tree | 7ac33f0adf9d38fd4b639ee75192cf8748f9ee8b /src/pdfwidgets | |
parent | add4dd7c1f50e09677f968a47c75309351e16743 (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 'src/pdfwidgets')
-rw-r--r-- | src/pdfwidgets/CMakeLists.txt | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/pdfwidgets/CMakeLists.txt b/src/pdfwidgets/CMakeLists.txt index 04ca1387e..2d2616556 100644 --- a/src/pdfwidgets/CMakeLists.txt +++ b/src/pdfwidgets/CMakeLists.txt @@ -12,4 +12,3 @@ qt_internal_add_module(PdfWidgets Qt::Widgets Qt::Pdf ) -make_install_only(PdfWidgets) |