Commit Graph

332 Commits

Author SHA1 Message Date
Leander Beernaert
e61a7a2c57 Add support for qmlcachegen
This patch adds support for qmake's qmlcache feature. It's enabled
when option EMBED_QML_FILES is not present in add_qml_module.

Change-Id: I9b35f0bda7dfaf777f55c14eaf3d763f9b550fa4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-29 11:52:43 +00:00
Leander Beernaert
88bf485f91 Add EMBED_QML_FILES option to add_qml_module
Some projects in QtQuickControls force the qml files to embedded into
the binary. This change exposes an option to mimic that bevhavior.

Change-Id: I4cbf0c21c05ca03b8dd1189eb7d81e43279c7157
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-25 09:44:03 +00:00
Leander Beernaert
2cc865b943 Extend add_qt_test to support qmltestcase
Extend add_qt_test for qmltest by setting the option QMLTEST
when we detect the config qmltestcase.

We also forwards the GUI option to the tests when detected.
This is a requirement for some QtQuickControls2 tests.

Finally when doing a prefix build, we add the install directory
to the QT_PLUGIN_PATH environment variable.

Change-Id: I3b2ecb494955976e98abbcf3d03925c314336122
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-24 10:49:20 +00:00
Leander Beernaert
1072a8f579 Add missing QT_INSTALL_DIR paths to qml files and test data
Make sure that paths passed to qt_copy_or_install are prefixed with
QT_INSTALL_DIR so that they behave correctly with prefix and non-prefix
builds.

Make sure that plugin.qmltypes and qmldir are also copied to binary dir
when doing prefix builds to match qmake's behavior.

Change-Id: I6f87ed478e797c9f66dbf85264904ad29a60ad95
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-24 09:28:18 +00:00
Alexandru Croitor
59912b9558 Fix building examples when doing a Qt static build
The build failed due to two different reasons.

We tried to assign properties on an aliased target, which does not
work. Make sure to set properties on the original unaliased target.

We tried to query for the value of the QT_DEFAULT_PLUGINS property
when automatically linking to plugins, but the generator expression
failed in the AND section, because querying for an unexisting value
does not return an integer, and the AND expression expects an integer.
The fix is to wrap the relevant expression in a BOOL generator
expression.

Change-Id: Ia065bc1de939cee49e5de0b2aef70e356cc5419a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-22 18:48:17 +00:00
Alexandru Croitor
35fbe525fe Fix warnings regarding QML plugins
Some author warnings don't make sense when dealing with QML
plugins, like the messages regarding CLASS_NAME or not
belonging to a certain module. Take care not to print those
warnings in those cases.

Change-Id: I017bd63cca650dc262337949242e813b7b6a56cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-22 16:02:30 +00:00
Alexandru Croitor
f60e4058aa Fix non-prefix builds for non qtbase repos
QT_WILL_INSTALL was previously always set to ON when doing a
qtdeclarative build, because
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT evaluated to false due to
always having to set CMAKE_INSTALL_PREFIX to point to the qtbase build
directory.

Instead of recomputing the value of QT_WILL_INSTALL, compute it once
while configuring qtbase, and add it to the generated
QtBuildInternalsExtra.cmake file, so it propagates to all other repos
that will be built.

Change-Id: If8bf63e7501b5758fe7aa0f799cb0746704f4811
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-22 16:02:21 +00:00
Leander Beernaert
31341ad63a Simplify add_qml_module code
Reduce the amount of code required to add a qml plugin to cmake
by making add_qml_module wrap the add_qt_plugin code where required.

add_qml_module will also create a dummy target so that qml files
will appear as source files in an IDE when no cpp files are present.

CXX_MODULE qmake parameter has been dropped in favor of an
explicit IMPORT_VERSION parameter, since it was only used to
determine the version when the IMPORT_VERSION was not specified.

Change-Id: I4a4b626566720d04c62d246ca521db8c4a95b10f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-22 14:28:19 +00:00
Leander Beernaert
ec1546afc4 Handle TESTDATA for Qt Tests
These changes enable the support to handle test data and install or
package them as resources when appropriate.

This change does not handle the GENERATED_TESTDATA or
TEST_HELPER_INSTALLS since there are very few occurrences of these and
we can handle those as special cases.

Finally, in add_qt_test, only append CMAKE_CURRENT_SOURCE_DIR if
the path is not absolute.

Change-Id: Ic20b9749d10e2a09916f2797606116471c64850b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-16 06:48:56 +00:00
Leander Beernaert
30b3746370 Add support for QML plugins
Add the necessary code to both the QtBuild and pro2cmake to be able
to handle qml plugins in qt declarative.

Add condition replacement for QTDIR_build to QT_BUILDING_QT so that
certain qml examples work correctly when being built in the build
directory.

Fix add_qt_resources not being updated during build after changes
were made. Files list used as dependencies were not populated.

Add missing module mappings for qtdeclarative.

Change-Id: I0f71d0a3a0e7e97ba96807950d11cffaee04d9b2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-15 12:28:12 +00:00
Alexandru Croitor
078cd61751 Fix CMake moc scanner to look for new macro Q_NAMESPACE_EXPORT
f66c1db16c in qtbase introduced a new
macro that the moc scanner has to look for.

Set an explicit list of macros to look for in the
CMAKE_AUTOMOC_MACRO_NAMES property of every target that has AUTOMOC
enabled, otherwise CMake AUTOMOC won't run moc on files that contain
the new macro.

Change-Id: Id991a70d773cef66716621803a88e96b44a80650
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-11 15:16:09 +00:00
Jean-Michaël Celerier
a5b78a3660 cmake: implement default qpa plugin behavior for static builds
This is done by adding a DEFAULT_IF argument to add_qt_plugin, which accepts
if-evaluated expressions.

e.g.

    add_qt_plugin(myplugin
	DEFAULT_IF ${foo} STREQUAL ${bar}
        ...
    )

so that this mechanism can be reused later if necessary.

Change-Id: I7eba9adaaa28e55a4f0f94cf206e868b990027e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-05 14:58:52 +00:00
Jean-Michaël Celerier
5769e1a2f6 cmake: allow client apps to load static plug-ins
Based in part on Kyle Edwards's implementation :
https://codereview.qt-project.org/c/qt/qtbase/+/243731

Example :
```
cmake_minimum_required(VERSION 3.15)
project(foo)

add_executable(foo main.cpp)

find_package(ICU COMPONENTS i18n uc data REQUIRED)
find_package(Qt6 COMPONENTS Core Gui REQUIRED)
target_link_libraries(foo Qt6::Core Qt6::Gui)

qt_import_plugins(foo
    INCLUDE
        Qt6::qxcb
    EXCLUDE
        Qt6::qgtk3 Qt6::qeglfs-kms-integration Qt6::qjpeg
)
```

Change-Id: If7736c42f669f7d7f43052cae59c28fc7fcb4156
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-07-05 14:56:56 +00:00
Alexandru Croitor
38640f745e Fix toolchain path when doing non-prefix builds
Previously the cmake install prefix was added twice during a non-prefix
build, which evaluated to an incorrect path.

Set another absolute dir variable, and use that instead.

Change-Id: I73099510dadc8f401d5a763f21840c9671686c10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-07-03 16:09:55 +00:00
Leander Beernaert
ccc581c9fd Add auto detection routines for android
Add QtAutoDectect cmake which has routines to handle the vcpkg detection
as well as set up some android configuration parameters. The latter will
contribute towards keeping the cmake configuration commands shorter when
targeting android.

Change-Id: I721291c8dce39b5c298565a46867ddcab2df90e8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-27 13:45:58 +00:00
Leander Beernaert
20bf867a72 Update README for other Android architectures
Update the cmake README file with explanations on how to target the
other available Android architectures.

Change-Id: Id7653abc4a1a6fbb96797014ce2ca2e6bb49943d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-27 09:53:14 +00:00
Simon Hausmann
6fe92d5aed Prospective fix for using qt-cmake when %PATH% changes and using Ninja
Mixing compilers won't work well on Windows, so if qtbase is built using
cl.exe and Ninja and then later cmake is called on another module and
gcc is found in %PATH%, then cmake will prefer that. Let's avoid that.

Change-Id: I8294482939efa6a16e0a4df8df3aeef8243c3657
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-26 12:41:39 +00:00
Leander Beernaert
5efdf54f84 Fix error in run_config_test_architecture
The run_config_test_architecture() function in QtBaseConfig was not
working correctly as we were not updating the length of the line
properly.

Change-Id: I29c5b45f1fa36d16cb2ef00950feb80987f6b176
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-26 12:13:38 +00:00
Simon Hausmann
1a8799bfdd Fix osx deployment target and sysroot propagation in the qt toolchain
We need to save them in the toolchain file, otherwise we can't compile
anything :)

Change-Id: Ic5c53524fa4aa05d0b3229c2905dff92ca437ec1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-26 11:38:01 +00:00
Leander Beernaert
a9d2c5b6d7 Android: Final changes for APK generation
Generate the ${MODULE}-android-dependencies.xml for the androiddeployqt
tool. This will ensure all the right plugins and dependencies are
packaged when generating the apk.

This change also changes the visibility for executable to default/public.
Not having this will cause the application to crash as we can't locate
main() in the executable (shared library).

Additionally pro2cmake conversion script has been updated to perform
the required conversions for the Android settings.

Finally, the 6 projects in QtBase that have Android dependencies have
been updated with the new script and the step that produces the xml
files in run at the end in QtPostProcess.cmake.

Change-Id: I9774ba1b123bc11cae972fa37054ef2c51988498
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-26 08:34:37 +00:00
Simon Hausmann
ffec6c7180 Add windows batch file for convenient cmake invocation with Qt toolchain file
Similar to the shell script, this makes it easier to invoke cmake by
just extending your PATH.

Change-Id: I1f83e93c507032f6ecf4838c11d62f49f4d93ed6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-25 14:12:59 +00:00
Simon Hausmann
e5b62e9607 Allow prefix builds with developer-build as feature enabled
Just like with qmake, separate the two "features".

Change-Id: Idf2a796c7c4aaa740c471688b2221d7041fed643
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-25 13:38:44 +00:00
Simon Hausmann
6290efc4eb Fix building against an installed static Qt
For ICU we have multiple components, and ICU becomes a public dependency
to QtCore.

When storing the INTERFACE_QT_PACKAGE_COMPONENTS property, make sure to
store the entire list of components, not just the first component -- by
turning the semi-colon separated list into a space separated list.

When processing the components at find_dependency time, we need to
reverse that and pass COMPONENTS directly to ensure a correct parameter
expansion.

Change-Id: I24a0708520e7d5fba039395a151034aee4d4c0e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-25 13:38:33 +00:00
Simon Hausmann
e25f9e2008 Prepare tests for running in the CI
* Add labels so that ctest --print-labels and ctest -L <label> gives
  insight over the test plan and the ability to run easily individual
  tests.
* Unfortunately we can't do the TESTARGS indirection for arguments as
  coin does with testlib, so instead pass the parameters to generate
  the xml unconditionally.

Change-Id: I289de9c15c516e3ac3fe04771fdbd8d7a083ff1f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-25 13:11:05 +00:00
Simon Hausmann
a6576d97ca Fix vcpkg default target triplet setting in the qt toolchain file
Due to scoping this variable needs to be written into the cache.

Change-Id: I2704fe9ac138210571e0b7acada5eb5c65e265af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-24 15:08:05 +00:00
Alexandru Croitor
a37771ebc5 Check for the correct apple clang version with warnings_are_errors
The current state of qtbase is confirmed to be built with no warnings
when using up to Xcode 9.2, as per the check in
mkspecs/features/qt_common.prf. Add the same check for the CMake
build.

Change-Id: I0c2409ece048e93fba29c41a8bd053dd112949bd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-24 14:52:59 +00:00
Simon Hausmann
d2c2ff8337 Fix tools dependencies in associated modules when cross-compiling
When cross-compiling we take a shortcut in add_qt_tool() for moc, etc.
as the tools are already imported from the host build of Qt. However we
must still add the tools as a dependency in for example QtCore so that
when the cross-compiled QtCore is used, the host tools are implicitly
imported.

Change-Id: I83e4fd7f21e18472c0965c90c058dd2b55b6ec65
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-24 14:23:41 +00:00
Simon Hausmann
03aa74e40d Fix tools dependencies lookup when cross-compiling
When the host system uses 64-bits for pointers and the target 32-bits,
then locating the tools dependencies would fail due to the mismatch.
Since the tools dependencies don't create linkable targets but merely
import executables, we can skip this check like in commit
914b367c7f.

Change-Id: I1ebd0867e4cce34f42df21dc8e8d9176a83a9cac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-24 14:23:32 +00:00
Simon Hausmann
2895f3ffaa Generate a toolchain and convenience cmake wrapper
This gets us a step into the direction of convenience that qmake
offered:

    * QtBase is configured with a long command line (especially when
      cross-compiling)
    * Afterwards application developers (or other module builds) can
      just use qmake && make

By generating a toolchain file we can capture vcpkg and toolchain
chain-loading and a shell script can take care of providing the prefix
path.

Change-Id: Ided81f5432cab862306f2bea86cfe8e56adf71b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-24 14:23:11 +00:00
Alexandru Croitor
a581f917e2 Fix plugins on macOS to have the .dylib extension
add_library(MODULE) creates libraries with .so extension on macOS,
but Qt plugins should have the .dylib extension.

Change-Id: I603e7abfb9d5b78c0c8ea526f9fe995bf36c3a50
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-24 13:30:22 +00:00
Alexandru Croitor
1a2a3b72bf Add PlatformCommonInternal target and QT_NO_DEBUG definition
All the other PlatformModuleInternal, PlatformPluginInternal,
PlatformToolInternal target will depend on the common one.

Also add the QT_NO_DEBUG definition when the build type is not Debug.
This fixes the lookup of the Qt platform plugin on macOS, which
uses a "_debug" prefix in the plugin name depending on if the
QT_NO_DEBUG definition is present or not.
This is the same as it is done in mkspecs/features/qt.prf.

Change-Id: I82cf461d44b8a3b3c5dc2b2d9f25baa246fc1e4b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-24 13:30:14 +00:00
Simon Hausmann
1c4510cfc4 Fix build with multi-config VS code generator
We want our libraries to end up in the same bin directory, not inside the
Debug\ or Release\ sub-directories. Their distinct names avoid a clash.

For our tools such as moc, uic, etc. we need to place the release build into
the bin directory explicitly, as by default multi-config generators place
binaries into the Debug\ or Release\ sub-directory.

This is also needed as cmake's automoc itself expects moc to be in the
bin directory.

One effect of this is that with a multi-config build, it is always necessary
to perform a release build first, otherwise the debug build won't find moc/uic.

Change-Id: I1361823ddf5961a5f1bb517e4bca69e621cbce9e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-21 12:45:37 +00:00
Simon Hausmann
174d870635 Add support for picking up vcpkg automatically
If VCPKG_ROOT is defined, let's use it and chainload any previously set
toolchain file. The detection of vcpkg support via the VCPKG_ROOT
environment variable is per vcpkg documentation, the automatic
chainloading is something specific to us.

Change-Id: I0498effc5b948f0b6f5e223d0454a15a0cbb503a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-20 13:42:31 +00:00
Simon Hausmann
fab07ca3ef Add support for vcpkg default target triplets
As per vcpkg documentation, this is a tweak that allows respecting the
vcpkg default target triplet environment variable, which simplifies the
command line slightly.

In order to make this also work for modules other than qtbase, we're
going to need to consider the creation of a toolchain file.

Change-Id: I2573f6644d671c710fd823df83e2205dbbfe19e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-20 11:55:01 +00:00
Simon Hausmann
aeaef4d6f3 Fix QPA headers for QtPrintSupport
Remove the special case in QtGui and instead handle this in a generic
way so that QtPrintSupport is covered, too. For now we do this in the
same function where we run the regular target install() commands. It
doesn't quite fit into per-target PUBLIC_HEADER or PRIVATE_HEADER
properties as the qpa headers sit _next_ to public and private in a
separate qpa sub-directory.

Change-Id: I30aadaf9496cf0236f39a7c36a5163e4270edecc
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-20 09:10:57 +00:00
Frederik Gladhorn
264d3bc9ba CMake: clarify readme
Always install - not installing doesn't make much sense.
Add information about developer-build.

Change-Id: I406d007e9b167ee83d126ffa6e78235743402c33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-17 15:52:53 +00:00
Jędrzej Nowacki
aaa7ce460a Add ICC platform specific mkspec
Change-Id: I6d33439a251723c409d395b459207843804d295c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-17 10:56:34 +00:00
Alexandru Croitor
fe3bd212fc Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
This changes many different CMake places to mention Qt6 instead of
Qt5.

Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.

Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
2019-06-14 16:31:09 +02:00
Alexandru Croitor
72066a3a58 Revert "cmake: Make CMake superbuilds work"
Builds fail on Windows, due to splitting on ':' on absolute file paths,
when handling syncqt injections.

Revert for now to get qt6 merge in faster.

This reverts commit 7559d508d1.

Change-Id: If139a8a1eb4ae7ccc8d7b835b12e83b03176e28b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-14 14:27:24 +00:00
Kevin Funk
7559d508d1 cmake: Make CMake superbuilds work
In case of a CMake superbuild, the actual install root in a non-prefix
build is the top-level build directory (not $TOP_BUILDDIR/qtbase anymore).
This is more in line how CMake lays out things by default.

Task-number: QTBUG-75582
Change-Id: I4e1744b5c877508fedc33e237eec28cb7436010b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-14 10:16:40 +00:00
Alexandru Croitor
cfcd50875b Try to find Test package before calling add_subdirectory(src)
in qt_build_repo().

This is important for qtdeclarative for example, which builds QmlTest
functionality in ./src, and thus needs Test lib to be available.

Change-Id: I84326d79844526f2f177c19de30bab0c858773e3
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-13 14:59:55 +00:00
Alexandru Croitor
bb959af00a Automatically find apple frameworks when building a repo
Instead of doing it just in qtbase/src, we need to do it
for all repos before building ./src.

Change-Id: I57f226b849cd5370ffbbbea8a694697d400957a4
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-06-13 14:25:02 +00:00
Alexandru Croitor
bf0ee8c4e8 Fix the 'Fix static builds' commit
The GlobalConfigPrivate target should also be filtered out when
registering target dependencies, because there's no standalone
Qt5GlobalConfigPrivate.cmake file.

Amends fbfa067a30.

Change-Id: If89732bc2fd004b9644959f71339e22210483d7c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-12 18:18:58 +00:00
Alexandru Croitor
fbfa067a30 Fix static builds
There were a few issues:
- Third party dependency info for plugins was not generated,
  because the depends and public_depends variables were not fetched.
  This caused issues when trying to use the qcocoa plugin in a
  consuming application, because Cups::Cups was not found.
- Privately linked libraries in extend_target were not considered when
  generating dependency info for modules. This caused issues in
  QtThemeSupport, becauese it could not find Qt::DBus, due to that
  target only being added as a private library in a conditional scope.
- Make sure to handle privately linked internal modules like
  PlatformModuleInternal to map to the Qt5 package, because there is no
  standalone package for it.

Also remove a TODO comment that says that qt_register_target_dependencies
should maybe be called in extend_target. That's already the case.

Change-Id: Ie99c52e800cd89e6f82008f1e38f4da5cd602929
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-12 14:26:28 +00:00
Simon Hausmann
319fd4ea9a Make WinMain linkage compatible with Qt 5
In Qt 5, the Qt5Core target was extended by Qt5CoreConfigExtras.cmake to
have a generator expression as interface linkage that would
conditionally link WinMain.

This patch implements the same through regular interface linkage right
in corelib. Since the linkage happens through a generator expression,
our dependency generator does not see this as a dependency. Therefore we
add this as an unconditional package dependency for corelib, on Windows.

In theory this could be done also in winmain's CMakeLists.txt, as
targets can be extended outside of their directory. However this adds a
directory id (WinMain:@<023423>) to the linkage, which mysteriously is
not removed on the exported core target.

Change-Id: If2abb9ba790f51274f582c9ec28c13d968b84302
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-12 14:22:30 +00:00
Simon Hausmann
efa9998521 Fix compiling of examples on Android
* Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE
  but provide it implicitly. It's redundant :)

* When on Android, build a module (shared library), just like qmake.
  This requires an additional library destination in the install() call,
  but that's ignored on other platforms.

* Fix typos in the android deployment generation settings function

* Use the correct cache variable to determine whether we're inside a Qt
  build or not. Right now this only works inside Qt builds anyway as
  QtPlatformAndroid.cmake is not publically accessible.

Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-12 14:19:53 +00:00
Simon Hausmann
6732fa3a29 Fix linking of examples
Provide add_qt_gui_executable() as function in our public API that takes
care of automaticWinMain linkage. We can use this in the future to
encapsulate similarplatform-specific behavior and adjustments, such as
module generation onAndroid.

In order for the examples to see the function in Qt5CoreMacros, three more
additional fixes were required:

    * Do the build_repo_end() call _before_ attempting to build the
      examples, as we need the build_repo_end() to include QtPostProcess
      and complete the creation of all the target config files.
      Otherwise the find_package() calls in the examples see something
      incomplete.

    * Add more QT_NO_CREATE_TARGET guards

    * Always call find_dependency on the dependencies, regardless of the
      target creation mode. This way a find_package(Qt5 COMPONENTS
      Widgets) will still load Qt5CoreMacros.

Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-12 14:19:34 +00:00
Simon Hausmann
b4e5b64936 Prospective Windows build fix
Commit abe12f600b moved the
_LARGEFILE64_SOURCE define to a central place and commit
449eee2d10 made it conditional to UNIX
(not WIN32). Somehow these two were left over though.

Change-Id: I23b08e84db804e9d5a4dde706af501c0918b460e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-12 11:04:29 +00:00
Simon Hausmann
0d224dbb9c Remove redundant installation of QtPlatformAndroid.cmake
It's already installed right where QtSetup.cmake is installed.

Change-Id: Ie88363ae3878cda8f92aa44160333886f64565d8
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-12 08:26:00 +00:00
Leander Beernaert
152b22a7b0 Android: Generate deployment-settings.json
Generate the android deployment settings json for android apk
targets. QtPlatformAndroid is now also deployed as a public
build dependency of QtCore. Some minor refactoring has been
performed to the naming of variables and functions to
better match the public facing apis.

Extra settings for the file can be configured using the
following target properties:

set_target_properties(Core
    PROPERTIES QT_ANDROID_DEPLOYMENT_DEPENDENCIES "foo;bar"
    QT_ANDROID_EXTRA_LIBS "foo;bar"
    QT_ANDROID_EXTRA_PLUGINS "foo;bar"
    QT_ANDROID_PACKAGE_SOURCE_DIR "/foo/bar/"
    )

The file is generated using the function
qt_android_generate_depoyment_settings().

We need to install the android template files and jar
files during the android build as the androiddeployqt tool
wont work if parts of it are split between the host
install and the android install.

Added QT_BUILD_QT variable to check whether we are building
Qt from source.

Finally, we also force the stdlib to shared via cmake
configuration with -DANDROID_STL="c++_shared"

Change-Id: I063c47e11749d56ba4c6f02101dbcc09e1b9fe87
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-12 07:21:01 +00:00
Alexandru Croitor
c09e770a5d Add appropriate MSVC version check for warnings are errors feature
In qmake land warnings_are_errors is only enabled for specific
MSVC versions, ending with MSVC2015. Presumably the warnings have not
yet been fixed for newer MSVC versions, so we stick with the same
status quo for now.

Change-Id: Idc3741d39c888f77ed324a5eb8c654416591785f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-11 09:43:25 +00:00
Alexandru Croitor
449eee2d10 Don't add _LARGEFILE64_SOURCE define on Windows
In qmake land, the largefile.prf feature is automatically loaded due
to 'largefile' being added to CONFIG via the equivalent feature.
The prf file is in the 'unix' subfolder though, which means that qmake
doesn't load it on Windows.

We need to do the same, otherwise we get build errors due to the
define being checked in ZLIB headers, and selecting an invalid code
branch on Windows.

Change-Id: Ibe9202a639754927262bb8aaa28289934f2e23ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-11 09:41:54 +00:00
Alexandru Croitor
38b1474c51 Handle minimal_syncqt as not running syncqt for now
This is needed for QmlDevTools in qtdeclarative.

Change-Id: I41adec15f292c91192e171b45d1e5d48764c37c4
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-07 09:49:15 +00:00
Alexandru Croitor
aa956e0822 Change qt_build_repo to build tools if present and needed
This is needed for qtdeclarative, to automatically start building
the tools if needed.

Change-Id: I3cbe129e8bb6fa8572a8e34fd3653b51727cb244
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-07 09:49:05 +00:00
Mårten Nordheim
39f720e6dd MSVC: Split the warning suppression compile options string
cl: Command line error D8021 : invalid numeric argument '/wd4530 /wd4577'

Change-Id: I222e779870ebacfc6f8a71e90dbf47867a84f72f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-06 15:26:52 +00:00
Simon Hausmann
abe12f600b Simplify per-module option handling
Move flags/options that we use for modules from add_module to the new
platform module target.

Change-Id: I89e414690336dcd37253432fe5116226d1c8dd82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-06 14:10:26 +00:00
Alexandru Croitor
e7d1ec61e3 Collect more known modules when considering private libraries in
extend_target.

In extend_target(Foo) we go over all the ModulePrivate dependencies
to assign them to FooPrivate. To do that we use the QT_KNOWN_MODULES
variable.
The problem is that the variable gets reset when we build a new
repository, so when we build qtdeclarative, QT_KNOWN_MODULES has no
entries for Core, Gui, etc, but only Qml, Quick, etc.
And yet QmlPrivate has to depend on CorePrivate.

Change the module Config.cmake files to append their target name
to a global variable called QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE.
The global variable gets populated every time find_package(QtFoo)
is called.

Use the union of QT_KNOWN_MODULES and
QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE when considering FooPrivate
libraries.

Change-Id: Ibd9449744478cea58eb5d9737cc8887b4df92420
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-06 12:51:33 +00:00
Leander Beernaert
053766d796 Fix Standalone Example build when crosscompiling
Added qt_examples_begin() and qt_examples_end() macros to setup the
example list so it can be re-used in other projects.

When cross-compiling, we also need to set
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH in order for find_package()
to work correctly.

Removed support for building the whole qtbase/examples folder as a
standalone project. Building examples is only supported when building
the whole of qtbase (qtbase + examples together) or each individual
example is built separately against an installed Qt version.

Change-Id: I9d26b94b48b95af230b76ab618becb21d2d45581
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-06 12:27:41 +00:00
Leander Beernaert
89b7f76719 Android: Move Platform Include
Move the include of the platform from QtPlatformSupport to QtSetup. This
no longer causes compile tests to fail since they expect explicit
include paths instead of using CMAKE_MODULE_PATH.

Change-Id: I9d3bed7845104d84422afb5a976ec14b111d259d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-06 08:36:20 +00:00
Simon Hausmann
37cdd44982 Fix "make install"
Don't try to report an installable public module .pri file for internal
modules.

Change-Id: Ide6a50420e0b5448b141c842df4c891baca4a9d9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-06 08:24:21 +00:00
Albert Astals Cid
f5a494f3c1 Introduce Platform*Internal targets
Link to them from add_qt_module/plugin/tool

This way we set the warnings_are_errors flags just once
and also non-qtbase modules get them

Change-Id: I2b65a81694aaebdd7c886249f217c11f79492bad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 15:43:23 +00:00
Kevin Funk
af074c2c0d cmake: Generate QtBuildInternalsExtra at conftime
... using configure_file.

Change-Id: Ibe3522c33e20a86c454b23919547775624f84755
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 15:33:48 +00:00
Kevin Funk
aa548e09c7 cmake: Ensure syncqt.pl from source is found
... in superbuilds. PROJECT_SOURCE_DIR points to the wrong directory in
that case.

Change-Id: Ic0cba254734c4693b418dd8a0d8e77063914a9de
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 15:09:18 +00:00
Kevin Funk
e99f4a5c89 cmake/ does not necessarily exist in a module
E.g. qtsvg does not have a cmake/ folder

Change-Id: I216776a4997709222064aa76195a32e7bdb6b080
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 14:39:39 +00:00
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
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
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
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
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
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
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
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
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
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
Simon Hausmann
5c954b89a9 Fix qFindTestData with cmake and ninja generator
In order for test lib to locate the file requested via QFINDTESTDATA, it
needs the build directory of the test (for example
$builddir/tests/auto/foo/bar) and __FILE__ expanding to a path to the
source relative to this build directory.

With ninja, __FILE__ is a path that is always relative to the top-level
build directory, not the per-test case one. Therefore the path
resolution in testlib fails.

To accommodate this, add_qt_test() now always sets QT_TESTCASE_BUILDDIR
as well as the newly introduced QT_TESTCASE_SOURCEDIR, which, as an
absolute path, removes the need to use __FILE__.

Change-Id: I16c2b0001e38162e6da9fdb1a61f4f8ce634fe46
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2019-06-04 10:14:39 +00: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
Leander Beernaert
bb52bd49e1 Android: Fix linker erros for liblog & libc
For the android platform library add dependencies on liblog and libc
for every Qt target.

The libraries are shipped by default in the Android NDK so they will
always be present.

Change-Id: Ic4a13be32118710b11effabfb16e27bd2d10809f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 10:08:20 +00:00
Jean-Michaël Celerier
0900298d46 cmake: register plug-ins, create dependencies file
This commit introduces infrastructure work to allow static builds of Qt
to handle importing of plug-ins.

Change-Id: Ife0ca3ca7276ea8ec96fe0eb6adf934fad7620ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 10:08:07 +00:00
Albert Astals Cid
9e6781b69e cmake: Fix xcb build
Need
	qt_find_package(X11_XCB)
in src/gui/configure.cmake since we're using it in the file
	qt_feature("xcb_xlib" PRIVATE
	    LABEL "XCB Xlib"
	    CONDITION QT_FEATURE_xlib AND X11_XCB_FOUND
	)

Need
	qt_find_package(XRender PROVIDED_TARGETS PkgConfig::xrender)
in src/plugins/platforms/xcb/CMakeLists.tx since we're using it in the
file
	extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
	    PUBLIC_LIBRARIES
	        PkgConfig::xrender
	)

Use capital XRender in pkgconfig to be more consistent on how XRender is
called everywhere else

Change-Id: I403ead2cc123b08f741c5142f20db88987657ba8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 08:45:46 +00:00
Alexandru Croitor
5715ef13d2 Add private define _USE_MATH_DEFINES on Windows for every module
It's needed when building QtQml on Windows, otherwise
compilation fails.

Add it as a private define for every module being built,
as it is done in qt_module.prf.

Change-Id: I1e322d1da15adea8b3f037a722b3260a552dfb62
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 08:44:57 +00:00
Alexandru Croitor
962ee4ea37 Handle a few more condition types in pro2cmake
qtdeclarative has a few conditions that check the gcc version
via variables like QT_GCC_MAJOR_VERSION.
To handle that, parse the CMake compiler version using
qt_parse_version_string() into separate variables like
QT_COMPILER_VERSION_MAJOR, QT_COMPILER_VERSION_MINOR and
QT_COMPILER_VERSION_PATCH. We can then map the conditions
appropriately.

Also, handle isEqual(foo, bar), which is equivalent equals(foo,bar).

Change-Id: I74575c733b44f1f42451e00038b3f113fd353915
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-04 08:37:26 +00:00