Commit Graph

296 Commits

Author SHA1 Message Date
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
Kevin Funk
6686774fdc QtConfig.cmake.in: Fix typo
This var needs the cmake namespace as prefix.

Follow-up commit of c5e2838b64

Change-Id: I595306301313b1ff911134776480d28b3194bcf8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-04 07:55:49 +00:00
Simon Hausmann
46effc7319 Add some basic instructions for cross-compiling for Android
Change-Id: I0113a7b1e4e3b4d2fc7f93f9809d08fcaf4715d7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-03 14:14:01 +00:00
Simon Hausmann
1080142ec3 Fix Android build
Do not set ANDROID_EMBEDDED unconditionally, as that for now is the
least likely configuration and it won't compile when the sysroot is real
Android.

If this gets revived, then it can be done by setting ANDROID_EMBEDDED in
the cache file directly via the cmake command line.

Change-Id: Ic1e1731f981414bd90b89fe91eaf0543a87d8c88
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-03 13:05:51 +00:00
Alexandru Croitor
bedb16ca61 Stop the flood of warnings due to qt_find_package() usage
The warning used to be a fatal error, until we found out that certain
packages might provide optional targets, or provide one target
out of a possible set.

Until we figure out a better way to deal with that, remove the
barrage of warnings while configuring.

Change-Id: Iacf93a997a8f87f81167ac7c4cc991212e7fca5d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-03 12:53:41 +00:00
Simon Hausmann
28306fc1ed Fix cmake generate step when cross-compilation against Android
We have find module wrappers for various system libs that use
FindPkgConfig. The _FOUND variable will be set to 1 if pkg-config
--exists returned true, but the imported target will not be created when
for example the provided library paths or header include paths are
outside of the sysroot - a good sanity check by cmake.

We require the targets for use though, so therefore we must unset the
_FOUND variable if we can't locate the targets.

Change-Id: Ia0dea657684a1847148664521265c42585890645
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-03 11:36:22 +00:00
Simon Hausmann
4c31ce68d5 Improve finding of sqlite with vcpkg
We use

    qt_find_package(SQLite3 PROVIDED_TARGETS SQLite::SQLite3)

which intends to find cmake's FindSQLite3.cmake and expects the
existence of the corresponding target. However qt_find_package first
tries to call find_package in config mode, which does not interact well
with vcpkg's sqlite, where sqlite3-config.cmake is provided to support
multi-config targets. So that call will appear to succeed, yet the
expected targets are not there of course.

Therefore this patch adds a sanity check for the target existence and
allows for a fallback to the module mode for find_package, in order to
find CMake's FindSQLite3.cmake.

Change-Id: I660f26c38369c3504df1c590e9d3a51ff1f65c6c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-03 09:40:14 +00:00
Alexandru Croitor
3966ab8e9f Add build type (debug) and static vs dynamic to CONFIG in qconfig.pri
Also fix the QT_BUILD_SHARED_LIBS usage. While building qtbase, it
is assigned later than the call for
qt_generate_global_config_pri_file(), so it used always choose static.
Make sure to check for BUILD_SHARED_LIBS as well.

Change-Id: I66f03e5adacc89646147fc96154bee8002b2b9cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-31 14:50:08 +00:00
Alexandru Croitor
d53f22e2fb Improve qconfig.cpp generation
We used to copy a qconfig.cpp.in file verbatim.
Add some plumbing to actually compute the strings and their lengths
as it is done in qtbase/configure.pri.

Also make sure to replace the hardcoded linux mkspec with one that is
automatically determined.

Of course both the detection of the mkspec, and the hardcoded strings
for include, lib, etc. should be fixed in the future.

This is a stepping stone to allow building a Qt application using
the qmake built by CMake.

Change-Id: I2e6754f44b20b09b09d14fd85785d56288e6517b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-31 14:49:34 +00:00
Simon Hausmann
b99e4387f6 Add architecture and abi to generated qconfig.pri
Task-number: QTBUG-75666
Change-Id: If2933005038557c2b5041da6bd02c5890ac786ef
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-31 12:53:23 +00:00
Simon Hausmann
8fa646dbe2 Add basic support for compiling applications with qmake
* Generate module .pri files
* Generate qconfig.pri
* Propagate MODULE_CONFIG from the .pro files

This enables the basic use-case of simple application builds that for
example use the moc. Omitted from the patch is support for private
module configurations, prl files (should we do this?) and possibly more
hidden gems that need to be implemented to for example support building
Qt modules with qmake.

Task-number: QTBUG-75666
Change-Id: Icbf0d9ccea4cd683e4c38340b9a2320bf7951d0d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-31 12:53:09 +00:00
Simon Hausmann
fc6d4af08d Fix Android build
Make sure that we can qplatformdefs.h.

Change-Id: I781fe77d1332ab97b8711e25cc819862ccf28fd0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-29 14:27:22 +00:00
Simon Hausmann
c9c5ca9997 Fix linker flag detection on Android
Since LINUX is not set when targeting Android, we must extend these
conditions manually.

Change-Id: Ie78167d452e0806bfa64773c1e311a99f4a28f8c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-29 13:28:35 +00:00
Simon Hausmann
bcca649440 Fix architecture detection when targeting plain arm
We record extra CPU features such as neon, etc. in the sub-architecture
field, which may very well be empty. Allow for that and avoid cmake
warnings about indexed string access beyond the string boundaries.

Change-Id: I63e61c6427d156180039b8ac6f5b0f5f55c36ee8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-29 13:28:30 +00:00
Alexandru Croitor
9864ff22aa Optionally include ${repo}Setup.cmake file in qt_build_repo_begin
This is meant to keep repo specific functions and macros that should
not pollute QtSetup.cmake. For example QtDeclarativeSetup.cmake
will automatically be included when building qtdeclarative.

Change-Id: I4d26cbb1a7ffafb153a888fc918af337000d5e41
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-28 17:03:55 +00:00
Alexandru Croitor
c3663076dc Fix syncqt call and injected file forwarding and add comments about it
The location of the forwarding headers when not yet installed, depends
on whether we do a prefix or non prefix build.
In a prefix build the /include folder should be in the current repo
build dir.
In a non prefix build, it should be under qtbase/include.

But the actual generated files to which the forwarding headers point,
are always in the current repo build directory.

Also syncqt needs to know both the current repo build directory
specified by -builddir, and the output directory specified by
-outdir.
In a prefix build, both are the same.
In a non-prefix build, builddir should be the current repo build dir,
and outddir should be qtbase's build dir.

Also for non-qtbase repo build directories (like declarative),
examples need to have the current_repo_build_dir/include directory
as an include path, so that framework style includes like
 #include <QtQml/QQmlEngine>
work correctly.

Take care of all that, and add a bunch of comments explaining the whole
injected / generated headers interaction.

Change-Id: I612ad7549ce499c4979ee994e998b558716d45ca
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-28 17:03:45 +00:00
Alexandru Croitor
3122e7c01a Fix qt_build_repo to be more robust
Check for the existence of CMakeLists.txt files before trying
to call add_subdirectory on examples, tests and src folders.

Change-Id: I7be76de5f7520c1dd181c610fd1dc2200ac74672
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-28 17:02:38 +00:00
Alexandru Croitor
cae4c5c2ce Add some qtdeclarative related functions to QtBuild
QtQml uses QLALR to generate a grammar, but the qmake qlalr feature
seems to be a general one, so the corresponding CMake implementations
are kept in qtbase for now.

Change-Id: Ibe916878b18155ddc5bb08793dd2075ebfa8f282
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-28 14:04:31 +00:00
Simon Hausmann
f96778dee2 Enable export of compile commands database
For developer builds, enable the compile commands database by default.
This allows Qt developers to use tools that utilize these (such as
clang-tidy, etc.) without any extra setup.

Change-Id: I79d70ef7dbe7c59864e93593c75f9ff6cd67c2ce
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-27 18:21:00 +00:00
Simon Hausmann
e4f0680c4a Fix static zstd linkage
Upstream's cmake build system installs libzstd_static for static builds,
so look for that as well. Now we can also recommend installing it via
vcpkg.

Change-Id: I0ba4c45ecd90bf7b1c9f1e5f84a440caa976a23c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-24 14:19:51 +00:00
Simon Hausmann
13e9d88e56 Update vcpkg instructions
Let's recommend vcpkg only on Windows for now. That's best maintained
and works best there.

Change-Id: Ied06b6a3cb26d9e56d3f525c1d5a410223754fba
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2019-05-24 14:16:54 +00:00
Alexandru Croitor
0425ee0610 Change the default enabled AUTOGEN tools list to contain only moc
Before this patch we enabled AUTOMOC, AUTORCC, AUTOUIC for all targets
that did not opt out.

Aside from being wasteful from a performance point of view,
this also caused issues when trying to build qtimageformats which
does not depend on Widgets which is the package that exposes uic.

To avoid this, enable only AUTOMOC for all targets by default, and
UIC and RCC can be opted in via the ENABLE_AUTOGEN_TOOLS option.

To facilitate this some refactoring had to be done, like moving some
common setup for all autogen tools into a separate call, and making
sure that extend_target understands the autogen options, because some
ui files are only added conditionally.

Also the conversion script has been adapted to output the
ENABLE_AUTOGEN_TOOLS option whenever a .pro file contains at least
one FORMS += foo assignment.

Note that we don't really use AUTORCC while building Qt, so nothing
opts into that at the moment.

Task-number: QTBUG-75875
Change-Id: I889c4980e9fb1b74ba361abed4044737f8842ea4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 14:58:08 +00:00
Alexandru Croitor
8aab0cfaba Reset main_module_tool_deps in QtPostProcess
The variable was not reset when interating through all the Qt targets,
which resulted in QtTest wronlgy depending on QtWidgetTools.

Task-number: QTBUG-75875
Change-Id: I24da495fa53e9163992a1ed53f5cd7e1c6da5e51
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-22 14:31:23 +00:00
Alexandru Croitor
c7fd10a022 Allow building the tests directory as a standalone CMake project
At the moment, Coin builds tests as a separate qmake invocation
against an installed Qt. We need to support the same with CMake.

Change the tests subdirectory to be a standalone CMake project when
CMake does not detect an existing QtTest target while processing the
subdirectory. If the target exists, it means we are building the whole
repo, if the target does not exist, we need to call find_package
to find the installed Qt.

Refactor and move around a few things to make standalone tests build
successfully:
- add a new macro to set up paths to find QtSetup
- add a new macro to find all macOS frameworks
- add a new macro to set up building tests
- add a new macro that actually builds the tests
- export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals
  Config file
- export the CMAKE_BUILD_TYPE value, because a test project doesn't
  have a .git subdir and thus defaults to be built in Release
  mode, even though qtbase might have been built in Debug, so to
  avoid the mixing, the propagate the build type
- stop overriding INSTALL_CMAKE_NAMESPACE and
  QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because
  the tests project doesn't specify a major version, and if we
  override the values, the moc / uic targets don't get the correct
  major version prefix and configuration fails

Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675
Fixes: QTBUG-75090
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 11:12:54 +00:00
Alexandru Croitor
774088b677 Build and use double-conversion library shipped by Qt when needed
Some Linux distros might not have a double-conversion library. Because
it is such an essential library for QtCore, compile and use the
the copy of the library bundled with Qt.

Also change library name to be a proper target with double colons,
so that in case the library is not found for some reason, the CMake
configure step would fail, instead of failing at link time.

Task-number: QTBUG-74133
Change-Id: I9f3b4298ae6e952891a7a89541d46878176bf1ce
Fixes: QTBUG-75891
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-22 07:25:41 +00:00
Simon Hausmann
f8e4f94a14 Avoid accidental clash with .qrc files that are checked in
Add a prefix for generated .qrc files so for in-source builds we don't
end up overwriting htem.

Change-Id: I8eef582479eb45d67585f6aab87b288393bbadb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-21 08:35:40 +00:00
Simon Hausmann
d61ca95fc0 Simplify top-level CMakeLists.txt for modules
Implement some aspects of qt_parts.prf to simplify the top-level
CMakeLists.txt for repositories that follow the common qt structure
(src, tools, tests, examples).

Change-Id: Ia35f4e9207e92c1cf0406353561b0cc52dcb0e59
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-21 08:05:44 +00:00
Alexandru Croitor
a859cb508c Automatically install repo specific cmake find modules
Some qt modules need to find 3rd party packages for which there
are no Config files. We need to write custom CMake Find modules to
find those packages. These find modules need to be installed so that
they are used when a user consumes the Qt packages.

Automatically include and install these find modules if they exist,
as part of qt_build_repo_end().

Change-Id: I14aad35ed2999cac8bdda65ca4aeaf74d04fdb71
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-05-20 13:48:16 +00:00
Alexandru Croitor
140b65e36f Propagate QT_CMAKE_EXPORT_NAMESPACE via QtCore package
QT_CMAKE_EXPORT_NAMESPACE is used by the Qt packages to make features
available to the consuming CMake project. The value was moved to the
BuildInternals Config file, but that's wrong because consuming
applications not including the BuildInternals component would fail
to use any other Qt package.

Move QT_CMAKE_EXPORT_NAMESPACE to be propagated with QtCore package
again.

Amends 9542e78525.

Change-Id: I9841ac8c2828b00c0111d59e8976c889554e0ce1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-17 11:10:44 +00:00
Alexandru Croitor
85b038a0a2 Copy feature properties from GlobalConfig to Core target
Current lates CMake has a limitation that it does not allow exporting
custom properties from INTERFACE libraries. GlobalConfig is such a
library, which means that so far all the global features were not
actually exported.

Copy the feature property values from GlobalConfig to Core. Because
Core is an actual shared library, it keeps the custom properties
when exported, and thus Core feature properties will contain the sum
of Core and GlobalConfig feature values.

Change-Id: Idde305cbaf9ab85ecfbe29522dcbac1c44022b17
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-17 11:10:31 +00:00
Alexandru Croitor
9fade925e3 Stop trying to create config forwarding headers for NO_MODULE targets
The GlobalConfig target is not an actual module, so there's no point
in trying to create forwarding headers for GlobalConfig's qconfig.h
within qt_feature_module_end.

qconfig.h's forwarding header will be created implicitly while
processing QtCore target's SYNCQT.INJECTIONS value, which is read
from the headers.pri file generated by syncqt.

This also fixes trying to create forwarding headers when processing
the sqldrivers project.

Amends 02a015375a.

Change-Id: Ifd70d8c3ebf881ffdcf90db8d5d3b23309bc8fed
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-16 09:04:00 +00:00
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
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
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
Cristian Adam
1a92808a78 Add support for MinGW
Tested with MinGW 7.3.0 64 from Qt 5.12 installation.
The CMake 3rd party libraries I used from hunter project (with some
package, and target names changes)

Change-Id: Ie89555a6cd8bdb7182f9b2dd2c3c39784c523ead
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-04 20:56:17 +00:00
Alexandru Croitor
a907d7df34 Handle generating find_dependency() calls for nolink targets
Previously we just recorded that Gui has to link against
Vulkan::Vulkan_nolink, but if an application consumed Gui, it wouldn't
find that target.

We need to record that if a module links against Vulkan_nolink, and
then generate a find_dependency(Vulkan) call in the module config
file.

We also have to assign the _nolink interface library to an export
(the Qt5 one), so that it gets installed as a target.

Change-Id: Icbc29ff4161ab18fdd162196ae128e29c1ee8c80
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 13:51:13 +00:00
Kevin Funk
aef11e420d cmake: Generate config files with Qt:: prefix
Generate CMake config files which export Qt targets with a Qt:: prefix
(i.e. without a major version suffix in the namespace)

Change-Id: Ia07f98be6d0e24c196e3880b7469f1f0c6232c06
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 13:51:02 +00:00
Kevin Funk
f2bb48e635 cmake: Install required CMake templates
Change-Id: I4a56440bee1aa7143971dd8f0b8af6dc042703f3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-03 13:50:44 +00:00
Tobias Hunger
7874ce7801 CMake: Improve mapping of libraries
Merge all data related to mapping libraries into one data structure
in helper.py.

Use that data for everything related to library mapping.

This change enables way more features now like e.g. adding find_package
calls into generated files.

Change-Id: Ibbd2a1063cbeb65277582d434a6a672d62fc170b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-03 13:42:25 +00:00
Kevin Funk
d8cdbc4f97 cmake: Make add_qt_executable work
Also needs the include/ from the top-level binary dir added to the
include path.

Change-Id: I7e0d82a2ee24d9bf9ffe9da5fd02b3b223fd48e7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 12:49:37 +00:00
Jean-Michaël Celerier
753d35cd56 cmake: move dependencies accumulation in QtPostProcess.cmake
This is needed because dependencies added after add_qt_module with extend_target
are currently not taken into account.

Task-number: QTBUG-75538
Change-Id: I2c72207fb88b2480e41a2c8550978fb194275617
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 12:42:43 +00:00
Simon Hausmann
914b367c7f Fix finding host tools when cross-compiling
* When using a sysroot, just setting CMAKE_PREFIX_PATH to the
  QT_HOST_PATH is not sufficient in finding for example Qt5CoreTools
  because the QT_HOST_PATH would be prefixed by the sysroot. So this
  patch switches the mode to also enable looking outside of the sysroot.
  (done by Alexandru)

* Once the Qt5CoreToolsConfigVersion.cmake was found, the built-in check
  for 32 vs. 64 bit compatibility by looking at the provided
  CMAKE_SIZEOF_VOID_P (4 when target is armv7 for example) and comparing
  it against the void* size used when building the tools would fail.
  Explicitly unsetting CMAKE_SIZEOF_VOID_P disables this check, and
  that's fine as we're not interested in any exported library targets --
  where this could cause problems -- but merely programs to run.

Change-Id: If2931dad023e39a3dbdaa17ac095131ad2c0ca60
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 12:14:22 +00:00
Jean-Michaël Celerier
db5f99f451 cmake: make the qt_find_package PROVIDED_TARGETS optional
This is because some FindPackage may produce some targets only on some
platforms - e.g. qt_find_package(OpenGL) needs to define
the provided target OpenGL::GLX which will only exist on linux but
is required by various CMakeLists.txt files.

Change-Id: I74515470f5d56c246f489df74901ad4223a92a70
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 08:11:19 +00:00
Kevin Funk
ca3a7efffd cmake: Fix typo, variable was renamed earlier
Change-Id: I8fe9da37572efe85b2dff0b223edb1d93e904f34
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 07:36:16 +00:00
Alexandru Croitor
b26a52ec48 Update readme to mention how to set feature flags
Change-Id: If63d37af4711c4332129d65b934269c33f041ea4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-02 15:49:39 +00:00
Jean-Michaël Celerier
1b36fe53c6 cmake: export locally-built dependencies in static build
Change-Id: Ifbcedd32cef3b9c8b4b8c9ca0d229850f696f406
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-02 11:41:55 +00:00
Alexandru Croitor
bcfc3dca5d Make module package depend on its own tool package
Also make the tool package depend on all tool packages that correspond
to the qt module dependencies.

So find_package(Qt5Widgets) implicitly calls find_package(Qt5WidgetTools).

And find_package(Qt5WidgetsTools) will call find_package for
Qt5GuiTools, and Qt5CoreTools.

This enhances the user experience, so that in modules like qtsvg, you
don't have to specify both find_package(Qt5Widgets) and
find_package(Qt5WidgetsTools), but only the former.

Or when cross building, you only need to specify Qt5WidgetTools, to get
both Core and Gui tools.

Change-Id: Ib1c5173a5b97584a52e144c22e38e90a712f727a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-02 07:30:55 +00:00
Alexandru Croitor
9b0b464e82 Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.

This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.

For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.

The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.

The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.

Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.

In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.

Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.

Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-02 07:30:42 +00:00
Alexandru Croitor
42d3b21c92 Export tool config and target files for each relevant module
CMake will now generate config and target files for each module that
provides tools. As a result, namespaced global targets such as
Qt5::moc or Qt5::rcc can be made available.

Third party projects that require just these tools, and not the Qt
modules themselves,  should specify CMAKE_PREFIX_PATH pointing to the
installed Qt location, and call find_package(Qt5CoreTools),
find_package(Qt5GuiTools), etc.

It is also possible to call
find_package(Qt5Tools REQUIRED Core Widgets) where the last option
is a list of modules whose tools should be imported.

Note that all the tools are in the Qt5::
namespace and not in the Qt5CoreTools:: or Qt5WidgetsTools::
namespace.

This commit also changes the behavior regarding when to build tools
while building Qt itself.

When cross compiling Qt (checked via CMAKE_CROSSCOMPILING) or when
-DQT_FORCE_FIND_TOOLS=TRUE is passed, tools added by add_qt_tool will
always be searched for and not built.
In this case the user has to specify the CMake variable QT_HOST_PATH
pointing to an installed host Qt location.

When not cross compiling, tools added by add_qt_tool are built from
source.

When building leaf modules (like qtsvg) that require some tool that was
built in qtbase (like moc), the module project should contain a
find_package(Qt5ToolsCore) call and specify an appropriate
CMAKE_PREFIX_PATH so that the tool package is found.

Note that because HOST_QT_TOOLS_DIRECTORY was replaced by QT_HOST_PATH,
the ensure syncqt code was changed to make it work properly with
both qtbase and qtsvg.

Here's a list of tools and their module associations:
qmake, moc, rcc, tracegen, qfloat16-tables, qlalr  -> CoreTools
qvkgen -> GuiTools
uic -> WidgetTools
dbus related tools -> DBusTools

Task-number: QTBUG-74134
Change-Id: Ie67d1e2f8de46102b48eca008f0b50caf4fbe3ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-02 07:30:30 +00:00
Alexandru Croitor
58316e03a2 Update readme with some useful info
Update required dependencies.
Add section on how to build vcpkg on macOS.
Fix some typos.
Lower required CMake version.
Inform how to bypass annoying ninja reconfiguration issue.

Change-Id: Ia35bd4329c2cbb9857157cdc33b098f5adb04a35
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-01 19:06:12 +00:00
Alexandru Croitor
f38ebcbe32 Fix add_qt_tool to properly propagate NO_QT option
Otherwise add_qt_executable will still link against Core,
and thus building qmake in a static build will fail.

Amends a1752276e0

Change-Id: Iebbdf9d0a2808a9eaeffdf8fbdb44ff5e2920f3b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-29 15:26:54 +00:00
Tobias Hunger
a1752276e0 CMake: Do not link qmake against Qt (not even the bootstrap one)
Qmake should not rebuild all the code in QtCore, but currently it does.
When linking against QtCore, all the symbols get duplicated. A clever
linker will "deduplicate" the symbols again, so this actually works
with shared Qt builds, but it fails for static builds.

Do not rely on the linker being clever and just do not link Qt at all
for qmake.

Change-Id: I0f79ed9176a19ee884dd425e5f23c26cf69dc422
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-29 12:05:06 +00:00
Alexandru Croitor
d0d63aa260 Append syncqt header include dir when building plugins
Change-Id: I899d4562155fbc82cfd13979b424d751095a381b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-04-26 14:02:13 +00:00
Alexandru Croitor
5fd882803e Fix dbusxml2cpp custom command invocation
Use absolute paths for source files, and relative paths plus a correct
working directory for output files.

This is required to work around a limitation of the dbusxml2cpp tool
where it splits a command line option on a colon ":". Windows paths
contain colons, and that breaks the internal logic of the tool when
passing absolute paths.

Change-Id: Ic653f1317ae4f68bb2f488c117fe48c34310c76e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-16 14:40:25 +00:00
Alexandru Croitor
51b7fbb626 Work around issue of missing Windows qtmain static library
Applications that have the WIN32_EXECUTABLE property set,
must have a WinMain function. In qmake's case, this function
is provided by the qtmain static library.

Until that is implemented in CMake land, disable the property on
Windows for all qt executables. This fixes the linker issues while
building examples.

Task-number: QTBUG-75195
Change-Id: I323d4dd899f716cd6b9b7f4b5ecb76b22f462fc4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-16 14:40:12 +00:00
Tobias Hunger
859b36ca14 CMake: Use imported target to create _nolink targets
Use an imported target to create _nolink targets. This gets rid of
the need to have an helper target that gets aliases to get work
around the problem of the original target might having a "::" in
its name.

Change-Id: I4618980cf2c673ebf5caca593bccf122b3c81480
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-11 15:07:14 +00:00
Tobias Hunger
dac32e95d6 CMake: Update src/corelib
Change-Id: I0321883f762460b146666bfbad0d8b27c3fdeadd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-11 15:06:52 +00:00
Tobias Hunger
92b0d7b911 CMake: Support /nolink libraries
Add a helper function to QtBuild that generates Foo_nolink versions
of Foo library targets.

Map 'Foo/nolink' libs found in qmake to Foo_nolink.

Automatically run helper function to create _nolink targets as
part of extend_target.

Change-Id: I4c23ea68b3037d23c9a31d4ac272a6bd0565f7c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-10 09:36:40 +00:00
Alexandru Croitor
e7c992755e Turn off linker version script support on macOS
The test erroneously succeeds on macOS with an XCode generator.
Explicitly set the test result to be turned off.

Change-Id: Id6fcb96f420f611517e81cc3697f1c88b508bd7c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-09 14:26:14 +00:00
Tobias Hunger
f233249207 CMake: FindATSPI2: Ignore repeated attempts to find ATSPI2
Change-Id: I4d6f59d144910d2f194f73e3b9bc8a5cc6726bcd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-09 11:14:12 +00:00
Alexandru Croitor
f896a5019a Stop installing test helpers
Tests and their helpers should only be used in the build directory.

Change-Id: I5aa9fcf734b6b3667f91df7c84d083f944c452c9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-08 14:53:35 +00:00
Albert Astals Cid
067d5dc027 cmake: Run tests from their build dir
It's what the qmake build does

Change-Id: I99663735859941b56c2211898908d61bc6c4b48f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-05 15:57:20 +00:00
Albert Astals Cid
9947909bfa cmake: Put the test helpers binaries in their parent folder
Makes qtextcodec test succeed

Like qmake does

qt_test_helper.prf says
"
If an auto test needs a helper application, this helper should
be put into the same directory as the test itself.
"

Change-Id: I02cb36d2237cdb72912c943250b843c33ffcd64a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-04 14:12:03 +00:00
Alexandru Croitor
bb04a85bdf Stop installing unnecessary things
This includes:
- tests
- tools that are only used duing the Qt build (tracegen and
  qfloat16-tables)

Change-Id: I3a5f678682b5b9318012568a9e4dcdda0967f89b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-03 11:08:57 +00:00
Tobias Hunger
8a9962aba8 CMake: Add FindCups.cmake from upstream cmake
This FindCups defines a target, which the FindCups.cmake in the currently
required CMake version does not:-/

Change-Id: I76c5bb72ece80415db1971e4f2079682126fde36
Todo: Remove again once we depend on CMake 3.15.
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-03 08:54:14 +00:00
Alexandru Croitor
15f5a347fe Add a debug suffix to libraries and plugins on macOS and Windows
This is especially important on macOS when doing a debug build,
because QPluginLoader is looking for the cocoa QPA plugin
suffixed with "_debug" when executing a test or example.

Change-Id: Ief23b3a82c567c16ab9dd30d04d1729031262d7d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-04-02 13:32:38 +00:00
Tobias Hunger
8533e3d9e7 CMake: Remove 3rdparty/kwin/FindFontconfig.cmake
The one shipped with cmake is more modern:-)

Change-Id: I024769825467734ff1527e91df4cf5dfc38cbe68
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-03-29 09:33:56 +00:00
Alexandru Croitor
8fa9a987ea Install test executables into $prefix/tests instead of $prefix/bin
The install path takes into account the path structure of the source
directory, so that not all tests are bunched up into /tests, but
rather /tests/auto/foo/bar.

Change-Id: I5e32d2e41ae8f095f4eac6654973508efd598df0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-03-27 16:58:44 +00:00
Tobias Hunger
7406c124cb CMake: Set QT_STATICPLUGIN for static plugins
Change-Id: I5439935b5db2babd47cdc85647e464fe845279cf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-27 14:35:56 +00:00
Tobias Hunger
72404ef3e1 CMake: allow custom plugin output/install directories
Only require TYPE if no OUTPUT_DIRECTORY, ARCHIVE_INSTALL_DIRECTORY
and INSTALL_DIRECTORY is provided.

Change-Id: I6db1cfaa576bfa3ee3dc8ecf81db20e3afcd61e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-27 14:35:46 +00:00
Alexandru Croitor
890ddd2540 Fix AUTOMOC and friends to run only once the tools are built
While building on macOS, AUTOMOC sometimes hanged indefinitely.
The problem was that AUTOMOC was executed for the qmacstyle
plugin before moc was actually built.

Because of an upstream bug in CMake, AUTOMOC was caught in a deadlock
without reporting that spawning the moc process failed. Specifically
if a libuv spawn() call failed, the condition variable for a waiting
thread was not notified, and the thread kept waiting forever for the
process launch to finish.

Fix the dependency by setting the AUTOGEN_TARGET_DEPENDS property
on all targets that have AUTOGEN tools enabled. This makes sure that
moc and friends are built before they are used.

Also add some special cases to disable autogen tools on certain targets
to break cycles between targets.

Fixes: QTBUG-74636
Change-Id: I6e689e63cba1962525f169f332a58498d173c0a6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2019-03-22 14:40:48 +00:00
Alexandru Croitor
5fd30d0a18 Revert "Fix wrong target in qt_feature_module_begin"
It broke builds because the qconfig.h file was created in the wrong
directory.

This reverts commit 25f67fbb07.

Change-Id: Ia458ef4193a3985a9ba613d82f679b7df5ca0107
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-03-22 14:40:38 +00:00
Alexandru Croitor
92ab6c2108 Add MSVC specific instruction set compiler flags
This is only a half solution, because some of them need to be set
based on the detected MSVC version and Windows kit, similar to
how it's done by qmake.

Change-Id: Ice13c99d6fe0a033ddfebf9d4be924dcd6b8a36c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-21 17:47:09 +00:00
Alexandru Croitor
ba7c62eed5 Fix sub-architecture (instruction sets / SIMD) handling
In qmake there are at least 2 things to know regarding
sub-architectures and instruction sets.

Which instruction sets does the compiler know to compile for,
represented by the various config.tests and features in
qtbase/configure.json.

And which instructions sets are enabled by the compiler by default,
represented by the configure.json "architecture" test and accessed
via QT_CPU_FEATURES.$$arch qmake argument.

Before this patch there was some mishandling of the above concepts
in CMake code.

The former can now be checked in CMake with via TEST_subarch_foo and
QT_FEATURE_foo (where foo is sse2, etc).

The latter can now be checked by
TEST_arch_${TEST_architecture_arch}_subarch_foo
(where foo is sse2, etc and the main arch is dynamyicall evaluated).

The configurejson2cmake script was adjusted to take care of the above
changes, and the cmake files were regenerated as well.

Change-Id: Ifbf558242e320cafae50da388eee56fa5de2a50c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-21 17:47:01 +00:00
Alexandru Croitor
25f67fbb07 Fix wrong target in qt_feature_module_begin
Presumably this was a copy paste that was not intended.

Change-Id: I09e3bb12b3b3f7af75726d7a952d79814ea9c876
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-21 12:41:24 +00:00
Alexandru Croitor
a9c379199d Fix internal features to also be evaluated
This amends 4f1a155909 and
37b154858f which caused the regeneration
of some json features to be internal. Some of those features were
not evaluated any more unless they were referenced in another feature.

Make sure to explicitly evaluate all internal features as well.

Change-Id: I4367f309585fe29dc89d8a6b793de381956ae51d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-03-21 10:29:38 +00:00
Tobias Hunger
dedc645510 CMake: Make add_qt_executable link to Qt::Core by default
Make add_qt_executable link to Qt::Core by default. Add a BOOTSTRAP
flag to disable this behavior again.

Pass BOOTSTRAP on from add_qt_tool to add_qt_executable.

Change-Id: I26e7f1e03254122f626b3765cccc0dc4414a4fc0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-20 12:29:50 +00:00
Tobias Hunger
485e96c4ee CMake: Handle INSTALL_DIRECTORY for qt_executables
Allow to override the install directory for Qt executables.

Change-Id: I9561976eefe9c7b573bb97ddaaa39e30d3b6d9fb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-20 11:55:19 +00:00
Tobias Hunger
74aa6abac6 CMake: Fix names for generated DBus adaptor/interface files
Use the same names for DBus adaptor/interface files that are also
used by qmake. E.g. io.qt.something.xml will be turned into
something_interface.(cpp|h) or something_adaptor.(cpp|h).

Change-Id: I799b8aee7addd1fe590e8f3ec078e5325b68d5b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-20 10:44:19 +00:00
Tobias Hunger
b173f0b905 CMake: Treat OUTPUT_DIRECTORY as relative to top level build directory
Treat a relative path in OUTPUT_DIRECTORY as relative to the top level
build directory, not to the current build directory.

Change-Id: I4d409d1362a8f73d13b93cf5ab98e82e60dd62cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-20 10:38:32 +00:00
Alexandru Croitor
a9af99c926 Add windows platform plugin and its requirements
- executed pro2cmake script on windows qpa plugin
- added windowsuiautomation platformsupport project
- fixed plugin dlls and lib files to be written to the same path
- fixed an issue comErrorString which used implicit casting
  from QString to char*, but plugins are currently built
  with QT_NO_CAST_TO_ASCII

Task-number: QTBUG-74140
Change-Id: I5db3b6c5264bbd5dfba2998b049fda36eb312c70
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-18 15:35:07 +00:00
Alexandru Croitor
3f03917b54 Fix Windows build
- Fix qmake build
- Fix QtNetwork moc-ing, by including the moc files
  inside the cpp files
- Fix sql odbc plugin by including QT_PLUGIN define
- Fix Boostrap to link against the Platform target, to get the
  correct Unicode and WIN64 defines.
- Fix vulkan headers to be found
- Fix freetype bzip and png unresolved symbols / linker issues
  when building minimal platform plugin (also need to make
  sure to use the vcpkg toolchain instead of CMAKE_PREFIX_PATH
  because then find_package is overridden, which does magic
  to properly propagate static library dependencies).
- Fix qfilesystementry test not to be built without private
  tests feature (it led to undefined symbols issues).
- Make sure to remove QT_NO_CAST_TO_ASCII define when building
  QtCore, so that the qstringbuilder3 test builds
  successfully.

Task-number: QTBUG-74140
Change-Id: I353d08392b604d55f8e62cdd8696d1e19a3c084a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-18 15:34:52 +00:00
Alexandru Croitor
e5b2699750 Do define generation after feature evaluation
Instead of generating defines guarded by feature ifdefs,
record the define information (condition, name, value, etc),
and generate the final define statement only if the feature
condition evaluated to true.

This removes the need to generate feature defines
(QT_FEATURE_foo) for features that have neither public nor
private outputs in the configure.json file.

Also note that all qt_feature_definition() calls
(which correspond to type:"define" outputs in json files)
now generate defines only in the public header, which seems
to be consistent with how qmake evaluates json files.

Change-Id: I5210b405d5735dd9df5f7a55d1ea9547bb7b1159
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-18 15:34:13 +00:00
Tobias Hunger
64147fcb33 CMake: Add QT_CFLAGS_* when building x86simd tests
Change-Id: I5caa088d517cb9d3749c3ed8ef88a41552c1d340
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-18 12:33:44 +00:00
Tobias Hunger
6e16f127ad CMake: pro2cmake.py: Handle SIMD sources
Change-Id: Ib445888e769432e8c247ae2d2fb5d8af2d5cd275
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-18 11:37:47 +00:00
Alexandru Croitor
6ca047aba9 Use qt_evaluate_config_expression for feature enable conditions
Certain features like opengles2 can be enabled or disabled based
on the conditions that are specified in the ENABLE and DISABLE
parameters.
Because some of those conditions use STREQUAL with
a single quoted argument, we have to use
qt_evaluate_config_expression to circumvent the CMake bug
regarding single quotes, which is described in the function
implementation.
Only then will enabling / disabling work correctly.

Change-Id: I3b68ef611c985f0d8416fd089055fd862da1e542
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-03-14 13:56:30 +00:00
Alexandru Croitor
ea7d13de0d Update README to mention setting the vcpkg toolchain
Change-Id: Icac2ba956246901e02bb6aa257f81cccf56560e8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-03-11 16:54:10 +00:00
Alexandru Croitor
af8413af15 Fix header Depends file generation
The script used to write incorrect dependency headers due to not
clearing the qtdeps variable at each loop step.

Change-Id: Icf293be7cea596daa096ab19d390c0bb468a8654
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-03-11 14:12:06 +00:00
Tobias Hunger
becbe4df3a Improve add_qt_resource function
* Handle BASE to give the directory files will be relative to.
* Support lang="foo" for qresource sections.

Change-Id: I36087220d03789a97105dc6dd1aca7a25a063d9f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-11 09:14:33 +00:00
Liang Qi
997c869280 cmake: fix the order of parameters for homebrew
Change-Id: I7b597a8d6bc81eafb21e5368a29700638c351bdf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-07 09:42:46 +00:00
Alexandru Croitor
e3c2d74506 Update README to specify the minimum version of CMake needed
Change-Id: I10e594859129bddfa56f078389b2272a0072fda0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-03-07 09:34:04 +00:00
Mikhail Svetkin
25ee3d1c3b cmake: Fix moc on macOS
moc does not generate moc_defs.h and that's why moc does not understand
that he runs on macOS.
It happens because cmake can not find Qt version.

Change-Id: I34c51ebb69dc1ff782a0f129e114cda819122805
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-06 13:17:48 +00:00
Tobias Hunger
e1de70933e CMake: Handle gc-sections linker flags
Add a function to set gc-sections flags on the linker.

Change-Id: I9ac02364836d2aa8de239adb8d3a5d29659a4007
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-04 15:37:48 +00:00
Alexandru Croitor
58bd86443c Fix usage of linker -no-undefined flag for macOS
Change-Id: I41c55871a8db3d860fc20ad17eb9a97b01d62448
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-27 16:11:43 +00:00
Mikhail Svetkin
885494c50f CMake: Fix build without double-conversion on macOS
Change-Id: I5102e93141eec95044df44884dcf6ecd1b9e8dd0
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-02-27 15:28:11 +00:00
Albert Astals Cid
a25f9a1507 cmake: Start adding compiler flags
Only has warnings for now

Next to come is the support for developer-build and enabling Werror

Change-Id: I8070dc06eb439c2a03007cce975c8147ff7e1582
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-21 13:51:19 +00:00
Albert Astals Cid
632d014afd cmake: set a CMAKE_BUILD_TYPE if none was specified
Because the default "empty" CMAKE_BUILD_TYPE is a weird default

Change-Id: I5768f67aa85dce4108e421d2f4eacdfb1cb5beb0
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-21 13:51:05 +00:00
Simon Hausmann
22bd8576cb Update FindEGL.cmake from upstream
Upstream commit 7c64db9568296e1caafcfd7163cea3ab1b1626ae fixed the
suffix path checking and thus the build on FreeBSD.

Change-Id: I0cceeac0639c2899c617ffd6359098d2154acf5b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-20 09:33:28 +00:00
Simon Hausmann
d61b6ea30a Add support for building conveniently with ccache
Pass -DQT_USE_CCACHE=ON to enable the use of ccache. This avoids having
to set up symlinks, which is useful when cross-compiling against
different targets.

Change-Id: I023fff105baaa538730997948aa122d2678887ce
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-19 08:59:12 +00:00
Simon Hausmann
c604a1265a Fix use of uic when cross-compiling
Don't try to build uic but instead import it. This is done centrally now
in add_qt_tool.

Change-Id: I241fbb924de68549e9c0320e157351bd7b1bf5c3
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-19 08:45:35 +00:00
Simon Hausmann
b2f03791c1 Provide some basic instructions for cross-compiling and using CCache
Change-Id: I8bb90746d0cef2ea61a5494ef358713d732dcfce
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-19 08:45:19 +00:00
Kevin Funk
cf7426e8c9 cmake: Make sure to finddeps of private target
Public interface libraries of the private target need to be first looked
up via `find_dependency(...)` in the CMake config files as well.

This patch is just changing the foreach() loop and defer the package
config file generation.

Change-Id: Iecaf7f778379b526f12ac6a42e76d714d9349b2c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-14 07:39:21 +00:00
Kevin Funk
0896e203d6 cmake: Make sure QT_SYNCQT is persisted
Lifetime of the variable is bound to the function body. Use a CACHE
variable to escape it (and to speed up future calls to the function).

Change-Id: I2d164a1c94e64cc652e65c1eea0522f3d911ad82
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-14 07:38:50 +00:00
Kevin Funk
b2337e1d00 cmake: Make sure QtModuleConfig.cmake.in is found
... when QtBuild.cmake is being included from another Qt module

Change-Id: Ia55e03422cc84a56dd9eac640621e5b2ee9681bd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-14 07:38:47 +00:00
Kevin Funk
766701a9b2 cmake: Install all necessary .cmake files
... for other modules

Change-Id: Iea184036a46816e524de247e1d650ae417de294c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-14 07:38:45 +00:00
Kevin Funk
e1a750a102 cmake: Minor fix in QtModuleConfig.cmake.in
Change-Id: Ia01e935582b5291fa8ed6bf46866fbb74d41f4b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-14 07:38:40 +00:00
Kevin Funk
f0d6fd6b95 cmake: Also use -Wl,--no-undefined for Clang
Change-Id: Ida6bf41e496a0e800f1146d15edf192d0635a3c9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-13 11:48:02 +00:00
Simon Hausmann
cdab00c7ee Replace "our" FindEGL.cmake with the ECM version
The ECM version now also does a compile test, which was the only real
"functional" difference.

Change-Id: I1d5cd590359feba7c7a38ff374992349d5943070
Reviewed-by: Volker Krause <volker.krause@kdab.com>
2019-02-13 09:40:50 +00:00
Simon Hausmann
96c0dc07a7 Use rpath by default not only for building but also installed binaries
This makes it possible to use the binaries out of the box. This is
particularly relevant for program binaries that link against QtCore
dynamically, when trying to use these binaries during cross-compilation.

Change-Id: I7dee93194be3fff5c6e3bbb9e202e4cf5e19b6d0
Reviewed-by: Volker Krause <volker.krause@kdab.com>
2019-02-13 08:59:49 +00:00
Albert Astals Cid
9a01b4312b cmake: set WrapOpenGL_FOUND to ON
Otherwise the cmake summary at the end says
-- The following packages have not been found:

 * WrapOpenGL

It's OpenGL or GLESv2 that will show there as missing if needed

Change-Id: I182f1299b86e1a4e24762d0bad6533c6136cbbcc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 17:01:36 +00:00
Volker Krause
cc8e2c4572 Use CMakePushCheckState
Change-Id: I58d779674363a7f7db4a7ea4ca4a9f4a9e271798
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 16:02:58 +00:00
Simon Hausmann
1f96506748 Fix build without Vulkan
The syncqt generated headers are optional, i.e. their source may not
exist -- so for now make their installation optional (as it seems to
have been the case with qmake).

Change-Id: Ieaeb3d13a1d8ff1f158b5b1c918750fec48d3bef
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-12 15:33:06 +00:00
Simon Hausmann
519ef817ff Fix Desktop GL/EGL/GLESv2 linkage
This change fixes a few things in one go:

  * cmake's FindOpenGL cannot be used reliably to detect EGL. So use a
    custom module for that.
  * Added a custom module for GLESv2 detection, as cmake's FindOpenGL
    does not support that.
  * Map CONFIG += opengl to a WrapOpenGL target, which links against
    either GLESv2 or libGL - just like mkspecs/features/*/opengl.prf
  * cmake's FindOpenGL remains in use solely to detect the availability
    of desktop gl.

Change-Id: I9315e5ad1fd88e1b7dc7e920053e98fb51fea7fc
Reviewed-by: Volker Krause <volker.krause@kdab.com>
2019-02-12 14:57:30 +00:00
Liang Qi
73a3a96c7b cmake: update README.md
Added info for using homebrew on macOS.

Change-Id: Ie425793d3de1e72a9342f6c2aaf67a4f85592f3a
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-12 14:05:11 +00:00
Albert Astals Cid
9bef044a0b cmake: Search and enable the sqlite[3] plugin
Added to QtFeature.cmake a way to be able to run feature_module begin
and end without having an actual module by passing NO_MODULE

Change-Id: Ib708bd3878e2591da193d18563c8932cc4b75e7f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 14:02:22 +00:00
Simon Hausmann
0867dbf2f4 Fix finding syncqt when "cross compiling"
This is not quite the correct design yet, but makes the existing
mechanism work first.

Change-Id: Idbc6f1380adc955a772eb6e5beb6b3a5f7f686bb
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-12 14:02:03 +00:00
Simon Hausmann
f1b688bc7c Fix qt_config_compile_test when cross-compiling
When we do

    qt_config_compile_test(egl_x11
        LABEL "EGL on X11"
        LIBRARIES X11::X11
        ...
    )

then check_cxx_source_compiles() aborts if the provided targets do not
exist (we map LIBRARIES to CMAKE_REQUIRED_LIBRARIES). However we just
want the test to fail. Therefore this patch verifies the presence of the
targets.

Change-Id: Ibd7c1b50d585339af0ca0de58bc5c9cd64d65d6d
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2019-02-12 14:01:26 +00:00
Kevin Funk
988162eaf8 cmake: Start to use ConfigExtra.cmake files
Enables the use of e.g. QT_NO_DEBUG in compiler flags, -fPIC, passing on of
QT_NAMESPACE, etc. pp.

Dropping a lot of custom code which handled adding imported targets for
the command-line tools (this is all being handled by CMake already).

It needs to be investigated if we need to resurrect
Qt5GuiConfigExtras.cmake.in in one way or the other.

Change-Id: I4fa141b68fddaad4f33e628c59d5d0b3a7b3a096
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 13:37:08 +00:00
Albert Astals Cid
05aeaed906 Find mtdev and use it
Change-Id: I90db48efaa6a23add770fcf69b46c4f4c84866c1
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-02-12 13:35:07 +00:00
Jean-Michaël Celerier
bb2ae3e409 cmake: replace unused macro with a proper value
Change-Id: Icc2b5a63fc503aa99bbb0c8ee9ffddc985e0e3da
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 11:28:08 +00:00
Kevin Funk
4bfd6c010b cmake: Create Qt5 compat targets in config files
For now create targets a la "Qt5::Core" to stay compatible with the
current Qt5 naming scheme. The name is controllable via a CMake option.

Change-Id: If43c058221949b1900c2093f39ccc9d0f38028f1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 11:09:03 +00:00
Kevin Funk
b3560a66ae cmake: Set up VERSION/SOVERSION properly
Change-Id: Ic8cddf5ec8182873a6b1e03c76f514284b423322
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-12 11:08:28 +00:00
Albert Astals Cid
ac96d08b9d cmake: find gtk3 and build the gtk3 platformtheme
Change-Id: I7db7321a2fd5ea0eda1924f3dece3b1c86d87d10
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:16:28 +00:00
Albert Astals Cid
f18db41f85 cmake: Find tslib and build the tslib plugin if found
Change-Id: I7119ddf473a3ede29bbfef23cffb08a4fcbd5681
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:16:17 +00:00
Kevin Funk
2635ab01d2 cmake: QtFeature: Do not error out when using Qt
... outside of qtbase.git

Change-Id: I1895ef07c881766e2b28839d0422916b6916e10e
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:14:01 +00:00
Kevin Funk
c5e2838b64 cmake: Make find_package(Qt5 ...) work properly
Introduce a new cached variable INSTALL_CMAKE_NAMESPACE for defining the
prefix used for CMake config files (c.f. "${PREFIX}Core/${PREFIX}CoreConfig.cmake")

Also make sure to `find_dependency(...)` the required packages inside
the individual CMake config files. I.e. in Qt5WidgetsConfig.cmake,
search for Qt5Core, etc. pp..

Change-Id: Idc027925fe9d5323091c4853803ad5ce44b1afc6
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 17:13:51 +00:00
Kevin Funk
082a7c4655 cmake: Parse SYNCQT.INJECTIONS
Allows to install headers such as QtCore/qtconfig.h,
QtGui/qvulkanfunctions.h, etc.

Change-Id: I93f384cdc8bbee07fab316d7e232aae1d209f33e
Reviewed-by: Jean-Michaël Celerier <jean-michael.celerier@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 16:51:27 +00:00
Albert Astals Cid
5716bcf6f7 cmake: we need to find for libudev not udev
Change-Id: I36bac8c01d8de2b151c3d4d89607d26ac8add3d2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 13:20:45 +00:00
Kevin Funk
99e14037e2 cmake: QtFeature add debugging aid
Persist the target name in the CMake cache description

Change-Id: I124a8b89e5845d12301993b0546c8d5c91b8d8bb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 10:53:50 +00:00
Kevin Funk
04ff8b5b6a cmake: Do not rerun try_compile invocations
Change-Id: I5eccf9f810d7ee55a311884bd5cf483f8086bae6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-02-11 10:53:41 +00:00
Albert Astals Cid
2ce3f440f9 Allow passing libraries to qt_config_compile_test
Fixes cxx11_future and ipc_posix tests

Change-Id: I0f3a7b1a0452724c07198a87c2fc25344e7451eb
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-11 09:26:08 +00:00
Albert Astals Cid
b6306cb066 cmake: Only use the doubleconversion cmake config if "valid"
And by "valid" i mean if it returns the double-conversion::double-conversion
target that we are going to use later. Fedora rawhide has a
doubleconversion cmake config file but it doesn't define any target

Change-Id: Ib0360bc9fdf593a14510c9a2d59b47b32bc4b356
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-01 12:26:43 +00:00