Commit Graph

6 Commits

Author SHA1 Message Date
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexandru Croitor
4f7cc72298 CMake: Handle conditions in third party find modules correctly
Previously the FindWrap modules checked for hardcoded features
when deciding whether to use a bundled library or not. This proved
not to work correctly because features were not available when
the find modules were processed.

Introduce a new CMake API call that needs to be manually called
after an add_subdirectory call which declares a bundled library.

The call will check for the existence of the bundled target, and will
then set a cache variable QT_USE_BUNDLED_Bundled<TargetName>.

The same variable is written into a FindWrapFooConfigExtra.cmake file
which will be loaded by the appropriate FindWrap module. The module
can that use that variable to decided whether to link against the
bundled library or the system library.

Change-Id: I75e9a4f4e14d88d4490916a79ad12f1ce57891e0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-05 16:08:14 +01:00
Alexandru Croitor
26059d1b9b 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>
2020-02-25 15:43:16 +01:00
Cristian Adam
fae5691c7f CMake: Allow build with MinGW and Hunter 3rd party packages
Hunter has recently added aliased target names that conform with upstream
CMake find module target names.

Extended the WrapFreetype to work with Hunter's freetype (lowercase) package
name.

Change-Id: I0e25f342c6930658f07f05d2e6a58cf94d2d168d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 10:12:27 +00:00
Alexandru Croitor
9d96c8da78 Fix freetype target not being found when using vcpkg
vcpkg and upstream CMake find module define different target names for
the same package. To circumvent this, create our own Wrap find module,
and link against it. Inside the find module, try both target names.

Change-Id: Iba488bce0fb410ddb83f6414244f86ad367de72b
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 10:54:15 +00:00