Commit Graph

40618 Commits

Author SHA1 Message Date
Simon Hausmann
a6c11d3e09 Add support for private module .pri files
Generate a pri file for public and private interfaces, but map CONFIG +=
internal_module to a cmake option and skip the former if set.

Task-number: QTBUG-75666
Change-Id: I3f4baf1277094f4c22149a9e8769734baf9a235f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 14:39:11 +00:00
Cristian Adam
2fb7cca6ba CMake: Compile fix for MinGW 8.1.0
Change-Id: I4e484619421812ae83da1382938c527ad67382e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 14:31:51 +00:00
Leander Beernaert
04da0df568 Android: SDK Support
Enable building androiddeployqt when performing host builds only.
Added QtPlatformAndroid.cmake to locate Java and the setup the
android SDK platform when building on android.
Install the androiddeployqt support files when performing a host
build.
Added ANDROID_SDK_ROOT configuration variable for specifying the
android sdk directory.
Generating the deployment-settings.json will be done in another
change.

Change-Id: I1bf15315af4ed904d2fb1d22b0e8e834df32d6ed
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 14:20:31 +00:00
Simon Hausmann
bc9409d857 Re-generate the CMakeLists.txt and add the prev files
Change-Id: I93ea196bdd5807bccebf81e72332966288a35a4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 14:20:26 +00:00
Cristian Adam
9298033ed6 CMake: Add WinMain support
Change-Id: I85c56555bc47dcf348daeb3435c621529aa2d381
Fixes: QTBUG-75195
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 14:06:09 +00:00
Kevin Funk
016351d267 Fix typo: PROJECT_MAJOR_VERSION does not exist
Change-Id: I0e0783d615aa2f875f4dbe492e67f1e4366b7371
Reviewed-by: Volker Krause <volker.krause@kdab.com>
2019-06-05 13:38:53 +00:00
Kai Koehne
6e0f48a993 CMake: Also bump to CMake 3.15 in README
Amends fecd9d90da

Change-Id: I5373844515c83d218f840b3277ac2c49f318620e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 13:23:15 +00:00
Kai Koehne
4e62517b9e CMake: Disable autotests for non-developer builds
Mimic the behavior in the qmake build system, and by default build
tests for developer-build, and not build it for a normal build.

To do this, we define BUILD_TESTING with the right default before
including CTest, which does otherwise define the option itself.

Change-Id: Ifa1b1156477919abc1e916ccd9e1e0a74e969ee6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 13:22:07 +00:00
Alexandru Croitor
81fee7732d Add AppleClang as exception for warnings as errors for md4c library
Change-Id: Ia7dd9bfb622b80b18fa7323de5188dc50e4fca78
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 13:18:52 +00:00
Albert Astals Cid
5fea9f8f52 cmake: Add warnings_are_errors option
for modules, plugins and tools only (i.e. no tests nor examples)
this mimics the qmake behavior

default value is developer_build

Comes with some fixes in qmake since it seems in the qmake built it was
not having Werror, now does because we built it with add_qt_tool

Change-Id: I6f3237f25a6fedefa958644929e90f13837a12df
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 13:10:16 +00:00
Kai Koehne
e5d6640692 Cmake: Disable warnings when building Qt plugins
This mirrors what happens for qmake. qt_plugin.prf does not
define these, but qt_module.prf does.

Change-Id: I742d3c766f6f4bd129fa6ccf85b5a67c6758e819
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 13:03:40 +00:00
Kai Koehne
019dac8f9d Set QT_DEPRECATED_WARNINGS_SINCE also for CMake
This was added to the qmake build system in 220028d37c

Change-Id: Ieee8b4d47b8f9716c14c85cf3038f1074ee8c46a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 13:03:29 +00:00
Kevin Funk
99539a2894 Allow to build examples as standalone project
Create CMake config files which can be used from the very same CMake
project. These CMake config files simply do not create any targets,
controlled via the QT_NO_CREATE_TARGETS.

This patch also allows to build qtbase.git:examples as a standalone
project, against an already-built Qt.

Ran this:
  ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example

Task-number: QTBUG-74713
Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 12:53:28 +00:00
Alexandru Croitor
ace5495870 Fix a few of the Wrap modules to protect against double creation of
targets. This created issues when trying to build standalone examples.

Change-Id: Iaaea2b537793ae25fbf3143cc205574446aa4ad1
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-06-05 12:30:47 +00:00
Cristian Adam
37467028bb CMake: Fix qt_find_package PROVIDED_TARGETS check
Change-Id: Ia551dcbca2d881f8bac36158abb0ac60b79f16f0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:54:52 +00:00
Albert Astals Cid
ddd7af87ef Update .prev cmake files
Change-Id: I440a3cb0288670424cf20c5d56e641a6741fee91
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:52:46 +00:00
Alexandru Croitor
3e93cc1044 Regenerate cocoa qpa plugin
Change-Id: Ie8838846e758542b3ae18cbda00c0a54cb6c5f49
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:47:54 +00:00
Cristian Adam
527f3bb31c CMake: Add WrapPCRE2 package
The WrapPCRE2 package handles the PCRE2 packages that have targets,
and reuse them.

Change-Id: I24b0b51f507703cd8287f845f7e425f62dd2c3d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:42:55 +00:00
Albert Astals Cid
eda3421111 cmake: Replace - with _ in define module names
Otherwise when compiling qxcb-glx-integration we would get a warning like
   <command-line>: warning: ISO C++11 requires whitespace after the macro name
because -DQT_BUILD_QXCB-GLX-INTEGRATION_LIB is not a valid define name

Change-Id: Ie8cef93a47b14d75eaad77893f7182e1514dd616
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:38:08 +00:00
Simon Hausmann
38cd18384f Fix OpenGL vs. GLESv2 linkage, attempt number three
We introduced WrapOpenGL to link against either desktop GL or GLESv2
depending on the GL feature in QtGui. This works "fine", with two
caveats:

    (1) find_package(WrapOpenGL) must be called after
    find_package(Qt5Gui) in order for the feature check in
    FindWrapOpenGL.cmake to work. That's error prone.

    (2) More and more places are popping up, in particular examples,
    where GL linkage is required due to inline functions in Qt that
    forward to GL functions - such as on Android.

    This in particular explains the qmake behavior of making the GL
    linkage (desktop _or_ GLES) a public dependency of QtGui, so only
    Gui linkage is required.

Those two aspects combined are the nail in the coffin of FindWrapOpenGL
and it would seem much easier to simply make the Desktop GL vs. GLES
decision once in Gui's CMakeLists.txt and let Qt5GuiDependencies.cmake
propagate this well. This allows us to get rid of plenty of special
cases as well.

Change-Id: I3a7e8af49537ce5f215f24470e075a4ae9aeb944
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:38:02 +00:00
Jean-Michaël Celerier
2eeba9f55f cmake: don't add install-time include directories when there are none
Change-Id: I380218191139fe514ddac598992b1ba27ac33a41
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:21:22 +00:00
Alexandru Croitor
2401435d89 Map module.gui to if TARGET Qt::Gui in configure.cmake
Some features check for module / target existence. Adapt conversion
script to handle that.

Reland after fixing it.

Change-Id: If4fb942c2e0d16e76a0b9b767bf478527851b0f7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:15:04 +00:00
Albert Astals Cid
bfa209dfa5 cmake: build with exceptions disabled by default
Only re-enable exceptions for the modules that do
CONFIG+=exceptions
in qmake

Change-Id: I9f19078adbdc1b8fa3d4102fb51a099e7e35522e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:10:51 +00:00
Jean-Michaël Celerier
fecd9d90da Fix static usage requirements for XcbQpa
In particular, Qt targets extended with other qt targets
(eg. Qt::VulkanSupport or Qt::LinuxAccessibilitySupport)
after the first add_qt_module were not taken into account when generating
Depends files.

Note that this patch updates the minimum required version
to CMake 3.15

Change-Id: I747deedd4d59e385876bc1a834ef9bdb6078911b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 08:53:34 +00:00
Simon Hausmann
c220974ed8 Fix linkage of QtWidgets on Android
On Android, the OpenGL dependency is unfortunately a public dependency
in QtGui.

Change-Id: I50847891ba55c4646078b02e3aacf14823daf1d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 08:38:44 +00:00
Alexandru Croitor
9ad193cc3d Fix write_all_source_file_lists type annotation
Change-Id: I6e22d21562a0923079b90cf9b3e6d15dfe16ff29
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-05 08:36:51 +00:00
Alexandru Croitor
38b7ee3533 Revert "Map module.gui to if TARGET Qt::Gui in configure.cmake"
It breaks some conditions, and then the build fails not finding
some private header files in qpa, etc.

This reverts commit 35dc8f496d.

Change-Id: I1b51eac06fe9186181d3f0a7c78f22da7be534e2
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-05 08:33:21 +00:00
Alexandru Croitor
35dc8f496d Map module.gui to if TARGET Qt::Gui in configure.cmake
Some features check for module existence. Adapt conversion script
and QtBuild feature condition parser to handle that.

Change-Id: I063e49a6fe9f8e9cf3aec985fd78ed4430398586
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 08:13:42 +00:00
Alexandru Croitor
d0eb985f74 Improve run_pro2cmake.py
Add two new options:

If you pass --only-existing, the pro2cmake script will only be
executed on .pro files that already have a CMakeLists.txt next
to them. This is useful if you modify pro2cmake, and only want
to regenerate existing files.

If you pass --only-qtbase-main-modules, the script will be
executed on the main modules in qtbase/src. This is useful
if you want to check if your pro2cmake modification
works correctly on the more complicated projects.

Change-Id: I5228411a252dbef6d77f01ca742a7b98583c5a75
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-05 07:41:46 +00:00
Alexandru Croitor
891c897b80 Regenerate the main qtbase modules
There were some changes done in pro2cmake, so regenerate the main
qtbase modules to keep everything up to date.

Some new whitespace got added.
Some special cases were removed (ZLIB).
Some opengl code got moved around.
Some plugin types were added.
And some other minor things.

Change-Id: Ie8cba4a9aa6b4b163c39d6cf546ea9e0bfc05c01
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 07:39:14 +00:00
Alexandru Croitor
9231204e2c Fix extra_keys in write_all_source_file_lists to be optional
Initially it was added as a required argument, but not all usages of
the function where adjusted, so the script failed. Make it optional.
Also change the styling of the argument to be snake cased.

Amends 8fea3ec4e7.

Change-Id: I568800401bb5af153b7bb5229f134c2f74b87468
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-05 07:39:10 +00:00
Albert Astals Cid
003e0bb8ff cmake: tweak largefile defines
so they are actually set for all the targets
and that the code is a bit simpler

Change-Id: I2cd253d0a3cec3f482b868f81e852edfa158d3f1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 06:57:33 +00:00
Alexandru Croitor
b64e8e721f Fix special_case_handler to handle git add prev_CMakeLists.txt better
When using run_pro2cmake.py, it spawns multiple instances of
pro2cmake.py.
If more than 1 of the instances need to git add prev_CMakeLists.txt at
the same time, git add might fail due to the acquired index.lock.

The cleaner solution would be to use a file lock as a mutex, but that
requires an external pypi package.

Use a poor man solution of retrying the git add with a time delay for a
finite amount of times.

Change-Id: I2031f6e29ae499526cb4f1753e4387e7f4fab0ab
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 20:46:45 +00:00
Alexandru Croitor
63f2b8c7a8 Include the .prev_CMakeLists.txt files for selftests
This will help with future regeneration.

Amends 6d1c695b0e

Change-Id: I2454dc36cfc00f7aad72488fb7927d7807978fd8
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 20:19:32 +00:00
Alexandru Croitor
8842cb5337 Improve special_case_helper.py
Make sure to set the author user and email for the temporary git repo,
so that the commits succeed on systems that don't have a global git
author.

Also fix run_process_quiet to print stderr and stdout in case if the
execution failed for some reason.

Change-Id: I0ddb61730114b3e9c59e2d23480df0ced8d6e772
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 20:18:21 +00:00
Kevin Funk
75bb0b6cd1 pro2cmake: Add PUBLIC to target_include_directories
Change-Id: Ie4e882a5713022bfaec7182172be69616ff8b91c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 15:34:33 +00:00
Kevin Funk
772f5dbf1c pro2cmake: Always add a newline after func calls
Fixes the situation where we end up with e.g.:
```
target_link_libraries(...
)target_link_libraries(...
)
```

Change-Id: I455563b24850db7f389746385af53cd606343274
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 15:34:27 +00:00
Kevin Funk
8fea3ec4e7 pro2cmake: A couple more fixes regarding examples
Changes:
- Make sure the footer is passed along to callees
- Make sure RESOURCES are part of add_executable(...) for AUTORCC

Change-Id: I4546bacd2e41ca8acc1a9351af54d325afb715ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 15:34:21 +00:00
Alexandru Croitor
fa57ca055d Install plugin related .cmake.in files
This fixes the build when building qtsvg, qtimageformats, etc.

Amends 0900298d46

Change-Id: Ie732ef6faa99e2ebe7e8da6ee2aa5fc0cf59d3f3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 14:55:31 +00:00
Albert Astals Cid
22852cf621 cmake: Define _LARGEFILE64_SOURCE _LARGEFILE_SOURCE
when largefile feature is enabled, in qmake world
this came from largefile.prf

Change-Id: I064da31328ad46157354c7012c7b8397c558cd1d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 14:34:42 +00:00
Simon Hausmann
44f30db5c1 Fix linking QtGui on Android
Until we have some convenience in place, it is strictly necessary to set
the NDK API level, otherwise the libraries from vcpkg are statically
built against a newer libc headers than what we finally link against.

This also means that we can remove the manual libc linkage again.

Change-Id: If1f2eec4df5ed800ac6b060561edff89236891e9
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-04 13:57:50 +00:00
Marc Mutz
dea7110b29 QGestureManager: clean up cleanupCachedGestures()
- use logarithmic QMap::find() instead of iterate-and-compare-with-key
  (linear)

- don't convert a QList to a QSet just to use QSet -=, just iterate
  over QSet::remove(): QSet::subtract() doesn't do anything more
  fancy, either (saves memory allocations)

- replace Q_FOREACH with ranged-for, avoid copies

Change-Id: I451f034767b079efa9ee19e2c1fe7dc4af2d9bea
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-06-04 15:12:09 +02:00
Cristian Adam
653666008c CMake: Treat Qt plugins as MODULE libraries
CMake will complain if you try to use a plugin in target_link_libraries,
and it won't produce import libraries on windows, or use .so.number
on Linux.

Change-Id: I6f0cf8267b3c0e6e5c888703596afe59b3a39141
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 12:49:06 +00:00
Cristian Adam
b61c4e6a7d CMake: Install plugins on Windows
The plugin dll files were missing from install_dir/plugins/

Change-Id: I68655faf949e4b8fcab153c6c9b8ee14d3ad8ecc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-04 12:45:42 +00:00
Leander Beernaert
64c111e10f Android: Use lld as default linker for Qt Modules
We can't use the gold linker with the android NDK, which is the default
option. Using the gold linker results in linker crashes. QMake builds
also disables the gold linker.

Change-Id: I73de93150b160b4411715007bc7e40238b96d400
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 12:22:30 +00:00
Simon Hausmann
624891e7c5 Fix build with clang 8.0
When qt_parse_version_string tries to parse the compiler version into
separate fields, it tries to accommodate for different number of digits
separate by dots by checking the length of the list as it is mutated.
Unfortunately the length variable is not a live variable, so after
removing an entry from the list we must change the length variable
manually.

Change-Id: Ieaeb091581484e8c723fbb467697f73036e64ec9
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 12:10:25 +00:00
Cristian Adam
3bf6682ad4 CMake: Install dlls on Windows
Dlls were missing from the install_dir/bin directory.

Change-Id: I0b5ef685b779c91969bbfa877f226be2060f6e56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 11:51:09 +00:00
Albert Astals Cid
4d72497e6e cmake: Fix tests that need helper binaries
Compile the binaries where they are expected not in builddir/bin

Change-Id: I5c9461424a4b3f9fb7f39f5b9d3cd9b96887cfbc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 11:41:02 +00:00
Albert Astals Cid
6d1c695b0e cmake: Fix testlib/selftests
Actually build tst_selftest
Fix the subdirs of it not to be actually built as tests (so that ctest
doesn't pick them up and tries to run them)

Change-Id: Id9d069f44241027dbd103884d36551163382b216
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-04 11:40:48 +00:00
Leander Beernaert
ff68d84d32 Android: Fix incorrect build config for Network
Fix build configuration for qdnslookup implementations for android as
UNIX is also set when building for Android. We should only have the more
specific conditions enabled.

Change-Id: Ib891df34e5569a20b03ce270e1eab080325549b9
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 10:17:35 +00:00