Commit Graph

504 Commits

Author SHA1 Message Date
Leander Beernaert
cb1fbfa1a0 Remove qt_add_qml_module() from QtBuild
This bit is being move to QtDeclarative as it is not required to build
QtBase.

Change-Id: I7b559b8b0e33e66d92c97c93bc43b650e7150237
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-06 12:22:09 +00:00
Leander Beernaert
2c297ac598 Load module specific extensions for QtBuildInternals
This patch enables each module to load their own
Qt${version}ModuleBuildInternals.cmake to expose module specific
features when building Qt.

These scripts are only loaded when the package QtBuildInternals has been
loaded.

Change-Id: Ie58dd93ddd292cf106fe7ef147151a51fd5aa2b1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-06 12:21:58 +00:00
Leander Beernaert
a43f2a6caa Safeguard against multiple definition of dbus-1 target
Change-Id: Ibba9ce7ce472fe2939386065087f0b07ad811c3f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2020-02-06 12:21:49 +00:00
Leander Beernaert
225113d59b Fix qt_add_qml_module() for non-prefix builds
Always set the installation directory for Qml modules as it is required
for qt6_add_qml_module() to set the correct properties so that qml files
can be copied to the right location.

This patch also fixes the copy of qmldir. As it previously stood, the
copied file was not complete as it is possible fore the contents to
change after we exit this function.

Change-Id: I974269cf0507664b005a93bf27ab19941d99f1d6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 15:18:31 +00:00
Leander Beernaert
20bb59ca61 Allow manually specification of moc.json files for metatype generation
qt6_generate_meta_types_json_file() has been extended to allow the
generated moc_....cpp.json files to be manually specified. This now
enabled the metatype generation to be used without resorting to AUTOMOC.

Additionally, Core_qobject declaration order has been temporarily moved
as it otherwise does not produce the correct metatypes dependency file
for Core. This will be fixed in a follow up patch.

Change-Id: I3266ab3073db478458a0c1dbc8b9fbab16622a64
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 15:18:03 +00:00
Alexandru Croitor
c5b61d2e90 pro2cmake: Handle QT += core-private correctly for modules
If a module project (Quick) contains QT += core-private, the
qmake semantics translated to CMake would mean the following:

target_link_libraries(Quick PUBLIC Core)
target_link_libraries(Quick PRIVATE CorePrivate)
target_link_libraries(QuickPrivate INTERFACE CorePrivate)

Whereas a QT_PRIVATE += core-private only means
target_link_libraries(Quick PRIVATE CorePrivate)

without adding any public dependencies to QuickPrivate.

To achieve that, we need a few modifications to both pro2cmake and
QtBuild.cmake

- pro2cmake doesn't automagically add public and private dependencies
  to targets when encountering a private module assigned to QT.
  Instead it generates the logic described above by passing correct
  LIBRARIES, PUBLIC_LIBRARIES, and PRIVATE_MODULE_INTERFACE values.

- pro2cmake doesn't do any dependency magic for non-module targets
  anymore, like executables, plugins, internal_modules. This means
  that QT assignments are now regular public dependencies.

- qt_add_module and qt_extend_target now accept a new
  PRIVATE_MODULE_INTERFACE option.

- qt_extend_target does not automagically make private modules be
   public dependencies on other private modules.

- qt_extend_target correctly assigns PRIVATE_MODULE_INTERFACE values
  to Private module only. For other target types, it's a no-op.

The change requires regeneration of all projects.

When we fix pro2cmake and QtBuild.cmake to properly handle
internal_modules (create only Private modules without creating
a non-Private counter part), we will need another project regeneration
to correctly assign dependencies.

Change-Id: I4c21f26b3ef3b2a4ed208b58bccb65a5b7312f81
Task-number: QTBUG-81780
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 14:36:16 +00:00
Samuli Piippo
4ddd4bf1aa Add additional include path for DRM
Tegra has drm.h header in include/drm instead of include/libdrm

Both paths are defined in libdrm.pc, but those are not used since this
cmake file searches only for xf86drm.h.

Change-Id: If1e979c7d5aec520b18eed5b3fcbb5ac2e15cc62
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 12:54:51 +00:00
Samuli Piippo
0f8039140c qtbase: don't use neon flags on arm64
NEON is mandatory for aarch64 and compiler doesn't recognize
-mfpu=neon commandline argument.

Change-Id: I36e9c40e3fd3604d4895da0526152e90b2165770
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 09:45:14 +00:00
Samuli Piippo
e1170185e3 qtbase: use syncqt.pl from QT_HOST_PATH
Use syncqt.pl from QT_HOST_PATH if that is given, since qtbase
sources might not be available and CMAKE_INSTALL_PREFIX doesn't
check for sysroot.

Change-Id: I165b17a5a02fd4dbb2340bf69a641b8aaab8fabd
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 09:44:10 +00:00
Leander Beernaert
7e2c198e90 Remove retained quick compiler resource files
Remove retained file feature as the expected behavior now is for the
compiled file to be retained by default.

Change-Id: I5a791a182825b223eb4497970fbb1c47c70135cc
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 09:27:27 +00:00
Leander Beernaert
465949420a Update add_custom_command and add_custom_target dependencies
If we don't add the executable used by the custom_target and/or
custom_command to list of the command's/target's dependencies
(DEPENDS) the generated file will not update should the executable
change.

Change-Id: Idce30f3dd4f756d9e8f6848c5e16f5dd6c7c8f0a
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-03 08:07:03 +00:00
Christophe Giboudeaux
4954adea39 Don't hardcode the include directory name
Hardcoding "lib" caused build issues and wrong
INTERFACE_INCLUDE_DIRECTORIES paths in generated CMake configuration
files if INSTALL_INCLUDEDIR pointed to a different location.

Contributes to QTBUG-81289

Change-Id: I3276ecbb4bf5df1c0b4c496c0287b4a69586d683
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-31 12:41:47 +00:00
Christophe Giboudeaux
3f386095ad Don't hardcode the library directory name
INSTALL_LIBDIR may point to a different directory than "lib".

Contributes to QTBUG-81289

Change-Id: Ia8220515e3ee3703539aa28655e6c806736615ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-31 10:10:10 +00:00
Christophe Giboudeaux
7f6eb6ead6 Don't hardcode the binary directory name
INSTALL_BINDIR may point to a different location than "bin". In order
to avoid errors when trying to install qtbase, "bin" is replaced with
"INSTALL_BINDIR" where necessary.

Contributes to QTBUG-81289

Change-Id: I1d4f9fb2617547c9b0e44d6690caebb2b6768e2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-31 10:09:47 +00:00
Christophe Giboudeaux
5fc2882ac5 Add INSTALL_MKSPECSDIR to the install locations
Linux distributions may want to install mkspecs files into a
different subdir in order to make Qt6 co-installable with
older versions.

Contributes to QTBUG-81289

Change-Id: Ie4a64370d742948d5ca4f2eaed6ea550d2676707
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Christophe Giboudeaux <christophe@krop.fr>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-31 10:09:39 +00:00
Alexandru Croitor
2ed9aeb687 Fix CMAKE_BUILD_TYPE to be force set
Otherwise CMake sets an up an empty default value itself, and then
the value in QtBuildInternalsExtra does not end up being used, and
then QtSetup ends up setting a Debug value.

Amends 34a112e383

Change-Id: If97a1d8c19ad5e7f690283997ff80dd9588cd521
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-30 20:45:17 +00:00
Leander Beernaert
67ea445f09 Append to AUTO_MOC_OPTIONS in order not override existing value
Change-Id: Id1bf607e31ee2baa5ffb6d6b4aedd98ea83e5e15
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-29 15:55:49 +00:00
Leander Beernaert
f47efdac1d Only add --automoc-json to AUTOMOC_OPTIONS for metatypes targets
Change-Id: I7c2e859a83ea78c2a6cf2ad59c175c1b29a74621
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-29 15:36:55 +00:00
Leander Beernaert
a6ccef651d Generate metatypes dependency file
Due to generator expression it is impossible to recursively evaluate the
link dependencies of a target. This is required by QtDeclarative's
qmltyperegistrar.

To overcome this we generate a ${target}_metatypes_dep.txt file which
contain lines with the following pattern:
${PATH_TO_METATYPES.json}=${PATH_TO_METATYPES_DEP.txt}

This can be used to recursively evaluate the dependencies at run time.

Change-Id: Ia4cee0632c16ba9631e0289db906fe9d320844a3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2020-01-29 14:20:54 +00:00
Alexandru Croitor
34a112e383 Fix CMAKE_BUILD_TYPE to be a cache variable in QtBuildInternalsExtra
Rather than pass the build type in the wrapper, make sure the build
type is a cache var, so it gets picked up when building other repos.

This reverts commit f72ca4cf85.

Change-Id: I5d91ab66249b6c40c5e548b0eec0e467ba0f2ebc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-01-29 11:56:27 +00:00
Leander Beernaert
f72ca4cf85 Forward CMAKE_BUILD_TYPE, if available, in qt-cmake
Change-Id: I299e16cfc084b3fc009e806902e26121ebdd454b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-01-29 09:39:32 +00:00
Alexandru Croitor
fd590b9482 Don't create convenience plugin target when not needed
If the OUTPUT_NAME of a plugin is the same as the CMake target name,
don't try to create a custom target with the same name. That will
cause configuration errors due to duplicate targets.

Amends f67d8ae2d4

Change-Id: Iaea7c68e22dbc1e345ba10950c312618abba4c21
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-27 14:21:58 +00:00
Alexandru Croitor
b714219fea Fix qt_import_plugins compatibility with Qt 5
Handle versionless plugin names passed to qt_import_plugins.

Task-number: QTBUG-74137
Task-number: QTBUG-80477
Change-Id: Ic7fb6e54d2822c7eb58a7874b4a1c137f0c101d9
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-27 11:59:51 +00:00
Alexandru Croitor
f67d8ae2d4 Fix plugin target names to be compatible with Qt 5
In Qt 5, qmake generates CMake Config files which expose the plugins
as imported libraries. The name of these libraries are derived from
the plugin class name. So QCocoaIntegrationPlugin, and not qcocoa.

To keep compatibility between Qt5 and Qt6 CMake target names,
the pro2cmake script should generate plugin target names based on the
plugin class names.
To avoid passing the same name in qt_add_plugin (target and CLASS_NAME),
derive the class name from the target if the class name is
not explicitly specified.

Also add a new OUTPUT_NAME parameter which is used to change the
final file name of the plugin, so that it's compatible with Qt5.
For example to generate a qcocoa.dylib file, instead of
QCocoaIntegrationPlugin.dylib file.

The same OUTPUT_NAME value will be used for generation of plugin .prl
files for qmake consumption.

Change-Id: I4d53e680d7beb62befecd359cdf6bba60a34ff0d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-27 11:49:11 +00:00
Alexandru Croitor
c9bea1ad62 Add initial support for CMake "Ninja Multi-Config" generator
This allows doing debug_and_release builds with Ninja on all
platforms.
The "Ninja Multi-Config generator" is available starting with CMake
3.17.

Desired configurations can be set via CMAKE_CONFIGURATION_TYPES.
Possible values: "Release, Debug, RelWithDebInfo, MinRelSize".
For example -DCMAKE_CONFIGURATION_TYPES="Release;Debug".

The first configuration is the 'default' configuration which is
built when calling ninja with no arguments.

To build all targets of a certain configuration use "ninja all:Release"
or "ninja all:Debug".

To build all targets in all configurations use "ninja all:all".

Note that the first configuration influences which configuration of
tools will be used when building the libraries for all configurations.
In simple terms, when configured with
-DCMAKE_CONFIGURATION_TYPES="Release;Debug" the release version of moc
is used by AUTOMOC.
When configured with -DCMAKE_CONFIGURATION_TYPES="Debug;Release"
the debug version of moc is used by AUTOMOC.

Framework builds and Ninja Multi-Config don't currently work together
due to multiple bugs in CMake, which ends up generating an invalid ninja
file with duplicate rules. There are also issues with placement of the
debug artifacts.

This will be handled in a follow up patch after CMake is fixed.

Task-number: QTBUG-76899
Change-Id: If224adc0b71b7d1d6606738101536146aa866cd7
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-27 11:47:57 +00:00
Leander Beernaert
cce8ada814 Support for QML Type Registrar
Change-Id: Ifc1f44cf40b22c20ab768333ba9d5ce58a5f7250
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-24 12:29:30 +00:00
Alexandru Croitor
d1be8b9ceb Fix dependencies for SIMD object libraries in macOS framework builds
This manifested in Coin when ninja tried to build qdrawhelper_sse2.cpp
before the Core framework headers were copied, resulting in a
fatal error: 'qatomic.h' file not found.

Make sure every SIMD object library has all PRIVATE dependencies of
its parent library PRIVATE dependencies (except for other SIMD object
libraries), to make sure that the framework headers are copied by the
time the SIMD source file is compiled.

Here's an example for clarification. Gui_simd_sse2's LINK_LIBRARIES
property should have all the values of Gui's LINK_LIBRARIES property
(like Qt::Core) filtering out all SIMD object library targets (
like Gui_simd_sse2, Gui_simd_sse3, etc).
Thus we make sure the SIMD object libraries are built after Gui's
dependencies are built.

Note that using INTERFACE_LINK_LIBRARIES to avoid the filtering of SIMD
targets in the generator expression would only work in shared Qt builds.
In static Qt builds where PRIVATE dependencies become PUBLIC, CMake would
insert $<LINK_ONLY:Gui_simd_foo> entries in INTERFACE_LINK_LIBRARIES
which causes CMake to be confused and fail at generation time.

Change-Id: I246c1394b9c9830c0ebd11e6621e56b992a6a1f2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-22 12:36:06 +00:00
Leander Beernaert
3854b5892b Add QT_TEST_RUNNING_IN_CTEST environment variable for test
When running tests with CMake's CTest, set the environment
QT_TEST_RUNNING_IN_CTEST to 1. This can be useful to deal with tests
that do not properly work when running from CTest.

For instance, the qmake test in this patch has one test that only works
when not run from CTest.

Change-Id: I01eea9131de69c18118a9ed9f96e9296d5ea20f1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-14 13:24:55 +00:00
Leander Beernaert
1f2cdd8a04 Add support for test timeouts
Change-Id: Iba805cbc16d179e5b080ccc00542329270075aa1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-13 12:28:24 +00:00
Leander Beernaert
108393d33b Fix Generator Expression for static non-prefix builds
Change-Id: Icd32164943d7bb0639de3022bae749d0010674fc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-10 10:18:55 +00:00
Jean-Michaël Celerier
ea81b69cde Implement qtbase fixes for superbuilds
Change-Id: I0d3445cf0740e3925fa9342dac4d07892518afe5
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-08 10:42:21 +00:00
Leander Beernaert
a182efb9c4 Fix is_framework check for interface libraries
Change-Id: I59832e698eceb98a2a03f4a3e2de88b1d18fda6e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-01-06 15:05:44 +00:00
Joerg Bornemann
4b2de41b13 CMake: Add support for framework builds
Framework builds are enabled by default on macOS.
They are controlled via the framework feature.

Task-number: QTBUG-75751
Change-Id: I00bc64672f02bbd1672508b2b5010d202984a961
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CMake Build Bot
2020-01-06 11:53:53 +00:00
Leander Beernaert
0095ff4e06 Add custom targets for documentation
Adds custom targets which take care of generating and installing
documentation files.

Every module has a global set of targets suffixed with the module
name in order for them to be unique when we implement super builds.
The targets are the same as the list below, but replace ${target}
with the module's name. Eg.: docs_qtbase.

For every target which has an qt_add_docs() call, we now create the
following set of custom targets:

* docs_${target}
* html_docs_${target}
* qch_docs_${target}
* prepare_docs_${target}
* generate_docs_${target}
* install_docs_${target}
* install_html_docs_${target}
* install_qch_docs_${target}

Fixes: QTBUG-75859
Change-Id: Ie84cb9a2dedbe7333d9a84f4d73383442deca477
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-18 14:27:01 +00:00
Leander Beernaert
ed6e6c3787 Expose Patch Version in QtConfig.cmake
Change-Id: I2166d480c0b717fc9137f8eb42d5aab7a091395d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-11 15:46:08 +00:00
Leander Beernaert
6c20ae774c Add option to specify working directory for qt_add_test
Change-Id: Iba5104cccdc613f7b2cf0d1454209578adaac824
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-12-10 13:24:10 +00:00
Friedemann Kleint
de142e8f22 cmake/README.md: Clarify some points
- Mention location of the configure.cmake
- Specify the path to the conversion scripts

Change-Id: Ia6e13a1f4d2c29f2fbaf35acdd70ab16c7175d37
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-09 14:36:52 +00:00
Alexandru Croitor
a64acbea9c Make sure to install QtModuleToolsVersionlessTargets.cmake.in
Amends 04d895681a

Task-number: QTBUG-74137
Task-number: QTBUG-80477
Task-number: QTBUG-75984
Change-Id: I617c2abf421bc1378545e5a36fd44533131ef471
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-06 15:11:33 +00:00
Alexandru Croitor
04d895681a CMake: Fix creation of versionless targets for tools
We can't use qt_internal_export_modern_cmake_config_targets_file for
executables like tools, because it's not possible to use
INTERFACE_LINK_LIBRARIES with executables like you can with libraries.
We also can't create aliases to non-global imported targets.

Instead create new imported executable targets, fish out the imported
location, and assign it to the versionless targets.

Task-number: QTBUG-74137
Task-number: QTBUG-80477
Task-number: QTBUG-75984
Change-Id: I6a3c9c67ef4699c72a6c9a627c63158dfd6557f8
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-06 11:11:16 +00:00
Leander Beernaert
05ba991d39 Fix meta types json file install for non-prefix builds
Change-Id: I76fd379dacb7db79d4ed6ca47954ae8e703842d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-05 15:09:50 +00:00
Alexandru Croitor
f4e80ea688 Clear QT_KNOWN_MODULE_${module}_TOOLS cache vars on reconfiguration
Otherwise if you configured a commit that has tool A, and the switch
to a commit where tool A does not exist anymore, reconfiguration
will fail.

Change-Id: Ibb244b9630a6f4fecd27d51ce28eceff07ba8666
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-05 14:52:42 +00:00
Leander Beernaert
0f220d473a Collect Json Metatypes from CMake's Automoc
This patch adds a new bootstrap tool which will read CMake's
AutoGenInfo.json and ParseCache.txt to determine what the current
list of json files is that needs to be passed to moc --collect-json
option.

Right now this is enabled for qt_add_module() with the option
GENERATE_METATYPES. pro2cmake has also been updated to detect qmake's
CONFIG += metatypes and to generate the above option for modules.

The implementation lives in Qt6CoreMacros so it can eventually be used
in the public facing apis.

The generated meta types file is saved under the target property
QT_MODULE_META_TYPES_FILE.

Change-Id: I03709c662be81dd0912d0068c23ee2507bfe4383
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-04 10:48:06 +00:00
Alexandru Croitor
9eea24ed60 Don't export private include paths if there are no private includes
Needed when building Qt Creator with CMake + Qt6 non-prefix build.
Specifically qttools's QtUiPlugin does not have any private headers,
but the non-existing include path was exported, which caused an error
when configuring Qt Creator.

Change-Id: I662bc502fe3134fba083bde273b7f63fe1470277
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-03 17:14:14 +00:00
Alexandru Croitor
461020a86a Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.

Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.

The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG    for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG   for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig

These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
  information for each module

Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).

These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.

In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.

This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.

The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.

Note that "c++11" like features are normalized to "cxx11".

Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.

Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.

Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-03 13:37:56 +00:00
Alexandru Croitor
55a15a1c1b Add initial support for cross-building to iOS
Tested locally with the following configurations:
- iOS device builds (arm64)
- iOS simulator builds (x86_64)
- iOS simulator_and_device builds (fat arm64 and x86_64 archives)

All iOS builds currently require a custom vcpkg fork which contains
fixes for building the required 3rd party libraries.

qtsvg, qtdeclarative, qtgraphicaleffects and qtquickcontrols2
have also been tested to build successfully.

simulator_and_device builds are also supported, but require an umerged
patch in upstream CMake as well as further patches to vcpkg.

Task-number: QTBUG-75576
Change-Id: Icd29913fbbd52a60e07ea5253fd9c7af7f8ce44c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2019-12-03 13:35:59 +00:00
Alexandru Croitor
c800a62403 Cache qt_config_compile_test results
Inside qt_config_compile_test we use two different calls:
check_cxx_source_compiles when given code, and try_compile when
given a project.

The former caches its results, while the latter does not, which means
that the try_compile calls are re-executed on each reconfigure.

Do what check_cxx_source_compiles does internally, and don't rerun
the try_compile calls if the results were computed once.

Change-Id: I2691ff08b7bb46c3fa60bbf5ed6278731c9b8e21
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-12-02 12:27:33 +00:00
Alexandru Croitor
9061f29872 Provide a way to specify extra tool package dependencies
In the qtwayland repo, both WaylandClient and WaylandCompositor
packages need access to the qtwaylandscanner tool. That means
that the add_qt_tool(qtwaylandscanner) can't use the TOOLS_TARGET
argument to associate a dependency with only one of the above
modules.

Instead add_qt_tool now allows specifying a non-existent module
name for the TOOLS_TARGET argument, which can be manually
depended on by other packages.
Actually, you could specify the non-existent module before as
well, but that didn't do everything that had to be done.

This required a bit of refactoring in how the Dependencies file
for Tools packages is created. Now the file is created in
qt_export_tools.

Two new functions were also added to allow recording additional
dependencies between packages.

Also some bug fixes were done to make it all work. Specifically
the _FOUND variable generated in the Dependencies file was incorrect.
Also there are some quotes missing when appending extra package
dependencies via the QT_EXTRA_PACKAGE_DEPENDENCIES property.

Change-Id: I167efec16dff8d036e191df3572ea72764e22bc5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-26 10:58:56 +00:00
Alexandru Croitor
8d35ad8726 Add FindWrapHarfbuzz
Apparently we didn't have a wrap find module for it before. Add one,
and add special support to handle a Gentoo broken Config file which is
exported by an autotools build of harbuzz.

Change-Id: I83cbeb817caf2610104c16713d4eac6ab6f8c63b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-25 11:58:02 +00:00
Cristian Adam
974536c4aa CMake: Do feature testing for linker flags
Instead of hardcoding which platforms and which compilers support
certain linker features, do the proper probing via
check_cxx_source_compiles.

Change-Id: I676010970d8f3a8f2a8340c5d15dfcef76fe9191
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-22 17:08:02 +00:00
Cristian Adam
f4efaf54d5 CMake: Add support for building with Clang-MinGW toolchain
Clang doesn't have a mkspec just a win32-clang, there is
win32-clang-g++ and win32-clang-msvc.

Change-Id: Iff521e955559dfb2308e377b41e86b3f62c42e70
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-22 17:06:18 +00:00