Commit Graph

39951 Commits

Author SHA1 Message Date
Alexandru Croitor
4dacc09921 Save and set the CMAKE_INSTALL_PREFIX in BuildInternal's Config file
Once qtbase is built and installed, save the CMAKE_INSTALL_PREFIX
that was used during the build, and set it when a consumer calls
find_package(Qt5BuildInternals).

This fixes a bug where syncqt can not be found when building qtsvg,
while the developer specifies CMAKE_PREFIX_PATH to find the Qt packages,
but does not set the CMAKE_INSTALL_PREFIX.

Task-number: QTBUG-75544
Change-Id: I03fd23ba418af5115105610f3f9ed92664562945
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-15 17:34:05 +00:00
Alexandru Croitor
9542e78525 Use the qt_build_repo() macros for building qtbase as well
To implement this, create a new Qt5BuildInternals package.

All child Qt modules like qtsvg should use
find_package(Qt5BuildInternals) or
find_package(Qt5 COMPONENTS BuildInternals) in the their
top level CMakeLists.txt.
This will make the qt_build_repo() macros available.

For qtbase we slightly cheat, and specify a CMAKE_PREFIX_PATH
pointing to the source folder that contains the BuildInternals
package.

For the other modules we actually use a configured and installed
package Config file.

This change moves variables that used to be written into the
QtCore Config file into the BuildInternals package. This way
things that are relevant only for building additional Qt modules
does not pollute the QtCore package.

Task-number: QTBUG-75580
Change-Id: I5479adff2f7903c9c2862d28c05c7f485ce3e4eb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-15 17:33:51 +00:00
Alexandru Croitor
c097256ee4 Encapsulate commands for building other repos into two macros
Currently to build qtsvg we have some copy-pasted code to set up
the paths for QtSetup and QtPostProcess to be found.

To make it cleaner, introduce two new macros called
qt_build_repo_begin and qt_build_repo_end(). The first one
should be called in a child repo like qtsvg, right after
a find_package(Qt5) call, and the second one at the end of the
repo top-level CMakeLists.txt file.

In order for the macros to work, extract some of the variables
which were set in Qt5Config into Qt5CoreConfig instead. This
makes sure that it works also for find_package(Qt5Core) calls.

Task-number: QTBUG-75580
Change-Id: I85267c6bd86f9291ec2e170fddab1006ab684b5c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-15 11:40:03 +00:00
Alexandru Croitor
02a015375a Implement developer / non-prefix builds
A non-prefix build is a build where you don't have to run
make install.

To do a non-prefix build, pass -DFEATURE_developer_build=ON when
invoking CMake on qtbase. Note that this of course also enables
developer build features (private tests, etc).

When doing a non-prefix build, the CMAKE_INSTALL_PREFIX cache variable
will point to the qtbase build directory.

Tests can be run without installing Qt (QPA plugins are picked up from
the build dir).

This patch stops installation of any files by forcing the
make "install" target be a no-op.

When invoking cmake on the qtsvg module (or any other module),
the CMAKE_INSTALL_PREFIX variable should be set to the qtbase build
directory.

The developer-build feature is propagated via the QtCore Config file,
so that when building other modules, you don't have to specify it
on the command line again.

As a result of the change, all libraries, plugins, tools, include dirs,
CMake Config files, CMake Targets files, Macro files, etc,
will be placed in the qtbase build directory, mimicking the file layout
of an installed Qt file layout.

Only examples and tests are kept in the separate module build
directories, which is equivalent to how qmake does it.

The following global variables contain paths for the
appropriate prefix or non prefix builds:
QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR,
QT_CONFIG_INSTALL_DIR. These should be used by developers
when deciding where files should be placed.

All usages of install() are replaced by qt_install(), which has some
additional logic on how to handle associationg of CMake targets to
export names.

When installing files, some consideration should be taken if
qt_copy_or_install() needs to be used instead of qt_install(),
which takes care of copying files from the source dir to the build dir
when doing non-prefix builds.

Tested with qtbase and qtsvg, developer builds, non-developer builds
and static developer builds on Windows, Linux and macOS.

Task-number: QTBUG-75581
Change-Id: I0ed27fb6467662dd24fb23aee6b95dd2c9c4061f
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-15 11:31:31 +00:00
Albert Astals Cid
6396d46f55 cmake: Correct way to save/restore env vars
for pkgconfig it is different if they are not defined vs an empty string

Change-Id: Ifb05db5dab32a699aafa32d91f9719eab78dee44
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-10 16:33:15 +00:00
Tobias Hunger
400f94109d CMake: Wrap DBus1 find_package call to fix xproto not being picked up
DBus1 (1.12) configuration file breaks PKG_CONFIG environment
variables and will thus prevent other libraries to be picked up
by pkgconfig. Main sympthom is that xproto is not getting picked
up anymore, which results in hundreds of lines of warnings about
this being printed.

Work around that by wrapping the call to find_package(DBus1) and
restoring the environment.

Change-Id: Ia69f10b014dddc32045b40972500a843e5d29b38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-10 15:09:49 +00:00
Liang Qi
263af45b4c Move build and test instructions from coin to qtbase
That way we can update instructions without waiting for
Coin update.

The patch contains invalid test instructions, but as
cmake port is not yet able to run tests it should not
matter.

Change-Id: I86088aefec49ded60af00243b0b8c60c8f16147a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-05-10 13:38:13 +00:00
Tobias Hunger
e9085f4162 CMake: pro2cmake.py: Add target_link_libraries to examples
Change-Id: Ic7054f0c88e228496b7f4855bffa5620ed717f9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 13:14:45 +00:00
Tobias Hunger
35ed41e547 CMake: pro2cmake.py: Generate find_package information into examples
Change-Id: I6dab13ebea4386019f14be5f29a143d194268aac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 13:14:37 +00:00
Alexandru Croitor
bc4687f5bb Keep "special case" modifications when regenerating project files
The pro2cmake.py file is now smarter, and can reapply "special case"
modifications after regenerating a CMakeLists.txt file.

This substantially lowers the maintenance burden when regenerating
many files at once.

See the special_case_helper.py file for details on how it works.

Make sure to commit the generated .prev_CMakeLists.txt file alongside
your CMakeLists.txt changes.

To disable the preservation behavior, you can pass -s or
--skip-special-case-preservation to the script.

To keep around temporary files that are created during this process,
you can pass -k or --keep-temporary-files.

To get more debug output, pass --debug-special-case-preservation.

Fixes: QTBUG-75619
Change-Id: I6d8ba52ac5feb5020f31d47841203104c2a061d8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-09 11:29:54 +00:00
Tobias Hunger
862ebbf7ea CMake: scripts: Extract code to write find_package lines
Extract code to write find_package lines from configurejson2cmake.py
and move this over into helper.py.

Change-Id: Iefd313b2a56cb78a99a7f3151c3f6c6284482f79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 11:29:35 +00:00
Tobias Hunger
80e0c615a9 CMake: pro2cmake.py: Separate library extraction logic from writing out data
Separate the logic to find all used libraries from the code that writes out
the link_library information into the CMakeLists(.gen)?.txt files.

This patch will remove some "PUBLIC_LIBRARIES Qt::Core" from generated files.
This is due to us handling some Qt libraries in special ways in some of our
add_qt_* helpers. These special libraries were added to the LIBRARIES section,
but actually they should be added to the PUBLIC_LIBRARIES section instead. Do
so now, so that the newly generated files do not break things again.

Change-Id: I588781087a8aecc4d879e949735671d8085f0698
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 11:29:25 +00:00
Tobias Hunger
c4dd1a8fe3 CMake: pro2cmake.py: Extract writing lists into cmake files
Extract the actual functionality to write a list of "things" below
headers and/or cmake parameter and followed by a footer.

Reuse this functionality everywhere we write a list of things.

Change-Id: Ia7647be465b4788a2b1e6a5dbede1ca868f24ae2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:38:17 +00:00
Tobias Hunger
ee3d9a8b67 CMake: scripts: Fix mypy issues
Change-Id: I706740be79eccd6bf08213fdaf747dde08cd053a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:37:58 +00:00
Tobias Hunger
5608bf3cba CMake: pro2cmake.py: Add basic support for examples
Examples need to be built stand-alone and as part of Qt, so they
need a special CMakeLists.txt file that supports both use-cases.

Add an --is-example switch to pro2cmake to make it generate these special
CMakeLists.txt files.

This is basic support only and is currently still missing the necessary
find_package calls.

Change-Id: Ie770287350fb8a41e872cb0ea607923caa33073d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:37:42 +00:00
Tobias Hunger
5c98110fca CMake: Fix up after WrapFreetype introduction
Change-Id: I05ca6f8b055f470101ff0dcd1720a349a87e4ba9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-08 12:49:55 +00:00
Alexandru Croitor
0efe6fc90f Don't link against dbus-1_nolink when dbus_linked feature is off
dbus1_linked is only evaluated to true when the dbus package is found.
If it was not found, then it makes no sense to link against the
_nolink target, because no package was found in the first place.

When the package is not found, QtDBus uses a minimal dbus header which
is included with QtDBus sources, so there is no need for the _nolink
target.

This amends cc141cc5c6 and fixes a build
failure on macOS.

Change-Id: I71dcbb7465ad13b0bf03579f51412c373125caba
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-08 12:32:53 +00:00
Tobias Hunger
0c498ef4ff CMake: pro2cmake.py: Do not fail when run from .pro-file directory
Change-Id: I285b05986e3a58efc060ca0b5732f6e3f5121476
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-08 11:25:58 +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
Tobias Hunger
e8bb673301 CMake: Regenerate xcb platform plugin
This contains fixes to the improved library detection recently introduced.

Change-Id: I5df03b0c965dd0b8cf4b1769c752ecbb81558265
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 17:10:20 +00:00
Tobias Hunger
aa8af1283f CMake: Do not require ATSPI2 in platformsupport/linuxaccessibility
Change-Id: I3796ab3eb51306eec67460214c20a3c1c160edee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 17:08:47 +00:00
Alexandru Croitor
aed2c1f5ae Force pro2cmake.py to always change the dir to the converted pro file
Otherwise if you call the script from a different directory, path
handling becomes broken and certain files are not found.

Change-Id: Ia2f60abbd312a771330b3d5e928e1ccd0b4a845b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-07 17:08:28 +00:00
Tobias Hunger
cc141cc5c6 CMake: Fix dbus build after dbus library detection update
Change-Id: If4d773136b1aa01204e012c6900458673a4c5670
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 15:07:07 +00:00
Tobias Hunger
5ec3baa67a CMake: scripts: Make xcb_qpa_lib known as a Qt module
Change-Id: I65f48d86c4ec946b38004b945078f29625e32d93
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 14:45:22 +00:00
Tobias Hunger
d5018720db CMake: scripts: Treat libraries mapped to None as known
This detects doubleconversion as a 3rd party library.

This fixes defaulting QT_FEATURE_system_doubleconversion to 'ON'.

Change-Id: I9d18dbbb6f7a99f6a5c674bed3013b96f19bf6e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 14:41:31 +00:00
Tobias Hunger
bbe5c58079 CMake: Fix src/plugins/bearer
Sorry, last-minute-typo hit again:-/

Change-Id: I7130ba3306a96584e2bc33bc1aa27990a3508035
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-05-07 12:41:22 +00:00
Alexandru Croitor
97600f5562 Fix special cases in corelib
Change-Id: I506f379245619c8b5d248ea27dba35a165b455ee
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-06 14:54:14 +00:00
Alexandru Croitor
e6b7a3e459 Fix special cases in gui
Change-Id: I9553f1443a772c45748fafca079eaad2bf8cf1de
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-06 14:54:08 +00:00
Tobias Hunger
b65e7b2ffe CMake: Regenerate src/plugins/imageformats
Change-Id: Iea0f1b5f51508b7e8c2cad405dd3e293186c583a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:46:16 +00:00
Tobias Hunger
0434b7fb38 CMake: Regenerate src/plugins/bearer
Change-Id: I6c900247eb03b8afc3f299b5dbca5bac64527a52
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:46:11 +00:00
Tobias Hunger
9ffcc76188 CMake: Scripts: Fix double entries in 3rd party library mapping
Change-Id: I35f29876874d6083d19382800d194e417d57bca1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:29:20 +00:00
Tobias Hunger
aba911c4d0 CMake: Regenerate src/platformsupport/kmsconvenience
Change-Id: I2608275ca7cd5315e7ffdffbb25f78e98fbf9bc3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:29:11 +00:00
Tobias Hunger
d1a0af9b0c CMake: Regenerate src/platformsupport/platformcompositor
Change-Id: I435fb110ad59eb197401c6d8090c697ceb4cf687
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:28:45 +00:00
Tobias Hunger
1e5c90e6e2 CMake: Regenerate src/plugins
Change-Id: I64f920e909de7c612e3ab18b8aa31b98e0e1acfd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:27:43 +00:00
Tobias Hunger
b15776c76f CMake: Regenerate platformsupport/windowsuiautomation
Change-Id: I17c927cf7eb8c66ee941a2d91c918e105474da29
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:27:34 +00:00
Tobias Hunger
cbaa8ee27d CMake: Regenerate platformsupport/vkconvenience
This does not link to vulkan, just as it did before. Feels wrong...

Change-Id: I7e76e03e95ed33421de684f51c9943a84dde7779
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:27:24 +00:00
Tobias Hunger
ef170a12d8 CMake: Regenerate platformsupport/themes
Change-Id: Ica4b4c3f2a5f86476f179a01aea5eeb25e617a98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:27:08 +00:00
Tobias Hunger
9b7f5776ee CMake: Regenerate platformsupport/services
Change-Id: I73444aeef2e37ebb2f90e8bae3e6932989bad5f0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:26:58 +00:00
Tobias Hunger
3d452d7c3b CMake: Regenerate platformsupport/linuxaccessibility
Use ATSPI with nolink!

Change-Id: I334fa93364109ca04b4312d12ddcea34d9e9a103
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:26:49 +00:00
Tobias Hunger
5d374083b7 CMake: Regenerate platformsupport/graphics
Change-Id: Ifff85f70de092ade438430d71d9a149f49363c14
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:24:51 +00:00
Tobias Hunger
775e595642 CMake: Regenerate platformsupport/fontdatabases
This one does actually contain functionality changes, but those look OK to me.

Change-Id: I5fd2caee16da86c529e1c83ca66452f780e54e26
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:24:42 +00:00
Tobias Hunger
f8d3b60fb1 CMake: Regenerate platformsupport/fbconvenience
Change-Id: Ic838debdca48553252cb4c32ec8a42695ba24b46
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:24:28 +00:00
Tobias Hunger
a7fc360b22 CMake: Regenerate platformsupport/eventdispatchers
Change-Id: Ie9cbee3fcb58673c08e8378382dd45e61fc4ff01
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:24:19 +00:00
Tobias Hunger
46b1676804 CMake: Regenerate src/platformsupport/edid
Change-Id: Id567354daa47c0be07211ebf01f92cd01be9a5c7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:24:06 +00:00
Tobias Hunger
c29fe1fae2 CMake: Regenerate src/platformsupport/devicediscovery
Change-Id: Ia306a7197c10fffb520e90eead449c551f0dfbe8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:23:55 +00:00
Tobias Hunger
65c5ffdb1d CMake: Regenerate src/platformsupport/clipboard
Change-Id: I6e61274a2f5796a6b4ddcbbdf03c345a03e4b91a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:23:44 +00:00
Tobias Hunger
f02a9c81ad CMake: Regenerate src/platformsupport/accessibility
Change-Id: Ie250afa3b4dc6c5750dd3cd15c1e83edcb7e0734
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:23:33 +00:00
Tobias Hunger
59e32c4e23 CMake: Regenerate src/platformsupport
Change-Id: I883573633dbd82ebcca9cc0dc435cd867cec24b8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:23:19 +00:00
Tobias Hunger
e438747eb1 CMake: Regenerate src/concurrent
Change-Id: I888f0a3821c091180928949bd52ea70a1be69d3f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:23:08 +00:00
Tobias Hunger
da02d17b5e CMake: Regenerate src/platfomheaders
Change-Id: I82d94c0f53bf3291cd26188ab6afd78493f2b92c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:22:57 +00:00