summaryrefslogtreecommitdiffstats
path: root/src/corelib/.prev_CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-02-14 14:53:28 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-02-25 15:43:16 +0100
commit26059d1b9b84bbaaa6c5a50a7dea88ffa9051c5a (patch)
tree8fb5694a33a28771f241db97c8b777ca0f5b9156 /src/corelib/.prev_CMakeLists.txt
parent1b474118326d0cc7a69b20d22d1e52d9ed42c07e (diff)
CMake: Allow building bundled 3rd party libraries in qtbase
A few things are needed to accomplish that: - the python scripts do not ignore certain system_foo features anymore (it is a hardcoded list for now just to be safe) - configurejson2cmake now outputs qt_find_package(WrapSystemFoo) calls for bundled libraries (see below) - the harfbuzz .pro file is modified to accommodate pro2cmake not being able to correctly parse some conditional scopes - the freetype .pro file is modified to make sure linking of the library succeeds without duplicate symbol errors, which qmake doesn't encounter due to magical exclusion of cpp files that are included in other cpp files (presumably for include moc_foo.cpp support) - feature evaluation for Core, Gui, Network now happens in the qtbase/src directory, so that bundled libraries can be conditionally built - for each bundled library there are now two FindWrap scripts: - FindWrapSystemFoo which finds an installed library in the system - FindWrapFoo which either uses the system installed library or the built bundled one depending on a condition - projects that intend to use bundled libraries need to link against WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets (this is handled by pro2cmake). Unfortunately manually added qt_find_package(WrapFoo) calls might still be needed as is the case for WrapFreetype and others. - a new cmake/QtFindWrapHelper.cmake file is added that provides a macro to simplify creation of WrapFoo targets that link against a bundled or system library. The implementation is fairly ugly due to CMake macro constraints, but it was deemed better than copy-pasting a bunch of almost identical code across all FindWrapFoo.cmake files. - a qtzlib header-only module is now created when using bundled zlib, to provide public syncqt created headers for consumers that need them. These are projects that have 'QT_PRIVATE += zlib-private' in their .pro files (e.g. qtimageformats, qtlocation, qt3d, etc.) This is unfortunately needed due to QtNetwork using zlib types in its private C++ API. The change includes support for building the following bundled libraries: - zlib - libpng - libjpeg - Freetype - Harfbuzz-ng - PCRE2 The following 3rd party libraries are still using an old implementation within the CMake build system, and should be migrated to the new one in the near future: - double-conversion - Old harfbuzz The are a few libraries that are not yet ported: - system-sqlite - systemxcb - maybe others Among other things, this change allows building qtbase on Windows without requiring vcpkg. Task-number: QTBUG-82167 Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Diffstat (limited to 'src/corelib/.prev_CMakeLists.txt')
-rw-r--r--src/corelib/.prev_CMakeLists.txt33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/corelib/.prev_CMakeLists.txt b/src/corelib/.prev_CMakeLists.txt
index d92b3272ad..a0b11a7329 100644
--- a/src/corelib/.prev_CMakeLists.txt
+++ b/src/corelib/.prev_CMakeLists.txt
@@ -236,7 +236,6 @@ qt_add_module(Core
../3rdparty/sha3
../3rdparty/tinycbor/src
LIBRARIES
- ZLIB::ZLIB
doubleconversion
PRECOMPILED_HEADER
"global/qt_pch.h"
@@ -306,8 +305,10 @@ endif()
#### Keys ignored in scope 2:.:.:corelib.pro:QT_FEATURE_gc_binaries:
# MODULE_CONFIG = "gc_binaries"
-#### Keys ignored in scope 3:.:.:corelib.pro:NOT QT_NAMESPACE_ISEMPTY:
-# MODULE_DEFINES = "QT_NAMESPACE=$$QT_NAMESPACE"
+qt_extend_target(Core CONDITION NOT QT_NAMESPACE_ISEMPTY
+ PUBLIC_DEFINES
+ QT_NAMESPACE=
+)
qt_extend_target(Core CONDITION ANDROID
SOURCES
@@ -594,6 +595,32 @@ qt_extend_target(Core CONDITION MSVC
"tools/qvector_msvc.cpp"
)
+qt_extend_target(Core CONDITION QT_FEATURE_system_zlib
+ LIBRARIES
+ ZLIB::ZLIB
+)
+
+qt_extend_target(Core CONDITION NOT QT_FEATURE_system_zlib
+ SOURCES
+ ../3rdparty/zlib/src/adler32.c
+ ../3rdparty/zlib/src/compress.c
+ ../3rdparty/zlib/src/crc32.c
+ ../3rdparty/zlib/src/deflate.c
+ ../3rdparty/zlib/src/gzclose.c
+ ../3rdparty/zlib/src/gzlib.c
+ ../3rdparty/zlib/src/gzread.c
+ ../3rdparty/zlib/src/gzwrite.c
+ ../3rdparty/zlib/src/infback.c
+ ../3rdparty/zlib/src/inffast.c
+ ../3rdparty/zlib/src/inflate.c
+ ../3rdparty/zlib/src/inftrees.c
+ ../3rdparty/zlib/src/trees.c
+ ../3rdparty/zlib/src/uncompr.c
+ ../3rdparty/zlib/src/zutil.c
+ INCLUDE_DIRECTORIES
+ ../3rdparty/zlib/src
+)
+
qt_extend_target(Core CONDITION QT_FEATURE_commandlineparser
SOURCES
tools/qcommandlineoption.cpp tools/qcommandlineoption.h