Commit Graph

839 Commits

Author SHA1 Message Date
Alexandru Croitor
9da90fab67 CMake: Use provided OUTPUT_DIRECTORY for manual tests and benchmarks
If an OUTPUT_DIRECTORY option is provided, it should be used instead
of discarding it.

Change-Id: Ie53b56616f16589f7c05ff9378d7ba2e2ba34726
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-05-19 19:09:00 +02:00
Joerg Bornemann
3dc3c0e2b6 CMake: Append to QT_CONFIG in the qt_lib_XXX.pri files
The module pri files are supposed to add their public features to the
global QT_CONFIG variable.

Change-Id: I9a1719f897747a1d89011b1f1231c05a23539def
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:29:57 +02:00
Joerg Bornemann
a12d28f467 CMake: Fix reading of INTERFACE_* properties in pri file generation
Change-Id: I3d1b1910239ada44d393f8c2c8803f33f7b64189
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:27:21 +02:00
Joerg Bornemann
3434e15ebd CMake: Fix calling finalizers with empty arguments
Change-Id: I7a826a4cd5e38882932476ef31cdb949cc1949c8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:27:15 +02:00
Joerg Bornemann
422649a59f CMake: Fix empty plugin_types value in module pri files
Avoid writing module_plugin_types-NOTFOUND into the module .pri files.

Change-Id: I2fed7b0d1c21e2233eebcaca419f522a07d22af4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:27:07 +02:00
Joerg Bornemann
c975c35eae CMake: Generate qt_plugin_XXX.pri files
Task-number: QTBUG-75666
Change-Id: I4ea0679fa0c62a486d03568525ad60697709fe68
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:27:02 +02:00
Joerg Bornemann
759da6742a CMake: Generate information about 3rdparty libs in module .pri files
For modules that are not yet ported to CMake and that use
   QMAKE_USE += libfoo
we need to provide the information about libfoo in the qt_lib_XXX.pri
files.

Also, we now generate qt_ext_XXX.pri files for bundled 3rdparty libs.

Task-number: QTBUG-75666
Change-Id: I9e4b057a197554ecb37c294c0bf09e2a2b3aa053
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-19 13:26:53 +02:00
Alexandru Croitor
b3e01d608e CMake: Use custom install script to support Ninja Multi-Config builds
Calling cmake --install . only installs a single configuration.

To install both debug and release artifacts, the install
invocation needs to be done for each configuration.

To keep the Coin instruction code simpler, delegate the looping
over configurations to a custom CMake script, and use it in the
Coin instructions.

Replace all cmake --install calls in the instructions with calls
to either call_host_install.yaml or call_target_install.yaml.

The path to the script depends on whether we are building
qtbase or another module. In the former case the script should
be called from the build dir, otherwise from the install dir.

The other distinction is whether the host or target env prefix
needs to be added.

Task-number: QTBUG-80900
Change-Id: Ied4bf739e2b1a2307f22fc79c1cfad746c8cbc44
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-19 10:16:11 +02:00
Alexandru Croitor
f240d94f14 CMake: Install non-main-config tools and executables to a subdir
When using Ninja Multi-Config, we don't want to install a "Release"
moc.exe, and then override it with a "Debug" moc.exe.

Because it doesn't seem possible to exclude installation of targets
per configuration, put the non-main configuration tools into
configuration specific subfolders like "bin/Debug", so no overriding
happens upon installation.

Introduce a new function qt_get_install_target_default_args() which
returns install destination arguments for consumption in qt_install()
calls. The function adds the config-specific suffix to the destination
for the appropriate configs.

Each call to qt_install *adds* new rules for installation,
which means that export registration needs to happen only on the first
call.

Make sure qt_add_tool doesn't ask qt_add_executable to install
yet again, to create duplicate rules.

Apply the same install arguments logic to qt_add_executable calls.

Task-number: QTBUG-80900
Task-number: QTBUG-80901
Change-Id: I3e732d27dba5bf5f8059d2878ef1e425237d383a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-19 10:16:08 +02:00
Alexandru Croitor
fae09465c7 CMake: Default to building all configurations with Ninja Multi-Config
Thus we will build both Release and Debug configurations in Coin
when cmake --build . is executed, mimicking qmake's make which
builds both configurations in debug_and_release.

Task-number: QTBUG-80900
Change-Id: If48aca249eb84e690d3f9d51a733b3a25df1f7ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-19 10:16:05 +02:00
Alexandru Croitor
06b148074a CMake: Allow using single config generators after building with NMC
Where NMC is the CMake Ninja Multi-Config generator.

The first use case is to allow building standalone tests with one
configuration even if Qt was build with multiple configurations.

Another use case is for regular Qt consumers that might use the
generated qt-cmake shell script which does not have the generator
specified (as opposed to qt-cmake-private).

Another detail is to use the first configuration from the initial
Qt configurations list (CMAKE_CONFIGURATION_TYPES) when building
standalone tests with a single config generator, so that it doesn't
default to Debug, but rather to the provided first configuration.

This matches qmake behavior, where on Windows with a
debug_and_release configuration, tests are still built against
release.

Task-number: QTBUG-80900
Change-Id: I0da91c1f91095332cfe9e38d17f440aad6a09d15
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-19 10:16:01 +02:00
Joerg Bornemann
e875f45805 CMake: Don't create *Depends header for header-only modules
Set the target property INTERFACE_MODULE_IS_HEADER_ONLY for
header-only modules, and only create *Depends header files if this
property is falsy.

Change-Id: Ic6b100787d18b3ff1f7b9d0f2b5c744018b1f295
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-16 22:02:10 +02:00
Joerg Bornemann
e5683c5e5f CMake: Add MODULE_INCLUDE_NAME one-value-keyword to qt_add_module
This value is the equivalent of qt_module.prf's MODULE_INCNAME and can
be used to specify a name for the module's include subdirectory. The
default is Qt<ModuleName>.

The include name is stored in the module's target property
MODULE_INCLUDE_NAME.

Change-Id: Ie6c8f6882ee2c3db78884ae5781593c803be3c05
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-15 18:56:27 +02:00
Alexandru Croitor
0cdcbb40a1 CMake: Enable default usage of utf8 sources for Qt consumers
And enable the same default when building Qt itself (it's implicit).

Allow opting out on a target-by-target basis, by using the public
qt_disable_utf8_sources() API call.

Change-Id: Ifc19a744d57b96b1c74a6926a0c6628c2a820464
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-15 11:47:09 +02:00
Joerg Bornemann
b82c5fa4ac CMake: Set QT_TARGET_XXX properties for Qt executables and plugins
Before, we were setting those properties only for Qt modules.
Now, Qt executables and plugins have a full VERSIONINFORMATION
resource on Windows.

Also, extend the CMake API with the possibility to pass target
information to modules, plugins and tools. This will be used in a
subsequent commit.

Change-Id: I2bb8d3637569e0eaec76f56331bc23282285d872
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-12 14:31:06 +02:00
Alexandru Croitor
bf315c5526 CMake: Make build system of installed Qt more relocatable
Aka handle CMAKE_INSTALL_PREFIX in a more relocatable way.

The following story inspired this change.

If a user wants to build a Qt repo into a different install prefix
than the usual Qt one, this will fail configuration because we
look for various things like syncqt, qdoc, etc relative to
CMAKE_INSTALL_PREFIX, which will now point to a different location
where none of the above tools are located.

The intent for such a use case is to support building Qt packages with
Conan, which sets a random install prefix when configuring a repo.

The idea is to derive the qt prefix dynamically from the
QtBuildInternals package location. Essentially it's a reverse relative
path from the QtBuildInternalsConfig.cmake file to the install prefix
that was specified when initially configuring qtbase.

Once the dynamic prefix is computed (so we know where the possibly
relocated Qt is), we can find tools like syncqt and qdoc.

This is an initial attempt to support a use case like that.

More design work will probably needed in case if tools / libs need to
be found in a location different than the Qt install prefix (so
support for multiple install prefixes / search paths).

An example of such a case would be when building qtdeclarative and
qtquickcontrols2 as Conan packages in one go. Most likely the
qmltyperegistrar tool will be located in the random install prefix
set by Conan, so building qtquickcontrols2 might fail due to not
finding the tool in the original Qt install prefix.

As to the implementation details, the change does the following:
- Dynamically computes and sets the
  QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX variable when
  find_package()'ing QtBuildInternals. It's an absolute path
  pointing to where the relocated Qt is.

- When building qtbase this variable is not yet available (due
  to QtBuildInternalsExtra not existing), in that case we set
  the variable to the absolute path of CMAKE_INSTALL_PREFIX
  (but only for the initial qtbase configuration).

- Remove QT_BUILD_INTERNALS_ORIGINAL_INSTALL_PREFIX which was used
  for standalone tests purposes. It's not needed now that we compute
  the location of the Qt prefix dynamically.

- The Unixy qt-cmake and qt-cmake-private shell scripts now
  use a relative path to find the toolchain file we created.

- The toolchain file also dynamically computes the location of the Qt
  packages, and adds them to CMAKE_PREFIX_PATH.

- A lot of existing CMAKE_INSTALL_PREFIX uses are replaced with
  QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX. This includes finding
  tool locations, mkspecs dir, path environment setup for tools, etc.

- Some places still use CMAKE_PREFIX_PATH in the following cases
  - When determining paths while configuring qtbase (valid cases)
  - When I wasn't sure what the behavior should be, so I left them
    as-is (an example is documentation generation, do we want to
    install it into the random Conan prefix, or into the main prefix?
    Currently it installs in the random prefix).

Note that relocating a Qt installation does not work for non-prefix /
non-installed builds, due to hardcoded paths to include directories
and libraries in generated FooTargets.cmake files.

Task-number: QTBUG-83999
Change-Id: I87d6558729db93121b1715771034b03ce3295923
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-07 15:41:16 +02:00
Alexandru Croitor
c70dcffbdb CMake: Replace hardcoded include dirs for the global qtbase targets
Change-Id: I22a120a0cb8ca690d224b1301b85e704364fbce0
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-07 15:41:11 +02:00
Paul Wicking
b7e3a9e504 Fix typo in readme
Change-Id: I6066eb5309ff7e6e4e6fd1b8dff65957be6d5a55
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-04 07:01:55 +02:00
Joerg Bornemann
b530ddf795 CMake: Write QT.XXX.plugin_types to qt_lib_XXX.pri files
This is needed for building Qt plugins with qmake against other
CMake-built modules.

Change-Id: Ibd6ad0b08645c798be74285b24f71add947bea88
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-01 19:11:57 +02:00
Alexandru Croitor
29bb6311e3 CMake: Add some missing MinGW defines
Task-number: QTBUG-83929
Change-Id: Iaa12f1f8652cb132bead91160a2898657de52edb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:41 +02:00
Alexandru Croitor
27aeb30b5d CMake: Limit warnings_are_errors flags to C++ and Objective-C++
Otherwise when applied to bundled 3rd party library C files,
the MinGW build fails when compiling src/3rdparty/md4c/md4c.c.

Change-Id: Ia522b10aa69aa15f239d20c65e31c84edbccee6d
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:37 +02:00
Alexandru Croitor
a876ff1283 CMake: Fix failing standalone tests on Windows
Due to the install prefix being changed for standalone tests,
the correct $qt_prefix/bin folder was not added to the PATH
environment variable when running tests.

Make sure to always include the the original qt install prefix,
even if a different install prefix is specified when configuring
standalone tests.

Amends 39090ea15c

Change-Id: I22aab732bb2bb679074a811d28d8209e1d535df3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-01 19:11:29 +02:00
Alexandru Croitor
88f6087f01 CMake: Use NAME_MISMATCHED in find_package_handle_standard_args of ECM
Gets rid of mismatch warnings when looking for various
ECM packages like XCB.

Change-Id: I0bf4db993195993df7789c032454b7883e8efd35
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-01 19:11:25 +02:00
Alexandru Croitor
c571cb71a7 CMake: Fix 32 bit Qt builds like our MinGW config in Coin
Enable sse2 and fpmath for modules when appropriate, the logic
is a port of the code in mkspecs/features/qt_module.prf.

Fix qdrawhelper.cpp to always be compiled when using GCC with a
special case. pro2cmake.py failed to handle the source subtraction
correctly.

Fixes: QTBUG-83791
Task-number: QTBUG-75578
Change-Id: Ibe32a250b266d580ad21f6c55f09fd03a14ceb82
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-01 19:11:17 +02:00
Mårten Nordheim
cacac863e7 Set QT_PLUGIN_CLASS_NAME also on public plugins
... and update handling of CLASS_NAME in qt_internal_add_plugin

Change-Id: Iec8e5f9f80df02c9ba21648535872988839f4b64
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-30 17:44:21 +00:00
Venugopal Shivashankar
f3bfee0cb6 CMake: Fix the setup for html_docs and qch_docs
Traditionally, these make targets generated HTMLs
and QCH only. This change fixes the dependency for
these targets to ensure that behavior.

Fixes: QTBUG-83877
Change-Id: Ic7c8afe5853d33fc4cc4cfd996f87e5f65df31ed
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-04-30 08:15:36 +00:00
Alexandru Croitor
8ddd3ee60b Revert "CMake: qt_find_package() enable debug behavior by default"
It broke configuration of qtwayland standalone tests, due to qtwayland
doing 3 separate qt_find_package(Wayland) calls with the same package
but different arguments in 3 different directory scopes.

The top scope didn't have PROVIDED_TARGETS argument. The rest of the
scopes did have the arguments with either Server or Client, but because
of the debug behavior above being enabled by default the dependencies
weren't registered in the Qt6WaylandClientDependencies.cmake file (and
the server equivalent).

The registration didn't happen due to the skipping logic, when a package
is found and the targets already exist.

This led to standalone tests failing to configure because they tried
linking against non-existent Wayland::Client and Wayland::Server
targets.

This reverts commit dd7e40b108.

Change-Id: I60e358a4891b84ecec0e127d9de8ab9747a6ab24
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-04-30 10:13:34 +02:00
Alexandru Croitor
39090ea15c CMake: Fix usage of correct install prefix for standalone tests
Previously configuration of standalone tests might have failed
due to CMake trying to create files in the /usr/local default
prefix.
Make sure to use a fake prefix in the binary dir instead,
unless another prefix is explicitly specified.

Change-Id: Icfcb32285aa5596abf1a918396b26673880a8d27
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-30 10:13:18 +02:00
Joerg Bornemann
062b50abff CMake: Namespace all our IMPORTED targets
CMake IMPORTED targets should be namespaced so that CMake knows that
the name refers to a target and not a file.

Use the existing WrapXXX naming scheme where applicable.

Fixes: QTBUG-83773
Change-Id: I5b0b722c811200c56c260c69e76940a625228769
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-29 23:08:32 +02:00
Joerg Bornemann
317cfb6774 CMake: Fix CMP0100 warning for bundled harfbuzz
Add a SKIP_AUTOMOC argument to qt_add_3rdparty_library and use it in
BundledHarfbuzz.

Change-Id: Ie4aa61639a5ab64f286ac539989572a9ae6bc3d5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-29 23:08:28 +02:00
Joerg Bornemann
8e63725f40 CMake: Honor INSTALL_MKSPECSDIR when generating qmodule.pri
Change-Id: I3e0cdee30590d6979658ef81978513dd20455516
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-27 16:55:38 +02:00
Leander Beernaert
bd24bf740c CMake: Fix wrong arm64 architecture
Due to the wrong string comparison, we were writing out the wrong
architecture for the arm64 builds to the deployment settings json file.
This leads to androiddeployqt tool not being able to locate the
stdlibc++.

Change-Id: I3d13b14c27f043445bf46aaca0e9f862f6ca84e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-27 12:21:29 +02:00
Leander Beernaert
43031d98fc CMake: Allow sqldriver plugins to be built as standalone
This patch allows all the sqldrivers to be built as a standalone project.
It is not possible to build each plugin separately due to the configuration
features definition being located in the sqldriver's folder CMakeLists.txt.

In other words, the project needs to be generated from the
src/plugins/sqldrivers/CMakeLists.txt file.

Fixes: QTBUG-82962
Change-Id: If41c7e3827589391830a894a9c998d2e56239562
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-24 07:41:13 +02:00
Leander Beernaert
dd7e40b108 CMake: qt_find_package() enable debug behavior by default
Without this behavior enabled by default it is currently not possible to
build QtVirtualKeyboard as a static build. We run into the error where
cmake is trying to promote the targets to be global due the XCB library
already being found by one of the modules in QtBase.

In case we wish to disable this fix, any module can simply specify
QT_FIND_PACKAGE_DISABLE_DEBUG_BEHAVIOR=ON during configuration time.

Change-Id: Id7f2ad12ddea941dda754361660c7606439cd5a4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-24 07:41:11 +02:00
Joerg Bornemann
4545eadd3e CMake: Port the 'static_runtime' feature
This feature is Windows-only and must be turned on manually.
For MSVC it sets the MSVC_RUNTIME_LIBRARY target property.
For MinGW it adds the -static linker flag.

Change-Id: I9da3b88d545b34bc34a3a80301b2dd1b5986fa88
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-23 10:09:15 +02:00
Leander Beernaert
6fbeef4c6b CMake: Add qt6_add_plugin public API
This patch adds a publicly callable qt6_add_plugin() API to create
plugins. This API is meant to cover cases such as the plugandpaint
example.

This patch also renames qt_add_plugin to qt_internal_add_plugin in order
to avoid clashes with the public API. To avoid breaking the existing
projects, a compatibility wrapper function is enabled by default unless
QT_DISABLE_QT_ADD_PLUGIN_COMPATIBILITY is specified.

Fixes: QTBUG-82961
Change-Id: If5b564a8406c90434f1bdad0b8df76d3e6626b5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-22 09:51:12 +02:00
Joerg Bornemann
8ef4edc09e CMake: Fix handling of negated feature config values
Consider a negated feature config value like the following:
qt_feature_config("foo" QMAKE_PUBLIC_QT_CONFIG NEGATE)

If this feature was disabled, it would turn up in both,
enabled_features and disabled_features of module .pri files.
Also, QT_CONFIG would contain foo.

Expected however is that QT_CONFIG contains no-foo, and only
disabled_features contains foo.

Fix this by prepending a "no_" prefix to the value, similar to the
"no-" prefix in the qmake build. The qt_correct_config function was
adjusted to recognize "no_foo" and translate it to the qmakeish
"no-foo" config value.

Config values that start with "no_" but do not correspond to a feature
are left untouched. You can still have values like
"no_valley_too_deep" or "no_mountain_too_high".

Change-Id: I23d8b18c84e04ea6dfa25cc6ccd8f7e86211b144
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-21 09:01:27 +02:00
Leander Beernaert
dc4e5af752 CMake: Move Resources API into Qt6CoreMacros
Move QT6_ADD_RESOURCE to Qt6CoreMacros in order to avoid the extra
config file step.

Change-Id: Ib445ca35c648cf344ee8795de8bdddc0f0758972
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-20 13:38:53 +02:00
Leander Beernaert
987c555220 CMake: Relocate quick compiler resource pass to QtDeclarative
Since there's no way to register callbacks or to store functions to be
called later in CMake, the only way to isolate the quick compiler
behavior for qt_add_resources() is to wrap it in a conditional check.

As soon as someone loads Qt6QmlMacros, the variable will set and the
functionality will be available.

Change-Id: I5fbdf2966e7dfdc734512a5b2b973e0ace9da5df
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-20 07:52:28 +00:00
Joerg Bornemann
34124a4b0b CMake: Make use of CMAKE_CURRENT_FUNCTION_LIST_DIR
Once we can require CMake 3.17 everywhere, we can remove the variable
set up from QtSeparateDebugInfo.cmake.

Change-Id: I91572583654054f5fa47ac1e41be23050a5a8c0b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 23:10:08 +02:00
Joerg Bornemann
30141b2fb7 CMake: Fix location of module .pri files for non-prefix builds
In a non-prefix build, the module .pri files must end up in the
mkspecs/modules subdirectory of qtbase's build directory.

Change-Id: I241f4e274d31de7c1e3c2fa8e5e26fb8747f11c5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-17 20:42:44 +02:00
Joerg Bornemann
2e89c61f58 CMake: Write QT_BUILD_PARTS to qmodule.pri
Change-Id: I4bddba38b51df3c70780d94f64a31b3040cb0bc8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:37 +02:00
Joerg Bornemann
9fc13a1188 CMake: Write PKG_CONFIG_EXECUTABLE to qmodule.pri
Change-Id: Ide61cc93d44c659740b72d085fb8b15684bc64fa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:35 +02:00
Alexandru Croitor
59756b7183 CMake: Generate qmake pri information for building with qmake
Implemented some necessary functionality to generate correct .pri
information, so that qmake can build modules.

Task-number: QTBUG-75666
Change-Id: I63281adfef3d01385928b1d8c4be0b32ac97c4d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:18 +02:00
Joerg Bornemann
bfcf36d459 CMake: Generate qmake .prl files
This commit also adds a qt_finalize_module function that is called for
every Qt module after all link dependencies have been added.

Change-Id: I489d188d05e368208a8a62828bb12fb395df54bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:10 +02:00
Alexandru Croitor
d6272d774c CMake: Make sure not to use the Qt prefix for standalone tests
We don't want people accidentally installing tests into the
Qt prefix.

Change-Id: Ic99492559875f753897a83af162253cac846a8a5
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 15:59:33 +02:00
Alexandru Croitor
f4cd66ff0a CMake: Handle super build non-prefix install prefix correctly
The install prefix in such a case is the qtbase build dir,
and not the qt6 top-level build dir. This caused issues with
certain incorrect paths being generated, including a broken
qt-cmake-standalone-test script, as well as upon reconfiguration
determining that a non-prefix build should be installed.

The fix for a non-prefix build is to check explicitly for
the qtbase build dir. This works both for super and non-super
builds.

Task-number: QTBUG-83496
Change-Id: Ida2393176c4c81da767023ff48159afdedfb0a19
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-17 15:59:30 +02:00
Alexandru Croitor
67ee92f4d8 CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.

For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.

On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).

Frameworks, app bundles and shallow bundles should also be handled
correctly.

Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).

Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.

Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.

By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .

Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.

Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.

configurejson2cmake modified to include correct conditions for the
rpath feature.

It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).

Amends e835a6853b

Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-17 15:59:25 +02:00
Alexandru Croitor
e835a6853b CMake: Fix $ORIGIN rpaths to work when passed on the command line
The CMAKE_INSTALL_RPATH cache var had the PATH type, which made
CMake transform the value into an absolute path, getting rid of the
$ORIGIN value.

Fix that by changing the cache var type to STRING.

Also clean up the all-caps commands, add a usage example and print
the install RPATH.

Change-Id: Ibf40cfde4283369ddfcf52609143799cc8e47d68
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-15 11:43:02 +02:00
Leander Beernaert
c028cbccc2 CMake: Enable Moc for 3rdparty libraries
This is required to support QtVirtualKeyboard's third party OpenWnn
library.

Change-Id: I64b6a2b6b6b0259bea5aa249a8c901def31f916c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-14 17:00:06 +02:00
Alexandru Croitor
066e8a4557 CMake: Handle missing packages in project compile tests
If a find_package() in a try_compile project doesn't find a package,
and we then link against a non-existent target, the configuration
failure of the compile test also fails the configuration of the
project.

To avoid that, separate library targets from non-targets, and make sure
to only link against the targets if they exist.

pro2cmake now outputs modified compile test project code which iterates
over targets and non-target libraries, and links against them when
needed.

Change-Id: Ib0f4b5f07af13929c42d01a661df2cabdf9b926b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-04-09 11:26:42 +02:00
Alexandru Croitor
e0346df1b2 CMake: Handle finding of OpenSSL headers correctly
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.

Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.

Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.

FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.

The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.

Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.

Adjust the projects and tests to use the new target names.

Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).

Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-04-08 22:03:24 +02:00
Alexandru Croitor
0bfbe10ff2 CMake: Implement proper exclusion of tools including installing
The previous approach didn't work for prefix builds. While a target
might be excluded from building via EXCLUDE_FROM_ALL property, when
calling make install it would still try to install the target and
thus fail.

It's not possible to modify an install() command in a post-processing
step, so we switch the semantics around.

pro2cmake will now write a
qt_exclude_tool_directories_from_default_target() call before adding
subdirectories. This will set an internal variable with a list
of the given subdirectories, which is checked by qt_add_executable.

If the current source dir matches one of the given subdirectories,
the EXCLUDE_FROM_ALL property is set both for the target and the
qt_install() command.

This should fix the failing Android prefix builds of qttools.

Amends 622894f96e

Change-Id: Ia19323a2ef72a3fb9cb752ad2d4f2742269d11c4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-07 23:22:33 +02:00
Alexandru Croitor
5c9ab44ff6 CMake: Simplify semicolon escaping in qt_config_compile_test
list(JOIN) removes a layer of escaping, which force doubling up
on the backslashes. Instead use string(REPLACE) thus making the
escaping a bit saner.

Change-Id: Ie3daf0112dd09fbcbaf8798552949470952611c9
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-07 23:22:33 +02:00
Alexandru Croitor
23be07c2d0 CMake: Autodetect Objective-C support only on macOS
On Android, check_language() reports that the languages are supported,
but enable_language fails afterwards.

On Linux it causes issues with the PCH. The PCH file might contain
a Clang pragma, even though the C++ compiler is GCC. Presumably due
to finding a Clang Objective-C compiler.

Change-Id: I1b4c54459772c089e7f6350872c87af52ad72a37
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-07 13:04:06 +02:00
Joerg Bornemann
c356380154 CMake: Remove special handling of the 'static/shared' features
configurejson2cmake handles the 'static' and 'shared' features now.
There's no need to special-case it anymore.

Change-Id: I956e9f46ebe022b1da862e986ec05f41e1e804e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-06 21:43:18 +02:00
Joerg Bornemann
2ea4320bf7 CMake: Remove special handling of the 'rpath' feature
configurejson2cmake handles the 'rpath' feature now. There's no need
to special-case it anymore.

Change-Id: I9aa9c9acdeb586de09d8a8d269909f8acb02e40a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-06 21:42:37 +02:00
Joerg Bornemann
da6f021b52 CMake: Fix build with WARNINGS_ARE_ERRORS=ON and gcc 9.3.0
Add -Wno-error=format-overflow. This is similar to what is done in
qt_common.prf, however we don't turn the warning off completely.
For now at least.

Change-Id: I93c20064759dea43309c3a17de4d733ede9ca2cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-06 17:21:45 +02:00
Alexandru Croitor
430232e44d CMake: Adjust PCH support for multi-arch iOS builds
Starting with CMake 3.18, there is PCH support for darwin multi-arch
builds, like iOS simulator_and_device builds.

Also enable PCH for Objective-C++ files when the support is there.

To enable PCH for Objective-C++, we need to do enable the OBJCXX
language as well, but conditionally, because on non-darwin platforms
the language is probably not available.

Introduce the qt_enable_cmake_languages() macro which is called
automatically by qt_build_repo_begin().

Change-Id: I0e7f44be6577ac54ce940470036626409920e272
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 21:51:06 +02:00
Alexandru Croitor
d2931a2626 CMake: Handle standalone config.tests in configure libraries section
Some library entries in configure.json have a test entry.
An example is assimp in qtquick3d.

qmake tries to find the library via the sources section, and then tries
to compile the test found in config.tests/assimp/assimp.pro while
automagically passing it the include and link flags it found for assimp.

We didn't handle that in CMake, and now we kind of do.

configurejson2cmake will now create a corresponding
qt_config_compile_test call where it will pass a list of packages and
libraries to find and link against.

pro2cmake will in turn generate new code for the standalone
config.test project. This code will iterate over packages that need to
be found (like WrapAssimp) and then link against a list of passed-in
targets.

In this way the config.test/assimp/main.cpp file can successfully
use assimp code (due to propagated include headers).

qt_config_compile_test is augmented to take a new PACKAGES argument,
with an example as follows

PACKAGES PACKAGE Foo 6 COMPONENTS Bar
         PACKAGE Baz REQUIRED

The arguments will be parsed and passed to the try_compile project,
to call find_package() on them.

We also need to pass the C/C++ standard values to the try_compile
project, as well as other try_compile specific flags, like the
toolchain, as given by qt_get_platform_try_compile_vars().

Change-Id: I4a3f76c75309c70c78e580b80114b33870b2cf79
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 16:05:19 +02:00
Samuli Piippo
af6f3cb317 qt_record_extra_package_dependency: check that target exists
The target may not be defined which causes error:
get_target_property() called with non-existent target "qtwaylandscanner".

Change-Id: I58a9122456ccbbbb8fc9f0adce3b7ddcc985e6a4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-03 08:15:55 +03:00
Alexandru Croitor
0cdb4b20d3 CMake: Remove HEADER_MODULE handling from 3rd party libs
Installing headers is not supported for 3rd party libs (we don't run
syncqt, we don't install headers for 3rd party libs to
prefix/include).

Remove the unnecessary condition.

Change-Id: I46e9af7a7ca9de0138666b0d0faffc86238672ba
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-02 10:00:23 +02:00
Alexandru Croitor
6fdeaea24f CMake: Don't try to add 3rd party includes to ModuleDepends files
When creating the include/QtShaderTools/QtShaderToolsDepends file
in QtPostProcess.cmake -> qt_internal_write_depends_file(),
we decide which include files to append based on link dependencies
starting with Qt::, which happens to match 3rd party targets like
Qt::BundledSpirv_Cross which doesn't expose headers in the
prefix/include dir.

Mark all bundled targets with the QT_MODULE_SKIP_DEPENDS_INCLUDE
property to exclude them from being added to Depends files.

This should fix static builds of qtquick3d which includes
<QtShaderTools/QtShaderToolsDepend> which tries to include a
non-existent <QtBundledSpirv_Cross/QtBundledSpirv_Cross>.

Change-Id: I9dcff1e2ab721a7c21fcff3fda0faf8d023d60ba
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-04-02 10:00:20 +02:00
Alexandru Croitor
84a7f0d3d7 CMake: Don't use escaped plugin type for on-disk directories
The path where we install plugins is usually
prefix/plugins/plugin_type/plugin_name

The plugin_type should not be escaped, so it should be used verbatim
(no escaping of slashes or dashes)..

So far it seems the only weird plugin types are wayland plugins which
contain dashes, like wayland-shell-integration, and the sub-ios plugin
which has a slash (platforms/darwin).

For cmake properties we use the escaped names.
This should fix tests in wayland where the wayland plugins can't be
found.

Change-Id: I93406731b8c872a82c0f247f5b7c6bdab4875455
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-02 09:39:41 +02:00
Alexandru Croitor
622894f96e CMake: Allow excluding tools and apps from the default 'all' target
Qt uses the qtNomakeTools() function to mark a directory which will
not be built as part of the default target. This is especially
important when cross-compiling (to iOS for example) because the build
process might fail.

The condition for not building these "GUI tool sub-directory projects"
is the absence of the "tools" value in qmake's QT_BUILD_PARTS
variable.

Introduce a QT_NO_MAKE_TOOLS CMake variable. If the value is true,
it's equivalent to "tools" not being present in QT_BUILD_PARTS.

Introduce qt_exclude_tool_directories_from_default_target().
It's the qmake counter part to qtNomakeTools().

Teach pro2cmake to generate it where appropriate.

Change-Id: If2e5958d91847ab139af0e452608510286e73fa0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-02 09:39:36 +02:00
Alexandru Croitor
560e8547b3 CMake: Report which qt parts will be built by default
Like libs, tools, examples, tests. Built by default means
they are part of the default make / ninja target.

Change-Id: I304e5724fc5dbd39626e9d589a6e1e92a4dd7882
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-02 09:39:31 +02:00
Alexandru Croitor
8c0fc9264f CMake: Don't generate docs for targets that don't exist
Such a case can happen when cross-compiling. Tools currently are not
built when cross-compiling, so if the desktop tool was not built,
accessing properties on that target would fail when trying to set up
the documentation building.

Change-Id: I2ffcbb9623df3e4daacdf4be3f48c4b2dd13851b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-02 09:39:21 +02:00
Alexandru Croitor
089a602a76 CMake: Fix usage of CMAKE_CROSSCOMPILING
Change-Id: I9557f44c4d99c8591d41512e9705791d77eb0eb3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-02 09:39:18 +02:00
Joerg Bornemann
7909de1beb CMake: Define QT_STATIC for static builds
QT_STATIC must be defined for static builds to have the right
import/export symbol macros defined. Originally, this macro is wrapped
in a condition. That's why we extend qt_feature_definition to be able
to write a prerequisite to qconfig.h.

Change-Id: I610e60acc7f5bdc031eff6d53a76e0b229a5c8c2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-01 21:19:35 +02:00
Joerg Bornemann
e0b89899e3 CMake: Fix qt_lib_XXX.pri files for modules with CONFIG_MODULE_NAME set
The function qt_generate_module_pri_file did not take into account the
CONFIG_MODULE_NAME argument of qt_add_module.
This resulted in wrong file names and content, e.g. qt_lib_test.pri
instead of qt_lib_testlib.pri.

Fixes: QTBUG-83176
Change-Id: Id6991396cf9ea5a1d155aa15402c0d84a8a9d082
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-30 14:54:16 +02:00
Leander Beernaert
9968a211f9 CMake: Fix pkgconfig calls when cross-compiling
When cross-compiling with CMake, before this patch pkgconfig calls would
find libraries which are part of the host system and not the target
system.

The current approach used is based of the discussion present in
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4478, and should
be considered a temporary solution until the issue is properly addressed
in upstream CMake.

Change-Id: I535d4d48c2a5d34689082b80501b3b6ae30d7845
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-26 12:46:16 +01:00
Joerg Bornemann
c269d8f086 CMake: Fix the re-computed value of INSTALL_*DIR variables
For INSTALL_*DIR variables that have the the same value as
CMAKE_INSTALL_PREFIX, a second cmake run cleared the value. This is
because file(RELATIVE_PATH) returns the empty string if we pass the same
absolute paths.

Fix this by checking the return value of file(RELATIVE_PATH) for the
empty string and setting it to ".".

It's a limitation of qmake that empty strings are not handled as ".".

Change-Id: I8fc4d1eabcc9d5634be2f3741b0002a347dd17e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-25 11:16:48 +01:00
Alexandru Croitor
0446bf5ba3 CMake: Fix auto-detection of precompiled header support
PCH files were only used while building qtbase. Make sure the value
is exported to the BuildInternalsConfig file, so the value is re-used
when building other repositories.

Also disable PCH when building simulator_and_device iOS builds, because
CMake doesn't currently generate separate PCH files per architecture.

Change-Id: I79955ebc557b800bc3c704deac519fe80012c229
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-25 10:46:46 +01:00
Alexandru Croitor
67af991c59 CMake: Make sure to install Qt3rdPartyLibraryConfig.cmake.in
Repos like qtshadertools need it when configuring their own
bundled libraries.

Amends 572c03eb7a

Change-Id: I540e99d5bd2938299a10220a1a5e0d97091077b3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 16:42:48 +01:00
Alexandru Croitor
7c04c5427f CMake: Fix creation of forwarding headers to be at configure time
qt_add_module checks for the existence of the following directory
include/QtFoo/6.0.0/Foo when deciding whether a private module target
should contain that path in its INTERFACE_INCLUDE_DIRECTORIES.

There are 2 cases when it's created, when running syncqt, and inside
qt_install_injections. If syncqt doesn't create it because there are no
private headers (like in qttools/src/global), qt_install_injections
created it at generation time (for injected configure headers like
qttools-config_p.h)

Unfortunately that caused the existence check mentioned above to fail,
not exporting the path in the QtToolsPrivate's include directories,
and failing the qttools build.

To fix that, create the injection files (and directories) at configure
time, using qt_configure_file instead of file(GENERATE).

Change-Id: Idd9b6ec36e986c4de95d11557170e1c70927211c
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-23 09:55:00 +01:00
Alexandru Croitor
e510a4e327 CMake: Introduce qt_configure_file
It has the same kind of signature as file(GENERATE) but
creates the files at configure time rather than generation time.

CMake provides a few ways to generate files
file(WRITE) -> always overrides content
configure_file() -> only overrides if content changes, creates file
                    at configure time, can only take a file as input
file(GENERATE)   -> only overrides if content changes, creats file
                    at generation time, can take a string or file
                    as input

Because dealing with an input file is a hassle (need to create one,
make sure it's installed, make sure it's used correctly in the
various build types like super-build, non-prefix-build, etc)
people tend to use file(GENERATE) instead, which can take a string
argument, and is thus easier to use.

Unfortunately that introduces subtle bugs because the
file is created at generation time, but there are existence
checks which are done at configuration time.

Thus qt_configure_file allows creation of files at configure time,
without having to provide an input file. Underneath it uses
configure_file(). Once CMake 3.18 is released, the implementation
can be switched to use file(CONFIGURE).

Change-Id: Ic8f8d88541ef0b25d01af143352c8c9ba390ad5f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-23 09:54:56 +01:00
Alexandru Croitor
1f442c684f CMake: Provide script to configure and build one or more tests
Before this patch there were a few ways to build tests
- Configure all tests as part of the repo build
- Configure all tests as part of the repo build, but don't build
  tests by default (-DQT_NO_MAKE_TESTS=ON)
- Configure all tests as a standalone project in a separate build
  dir using -QT_BUILD_STANDALONE_TESTS=ON

All of the above incur some time overhead due to the necessity
of configuring all tests.
Sometimes you just want to build ONE test (or a few).

To facilitate that use case, a new shell script called
bin/qt-cmake-standalone-test(.bat) can now be used to configure
and build one or more tests.

The script takes one single argument pointing to the desired test
project path and configures a generic template project that sets up
all the necessary Qt CMake private API, afterwards calling
add_subdirectory on the passed in project.

Example
$ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image/qicon

or

$ path/to/qt/bin/qt-cmake-standalone-test ./tests/auto/gui/image

After that, simply run 'ninja && ctest' to build and run the test(s).

This is the CMake equivalent of calling qmake on a test .pro file
(or on a tests SUBDIRS .pro file)

There are 3 details worth mentioning.

Due to the add_subdirectory call, the built artifacts will not
be in the top-level build dir, but rather in a nested build_dir.

The script currently can't handle more than one argument
(the path to the project), so you can't pass additional
-DFoo=bar arguments.

If a test uses a 3rd party library (like Threads::Threads)
which was not a public dependency for any of the Qt modules,
configuration will fail saying that the target was not found.
Perhaps we should consider recording these packages when
generating the StandaloneConfig.cmake files.

Change-Id: Icde6ecb839341d34f341d9a19402c91196ed5aa0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-23 09:54:48 +01:00
Alexandru Croitor
edf5fe49b3 CMake: Add global / top-level docs targets
Previously you could use either module-specific or
repo-specific 'docs' targets.
For example 'ninja html_docs_qtbase' or 'ninja html_docs_Core'.

Now there's a global / top-level target called
'docs', so 'ninja docs' works.

For super builds it will build the documentation of all
configured repositories.

For a single repo build, it's equivalent to calling
'ninja docs_repo_name'.

Also for consistency, add the "docs_Core" target, which was missing
before. So now a 'docs' target exsits for repo names AND targets.

New global target names are
- docs
- prepare_docs
- generate_docs
- html_docs
- qch_docs
- install_html_docs_docs
- install_qch_docs_docs
- install_docs_docs

Amends 0095ff4e06

Change-Id: I686be1e0962e40cbce860e8ac2cabb056b360ac2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-18 17:25:15 +01:00
Tor Arne Vestbø
77885f8402 cmake: Remove APPLE prefix from platform names
None of the other platforms have it.

Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:56 +01:00
Tor Arne Vestbø
db745fdd2d cmake: Fix naming when referring to Apple macOS
Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:52 +01:00
Leander Beernaert
1b7008a3d7 CMake: Fix Windows VM Test Runs
Simplify the handling of simd specific sources. The previous
implementation was causing simd instructions to bleed into the main
library.

The tests were failing because the avx instruction were leaking into
Qt6Gui due to the previous problem. This in turn caused any test which
required Qt6Gui code run to crash since it is not possible to run avx
instruction in the VMs.

This patch also disables PCH for the simd sources as they result in
warnings related related to using PCH header not compiled for the
architecture in question. The latter can cause the build to fail in
conjunction with warnings as errors.

Change-Id: I1be98f2f5e967f33793d6a2e6134a24ef1709566
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-16 17:30:38 +01:00
Alexandru Croitor
6e286247e8 CMake: Don't make a private module depend 1kk times on the public one
The exported INTERFACE_LINK_LIBRARIES property now looks a lot more
sane.

Change-Id: I093fcb242607023dd0b103298562b299cb803028
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-13 19:14:55 +01:00
Tor Arne Vestbø
3a2fa3fec5 cmake: Add default Info.plist for macOS with some important keys
The default Info.plist shipped with CMake lacks an NSPrincipalClass
entry, which is crucial for making macOS apps run in full resolution
on retina screens.

We make sure the file is only picked up on macOS, not iOS and friends,
since those platforms require another principal class. If needed we can
extract the value out as a CMake variable and use the same file for all
Apple platforms. Doing so would assume all keys are single-platform
only, so if that's not the case we need platform-specific files.

We should probably extract the package type out as a variable too,
so that the file can be used for both apps, plugins, and frameworks,
but doing so requires setting up that variable somewhere based on
the target type, which CMake doesn't allow in an easy way.

The file itself is based on the file CMake ships, combined with
keys inherited from Qt's existing plist templates for qmake, and
adjusted to match what Xcode generates by default these days.

Change-Id: I3f5109e5fff63cdbd109a99d4008948d4bd2102b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-13 15:23:56 +01:00
Tor Arne Vestbø
17be43c58e cmake: Disable GL deprecations on Apple platforms
Change-Id: I87b98ae68d996868cefaaf578722ac24be745145
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 17:05:10 +01:00
Alexandru Croitor
60a93a15b1 CMake: Fix incorrect argument in QtBuildInternalsAndroid
Uncovered while building qtdeclarative.

Change-Id: If1a36f2640a3a5d765e7ca74b0ba1d39ef2a18f0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:46 +01:00
Alexandru Croitor
a1867333d4 CMake: Install the QtBuildInternalsAndroid.cmake fille
It's needed when building qtdeclarative.

Needs to be copy_or_install to support non-prefix builds as well.

Change-Id: Ied59f6a1f8403be3721a0ad46f5a3b2f569028ca
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:42 +01:00
Alexandru Croitor
aa77fbca69 CMake: Don't build tests and examples by default on Android and iOS
Change-Id: Ia31733e2cadfb52d11426c40f3543bedc48342c4
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:35 +01:00
Alexandru Croitor
5804473578 CMake: Propagate minimum required C++ standard to consumers of Qt
Aka the version of C++ that needs to be supported when compiling
applications that use Qt headers (C++17 at the moment).

Change-Id: I64dec297e8329f31b1d9864f216a95782049ed06
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-12 11:41:32 +01:00
Alexandru Croitor
14546d1816 rcc: Teach rcc the --no-zstd option
It is needed when cross-building Qt using CMake, where the zstd
feature might have different values between the host and target,
in which case the build system tells rcc not to use zstd when
the feature is disabled.

Amends d20c980576

Change-Id: I9dc55b59b1be5272b79aa5f1e2daf2b516a157d6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-12 11:41:26 +01:00
Tor Arne Vestbø
39ad96033c Fix spelling mistakes
Change-Id: I389727ce9b8d3ef2a54156b682ef5aeccb39ebd2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-11 17:51:15 +01:00
Tor Arne Vestbø
cd80f347cf Update instructions for developer builds with CMake
Change-Id: I101a4b12bae393fa188bb2633cc2d74170adbb4c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-11 15:31:40 +01:00
Alexandru Croitor
1ef8470c80 CMake: Update the README regarding the minimum cmake version required
The minimum required CMake version to build Qt on any platform is
3.16.0 at the moment. That's the first version that ships the
implementation-specific AutogenInfo.json files, which we parse
to implement the Qt moc --collect-json functionality.

Change-Id: I6160cd74fa228aa330f4c1e512ffb766afc5f8a3
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-10 07:33:37 +01:00
Alexandru Croitor
37714de9a6 CMake: Remove code for old 3rdparty mechanism handling
The only two uses (QtHarfbuzz and QtDoubleConversion) have been removed,
so now the code is not needed anymore.

Change-Id: Id9ef628fa139f1431395bcdd1705463dfafb1051
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-10 07:33:20 +01:00
Alexandru Croitor
729a73a9cf CMake: Remove old 3rdparty mechanism for double conversion
Change-Id: I2b20d4d9d95a1f7f59bc506046a1ebc20eb305f7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-10 07:33:07 +01:00
Alexandru Croitor
b04d087bd0 CMake: Handle path components like INSTALL_LIBDIR more correctly
We recomputed INSTALL_LIBDIR for every new repo that is configured,
which is incorrect due losing any custom provided libdir when
configuring qtbase.

Save that information (and all other path components) in
QtBuildInternalsConfigExtra.cmake.
Make sure not to-recompute that information when configuring a project
other than QtBase.

Allow providing absolute paths instead of relative paths for these
variables.

Note that only absolute paths pointing somewhere under
the prefix will currently work, otherwise configuraion will fail. If
we need to support such a use case, we'll have to carefully check all
code that use these path components to make sure they handle absolute
paths correctly (current assumption is relative paths everywhere).

Use the computed paths when generating the qconfig.cpp file which is
used for qmake -query.

Task-number: QTBUG-81289
Change-Id: I331aa00e47988fe0ee4e533b5f95c4df11c4d96f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-10 02:16:00 +01:00
Alexandru Croitor
b9a9ff99c7 CMake: Update cmake/README with newer information
Change-Id: Ia0e723bb24b8a60dc02d2d218f5a2b5dc2b24017
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-09 23:09:24 +01:00
Alexandru Croitor
95e1469eb8 CMake: Port most of the configure summary support
Teaches configurejson2cmake about summaries / reports, so things
like enabled features, configure sections, notes, etc.

Add relevant CMake API for adding summary sections and entries,
as well as configure reports. The commands record the passed data,
and the data is later evaluated when the summary needs to be printed.
This is needed, to ensure that all features are evaluated by the
time the summary is printed.

Some report and summary entries are not generated if they mention a
feature that is explicitly exclduded by configurejson2cmake's feature
mapping dictionary. This is to prevent CMake from failing at configure
time when trying to evaluate an unknown feature. We should re-enable
these in the future.

A few custom report types are skipped by configurejson2cmake (like
values of qmake CONFIG or buildParts).
These will have to be addressed a case-by-case basis if still needed.

Change-Id: I95d74ce34734d347681905f15a781f64b5bd5edc
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-09 23:08:57 +01:00
Alexandru Croitor
627351f561 CMake: Set minimum deployment target for darwin platforms
Same value as QMAKE_IOS_DEPLOYMENT_TARGET in
mkspecs/macx-ios-clang/qmake.conf, etc.

Change-Id: I1f6a07d73c2126d0286e8d26f7e61a690607c8ce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-06 17:12:40 +01:00
Joerg Bornemann
d0911d0a92 CMake: Port the 'separate_debug_info' feature
For this, we have to uninline the separate_debug_info configure test,
because supporting the conversion of this in configurejson2cmake is not
worth the hassle.

Separate debug information can be turned on for a target by calling the
function qt_enable_separate_debug_info. For Qt's shared libraries and
tools separate debug information is generated if the
'separate_debug_info' feature is manually turned on.

Change-Id: Ic2ffc15efef3794dc0aa42f3d853ef6d651a751c
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-06 13:38:37 +01:00
Alexandru Croitor
a9caec4a92 CMake: Fix Ninja Multi-Config framework builds
Depends on a new bleeding edge feature in as-of-yet unreleased
CMake 3.18, that allows building macOS frameworks using the
Ninja Multi-Config generator targeting more than
one configuration.

It uses the new CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_DEBUG
property which tells CMake to create properly named debug artifacts
in the Multi-Config ninja file.

Without it, both debug and release artifacts would have the same
location (no _debug) postfix, so it would be unclear which file
ends up being compiled as last (the debug or release variant).

Change-Id: I3e10832551731a18317da8f9667d96cec3dc3028
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-06 00:31:25 +01:00
Leander Beernaert
98fb632f47 Add QT_MODULE_SKIP_MODULE_INCLUDES property
When a Qt module has this property set, when we generate the
QtModuleDepends header file and find this module it will not be added.
This is required to be able to create a Core_qobject module, as it does
not have any headers.

Change-Id: Iaea1080919d05ace12e48693e02d8c0f4c669339
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 16:14:15 +01:00
Alexandru Croitor
4f7cc72298 CMake: Handle conditions in third party find modules correctly
Previously the FindWrap modules checked for hardcoded features
when deciding whether to use a bundled library or not. This proved
not to work correctly because features were not available when
the find modules were processed.

Introduce a new CMake API call that needs to be manually called
after an add_subdirectory call which declares a bundled library.

The call will check for the existence of the bundled target, and will
then set a cache variable QT_USE_BUNDLED_Bundled<TargetName>.

The same variable is written into a FindWrapFooConfigExtra.cmake file
which will be loaded by the appropriate FindWrap module. The module
can that use that variable to decided whether to link against the
bundled library or the system library.

Change-Id: I75e9a4f4e14d88d4490916a79ad12f1ce57891e0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-03-05 16:08:14 +01:00
Joerg Bornemann
46a2366d12 CMake: Port the 'debug_and_release' feature
This feature is read-only. It's controlled by the multi-config feature
of CMake. It mainly exists for the qmake support.

Change-Id: I322459598fe92568eda4d42319ded444537e95d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-05 07:48:06 +01:00
Alexandru Croitor
aa5e43d491 CMake: Adapt to latest upstream Ninja Multi-Config changes
Most of the NMC-specific variables were renamed to be more general.

Change-Id: I8ee2874fecb9e57480ce51db9183c6cf3dd100af
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-03-04 17:16:24 +01:00
Joerg Bornemann
1a30a82830 CMake: Fix stack-protector-strong test and feature
And in order to do this we must teach qt_config_compile_test a
COMPILE_OPTIONS argument.

Change-Id: I66fa45142b544e3a2fc599af1c1a4c69b442b318
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-04 16:31:13 +01:00
Samuli Piippo
963017f588 Prepend prefix path after loading toolchain file
The original toolchain file may set CMAKE_FIND_ROOT_PATH instead of
appending it, which overrides the Qt's path.

Change-Id: I69a4bf4be6a999854bb8a84cf5032c6a9b739b2e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-28 08:31:34 +02:00
Leander Beernaert
92ee6dcec0 CMake: Generate Win32 Resource Files
Add support to generate win32 resources files through CMake. The
functionality is implemented via qt6_generate_win32_rc_file() in
Qt6CoreMacros.cmake.

Currently qt_add_test(), qt_add_module() and add_qt_gui_executable()
call the above function when building on windows. The function itself
has been written as part of the public API so it can be called from
other locations if required.

Change-Id: Id5388b3bf9a2068b36780d8268306326f990778c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-25 16:38:45 +01:00
Leander Beernaert
c1c011e355 CMake: Add missing linker flags for MSVC
This patch adds missing linker flags for MSVC in order to match
qmake's msvc-desktop.conf.

Change-Id: Ieb1206dae4517e8d9f36175f8fcebccd30e52d01
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-25 16:19:44 +01:00
Joerg Bornemann
119ffd4781 CMake: Port the reduce-relocations feature
As reduce-relocations implies bsymbolic_functions, we also add the
-Bsymbolic-functions linker flag.
Also, handle the .dynlist files that are passed to the linker by
bsymbolic_functions.prf in the qmake build.

Change-Id: I535c33fba888596d2f8975b16864bbe9f0a7caa4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-25 15:47:50 +01:00
Alexandru Croitor
26059d1b9b CMake: Allow building bundled 3rd party libraries in qtbase
A few things are needed to accomplish that:

- the python scripts do not ignore certain system_foo features anymore
  (it is a hardcoded list for now just to be safe)

- configurejson2cmake now outputs
  qt_find_package(WrapSystemFoo) calls for bundled libraries
  (see below)

- the harfbuzz .pro file is modified to accommodate pro2cmake
  not being able to correctly parse some conditional scopes

- the freetype .pro file is modified to make sure linking of the
  library succeeds without duplicate symbol errors, which qmake
  doesn't encounter due to magical exclusion of cpp files that are
  included in other cpp files (presumably for include moc_foo.cpp
  support)

- feature evaluation for Core, Gui, Network now happens in the
  qtbase/src directory, so that bundled libraries can be conditionally
  built

- for each bundled library there are now two FindWrap scripts:
  - FindWrapSystemFoo which finds an installed library in the system
  - FindWrapFoo which either uses the system installed library or
    the built bundled one depending on a condition

- projects that intend to use bundled libraries need to link against
  WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets
  (this is handled by pro2cmake).
  Unfortunately manually added qt_find_package(WrapFoo) calls might
  still be needed as is the case for WrapFreetype and others.

- a new cmake/QtFindWrapHelper.cmake file is added that provides
  a macro to simplify creation of WrapFoo targets that link against
  a bundled or system library. The implementation is fairly ugly
  due to CMake macro constraints, but it was deemed better than
  copy-pasting a bunch of almost identical code across all
  FindWrapFoo.cmake files.

- a qtzlib header-only module is now created when using bundled
  zlib, to provide public syncqt created headers for consumers
  that need them. These are projects that have
  'QT_PRIVATE += zlib-private' in their .pro files
  (e.g. qtimageformats, qtlocation, qt3d, etc.)
  This is unfortunately needed due to QtNetwork using zlib
  types in its private C++ API.

The change includes support for building the following bundled
libraries:
- zlib
- libpng
- libjpeg
- Freetype
- Harfbuzz-ng
- PCRE2

The following 3rd party libraries are still using an old
implementation within the CMake build system, and should be migrated
to the new one in the near future:
- double-conversion
- Old harfbuzz

The are a few libraries that are not yet ported:
- system-sqlite
- systemxcb
- maybe others

Among other things, this change allows building qtbase on Windows
without requiring vcpkg.

Task-number: QTBUG-82167
Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-25 15:43:16 +01:00
Alexandru Croitor
1b47411832 CMake: Check for syncqt private headers directory before using
Only existing directory paths should be added to
INTERFACE_INCLUDE_DIRECTORIES, otherwise projects fail to configure.

If after running syncqt there is no private headers directory created
(due to the module not having any _p.h files), such a path should not
be added as an interface include path.

This fixes consumers of QtZlib, where there are no private headers.

Change-Id: I3fd1a7b5eb8f816d178d6d91223baa6f377e6f9f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-25 15:43:16 +01:00
Alexandru Croitor
173079819d CMake: Allow evaluating features before a module is processed
Introduce an internal qt_feature_evaluate_features() function
which takes a list of configure.cmake paths, and evaluates the
features declared in those files, thus setting a bunch of cache
variables.

This is required to implement the equivalent of what qtbase/src.pro
does, which includes the feature .pri files to decide whether
bundled 3rd party libraries need to be built.

Change-Id: I5552f488671c001eb3f204245b905ab981017a9f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:16 +01:00
Alexandru Croitor
331b153be5 CMake: Fix FindWrapRt module when it's found multiple times
On Windows, when WrapRt is qt_find_pacakge()'d the first time, the
result is "not found", whereas a second time it would claim that the
package is found.

This is due to the WrapRt target being always created even if it has
no transitive dependencies, and thus a second search would check only
for the existence of the target.

Fix the module to only create the target if the relevant library
is found.

Change-Id: I5c838cbfbafb4029f96da815a0f72e4a8e6716b0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:16 +01:00
Alexandru Croitor
8ab59fd8b3 CMake: Fix 3rd party library installation
Libraries created with qt_add_3rdparty_library should be installed
when the qmake 'installed' value is set in CONFIG. Introduce a new
INSTALL option to handle that in CMake projects.
If the value is provided, the library should always be installed
regardless of whether it's a shared or static library.

Fix the libraries to be installed to BINDIR/LIBDIR instead of
the config install dir.
Also install the CMake config files into the config install dir.

Change-Id: I86f1ef47680f08669a77db77e0d986f47d5fae2d
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:15 +01:00
Alexandru Croitor
ae9f0aa86a CMake: Allow creation of modules with no qtfoo-config.h file
Useful for header only modules that are declared in the same directory
as a regular module, but which doesn't have any features and thus has
no qtfoo-config.h file.

Will be used for the qtzlib module, which is built when system_zlib
feature is disabled.

Change-Id: I60c5f73c3e2a3a481a16c5872e06d5d109a04b10
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:15 +01:00
Alexandru Croitor
5838d1f6c3 CMake: Add functions to allow setting symbol visibility flags
Needed for 3rd party library code.

Change-Id: Ib994de1980515e849d4368249024d3d5e064fb46
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:15 +01:00
Alexandru Croitor
05a0a278fc CMake: Allow disabling warnings similar to CONFIG += warn_off
The QT_COMPILE_OPTIONS_WARNINGS_OFF property can be set on targets
in order to disable adding the default compiler warnings flags.

This is useful when building 3rd party library code.

Change-Id: I9f58ca4543b5ea0d2051b7f94f0042d24c4e3a16
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-25 15:43:15 +01:00
Alexandru Croitor
6d29264e3e CMake: Set minimum deployment target only for host macOS
A future change will come that sets it for iOS and friends.

Change-Id: I74b688ee62d24137e3cdf5475e1a9e858698ccf0
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-21 16:16:26 +01:00
Leander Beernaert
a99d7cf372 CMake: Add missing compile flags for msvc
This patch adds a couple of missing compile flags that are defined in
mkspecs/common/msvc-version.conf and mkspecs/common/msvc-desktop.conf
that were not yet ported to CMake.

Change-Id: I9ef0ef71cb0c063699fba4c067e90f6515169baf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-20 16:11:02 +01:00
Leander Beernaert
f03a51a404 CMake: Fix use of compile define QT_NO_DEBUG
Prior to this patch QT_NO_DEBUG would not be correctly set for
generators which support multiple configurations such as Visual Studio
and XCode.

This patch also applies the define to all executables, which was
previously missing.

Change-Id: I16a911d15217a62093c68ba2b4c2545cdb8df1e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-20 16:11:01 +01:00
Leander Beernaert
98543f0a13 Fix PATH environment variable for CMake tests
This patch fixes setting the correct value for the PATH
environment value. Currently, due to Windows' ; path
separator, every list entry was treated as a separate
environment variable that need to be set instead of
properly extending the PATH list.

Change-Id: Ib2fc031397459370beec84f9cb4ec6df7db00df3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-02-19 15:14:55 +00:00
Leander Beernaert
540bd6cf20 Only install tests data for prefix builds
If we install tests data for non-prefix builds it can cause tests to
fail as they find the data in the wrong location. An example of this is
tst_qsslkey.

Change-Id: I55bd2ff4cb5a0857dc857cb2149ffe4436ec6f99
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-18 21:22:58 +01:00
Leander Beernaert
ba165cae71 Set qt_add_test WORKING_DIRECTORY to OUTPUT_DIRECTORY
If qt_add_test() is called with OUTPUT_DIRECTORY and no
WORKING_DIRECTORY is specified, default the WORKING_DIRECTORY to the
same value as OUTPUT_DIRECTORY._

Change-Id: If373fe590508ad58d4632e0598cd0d9dddb2ae16
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-18 21:22:57 +01:00
Alexandru Croitor
e9672c747c Set a default value for CMAKE_OSX_DEPLOYMENT_TARGET
This replicates the behavior of QMAKE_MACOSX_DEPLOYMENT_TARGET in
qmake.

Change-Id: I273cd26994f2edfc52dc7b6278252c37b65b2356
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-02-18 21:22:35 +01:00
Alexandru Croitor
4ee289d2d8 CMake: Use correct C++ standard flag when building standalone tests
Before the patch we set the standard flags in two places:
- once when building qtbase
- and always when including QtSetup (for every repo that is built)

This change makes sure to also set the correct standards flag when
building standalone tests, because QtSetup is called to early in
that case.

Change-Id: Iad130b731e9eb9605bb91637364c33fdd49ce3cb
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-18 21:22:34 +01:00
Olivier Goffart
5fa2fc61c9 cmake: C++17 is mandatory
Change-Id: Ia0f2151d38fec84be31afc76fc380666861d7d80
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-18 14:44:58 +01:00
Alexandru Croitor
eaa29378b9 CMake: Fix c++ standard config tests with MSVC
Need to pass additional -Zc:__cplusplus flag when using
MSVC, so that the __cplusplus define has correct values.

Additionally make the option be propagated to consumers of Qt
via the public Platform target, which QtCore links against.

Change-Id: Ie1283c25334b93f993529beb7fb32bdb001627f5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-18 14:44:57 +01:00
Alexandru Croitor
c53ee1f054 Merge remote-tracking branch 'origin/wip/cmake' into dev
Conflicts:
	tests/manual/rhi/hellominimalcrossgfxtriangle/CMakeLists.txt

Hopefully final merge from wip/cmake, and then all cmake changes
should target dev directly.

Change-Id: I29b04c9b0284e97334877c77a32ffdf887dbf95b
2020-02-13 23:29:51 +01:00
Liang Qi
6b2535ea15 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	examples/widgets/graphicsview/boxes/scene.h
	src/corelib/Qt5CoreMacros.cmake
	src/corelib/Qt6CoreMacros.cmake
	src/network/ssl/qsslsocket.cpp
	src/network/ssl/qsslsocket.h
	src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
	src/testlib/CMakeLists.txt
	src/testlib/.prev_CMakeLists.txt
	tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp

Disabled building manual tests with CMake for now, because qmake
doesn't do it, and it confuses people.

Done-With: Alexandru Croitor <alexandru.croitor@qt.io>
Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
2020-02-13 18:31:40 +01:00
Christophe Giboudeaux
aa94565f89 Use INSTALL_DOCDIR when possible
Hardcoding 'doc' causes issues when installing qtbase but also
when trying to build the other modules documentation.

Change-Id: I5c57852add59d0dc0d067813feea0bbb0962c84b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-12 08:45:22 +00:00
Leander Beernaert
572c03eb7a Add support for qt_helper_lib()
Add qt_add_3rdparty_library() function as a replacement for qmake's
qt_helper_lib feature.

All 3rdparty libraries will be available under the Qt:: alias when built
through this method so that they can properly register as dependencies
of a Qt module.

This patch also adds Qt3rdPartyLibraryConfig.cmake.in to export the
CMake configuration for static builds and shared libraries.

Change-Id: I52bf3a95ca22fccd9ab54343468847bb1b570c28
Fixes: QTBUG-81969
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-12 08:43:29 +00:00
Leander Beernaert
a2eb09a377 Only export public module link dependencies for shared builds
Unless we are building under a static library configuration there is no
reason to export the dependency on private libraries.

Change-Id: I724da38495dc55cc2783d4b19c01533fc0900d22
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-12 08:37:38 +00:00
Samuli Piippo
9bab556005 Fix typo for Mtdev pkgconfig target
Change-Id: Id6e7057e8010f67ba1c8ce948abc59bc7abf7b7b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-11 09:20:14 +00:00
Leander Beernaert
c431e2d33c Refactor Metatypes dependency propagation
Every metatypes.json files is now added as an INTERFACE source file to a
target. This enables us later to correctly collect all the
metatypes.json files from dependent targets. This information is also
correctly exported via export()/install().

To avoid the metatypes.json appearing in every target's source list,
the file path is wrapped in a generator expression which will only be
evaluated when the consuming target has the property
QT_CONSUMES_METATYPES set to true. At the moment this is limited to
targets which need to interact with qmltyperegistrar.

Change-Id: I0ffebcd069a923383f7ed11cde2c94ecf2fb13f3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-10 15:07:34 +00:00
Alexandru Croitor
b06f086460 Don't add private module headers for private modules when not needed
If a module has the NO_MODULE_HEADERS option, we should not add
the private module header paths to the BUILD_INTERFACE of private
modules.

This fixes building static non-prefix qtdeclarative builds on Linux,
where non-existent QtXcbQpa headers failed the qtdeclarative
generation step.

Change-Id: Ic9fdd8c5688d3449576eb8a5dd852c252e29bf5b
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-06 21:43:14 +00:00
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
Jean-Michaël Celerier
1962a86b20 Fix an incorrect regex range
Change-Id: I1b8b72cb4adcd872a3e4c245e58d4e302bf00c86
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-22 12:55:10 +00:00
Alexandru Croitor
1fd21c47d0 Fix warnings when a module's plugin type has underscores
In qtwayland, there were a bunch of warnings of the following type
when configuring:

"The plug-in 'f' does not belong to any Qt module".

This happened because the plugin type had underscores, and was not
sanitized when comparing a the plugin type of plugin.

Add a function to do the sanitization, and use it everywhere.

Change-Id: I728b5f1e18fa5f8876c4a57dbd4e33148cb242d5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-15 18:02:12 +00:00
Alexandru Croitor
dfc583005b Fix add_cmake_library to use a correct plugin suffix on macOS
Qt plugins on macOS use .dylib, whereas CMake created used
".so" instead.

Change-Id: I3ea73a52a0675a0cfce4997ca413df79e63cfaa7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-15 12:25:22 +00:00
Alexandru Croitor
38354d7d61 Rename / prefix all our private API functions with qt_
Rename internal APIs like extend_target to qt_extend_target.
Prefix apis with qt_ where required.

Keep old names for compatibility until all their usages are removed.

Change-Id: I9a13515a01857257a4c5be3a89253749d46a4f41
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-14 09:05:33 +00:00
Alexandru Croitor
9e6456a49d Fix not to add warnings_are_errors property to INTERFACE targets
Amends f000685612

Change-Id: I3b61b64bb9c755de38f4a5ffcb07b39b38bd4fd7
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-13 16:17:23 +00:00
Alexandru Croitor
250ad9843f Always build tests by default when building standalone tests
Amends 021c17c62f

Change-Id: I8181270ef7506eb5da4d3b43e105e100ed5581e4
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-13 10:00:34 +00:00
Alexandru Croitor
e7f188b2d2 Don't include standalone tests config file if none exists
Some repos like qtimageformats don't generate a config file for
standalone tests because the repo creates no modules.

Amends de3a806def

Change-Id: Id42338804605a883f975feb5dd81eda5acc6e687
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-13 10:00:12 +00:00
Alexandru Croitor
edcf5d0144 Fix qt_skip_warnings_are_errors_when_repo_unclean for executables
Amends f000685612

Change-Id: I48d7a42e11e609fa3a387b7669ee96bd10c856e4
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-13 09:59:56 +00:00
Alexandru Croitor
f000685612 Add support for skipping warnings are errors
Unfortunately not all repositories are marked as warning_clean
in their .qmake.conf files. For instance qtconnectivity and
qttools are not warning clean. Therefore we need to skip
warnings_are_errors flags on all targets created in that repository.

Add support for skipping the warnings are errors flags, by setting
a QT_SKIP_WARNINGS_ARE_ERRORS property on a target, and use that
within a generator expression with all the accumulated flags.

To mimic behavior of qmake, and set the property on all targets
created by add_qt_module, add_qt_plugin, etc, one simply needs
to set the QT_REPO_NOT_WARNINGS_CLEAN variable in the
repo project CMakeLists.txt.

Change-Id: Ib5a487af6601ae1519a0988a89f8083f94f92267
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-12 17:30:35 +00:00
Leander Beernaert
681e8b4ead Add add_qt_manual_test()
This patch adds add_qt_manual_test() which is a simple wrapper around
add_qt_executable() which does not build under ${CMAKE_BUILD_DIR}/bin
or install the targets.

This could potentially be used later to tag manual tests.

Change-Id: Ic4e0a1d133009f5a858b9394347a0996cf42683f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 14:46:44 +00:00
Alexandru Croitor
17e2befe2a Don't install QtFooTestsConfig.cmake if no modules were built
When configuring qtx11extras on macOS, we ended up installing the
file, which made Coin think that at least one module was built,
and thus it tried to build tests as well.

Don't install the file if no modules were built, thus preventing
from trying to build tests in Coin.

Amends de3a806def

Change-Id: I920a0b40a6ded12140f251352da53b68eef6560d
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-12 13:21:31 +00:00
Alexandru Croitor
04e86bab13 Make sure to install QtStandaloneTestsConfig.cmake.in
Otherwise leaf modules fail to configure.
Amends de3a806def

Change-Id: Ie304c0021ada9911044abdb7e460b8da8e986a8f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:35:22 +00:00
Leander Beernaert
2199a50a2a Build test/manual if it contains a CMakeLists.txt
Change-Id: Ibada60b0902f9c6a6a7284489a56106e0021a9de
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-12 10:06:46 +00:00
Simon Hausmann
1b41a62893 Fix armv7 embedded Linux build
In gui's CMakeLists.txt we have

    if (NOT ANDROID)
        ...
        add_qt_simd_part(Gui SIMD neon SOURCES ...)
        ...
    endif()

and later

    if(UNIX AND NOT ANDROID AND NOT APPLE_UIKIT AND NOT INTEGRITY AND NOT (TEST_architecture_arch STREQUAL "arm64"))
        add_qt_simd_part(Gui SIMD neon
    endif()

Since add_qt_simd_part internally uses an OBJECT library to compile the
sources with different flags and then link into Gui (in this case), we
may end up with an error when add_qt_simd_part is called twice for neon,
because the constructed target (Gui_simd_neon) exists already.

We can re-use an existing target though, as the SIMD features is the
same.

Change-Id: I7a21c6e66b47e918a53fa3b1a7db9e053ecc8d87
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-11 13:04:12 +00:00
Alexandru Croitor
8ef64341c3 Fix architecture config tests values to be written only once
Every time the qtbase project was reconfigured, the list of
config tests results was appended to a cache variable which was
never reset, resulting in multiple copies of the same values
being written to QtBuildInternalsExtra.cmake.

Make sure to clean the cache variable before appending to it.

Also change the variable to be all upper-case, to be consistent
with other cache variables.

Change-Id: Ic12046730a080595e19377981a726bc330641dc1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-08 16:12:29 +00:00
Alexandru Croitor
021c17c62f Add support for -nomake-tests and -nomake-examples equivalents
A developer can pass either -DQT_NO_MAKE_TESTS=ON or
-DQT_NO_MAKE_EXAMPLES=ON to exclude tests or examples from being built
as part the default make target (when you write just make or ninja).

With ninja, tests and examples can be built separately one by one,
by typing
 $ ninja tst_foo
or
 $ ninja example_bar

Same can be done with the Makefile generator.
 $ make tst_foo

All tests / examples can be built in one go by typing
 $ ninja tests/all
or
 $ ninja examples/all

With the Makefile generator unfortunately it's not as nice and is most
likely an implementation detail, but it can still be done by running
something like
 $ make -f CMakeFiles/Makefile2 tests/all
or
 $ make -f CMakeFiles/Makefile2 examples/all

Change-Id: I34f168b3ab41e952a21d3ace5634e25a9f41922e
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-08 16:05:44 +00:00
Alexandru Croitor
de3a806def Make standalone tests build via top level repo project
Previously repo/tests/CMakeLists.txt was a standalone project on which
CMake could be called. This was useful for Coin to be able to build
and package only tests, but was a bit troublesome because that means
having to specify the usual boilerplate like minimum CMake version,
which packages to find in every tests.pro project.

Instead of having a separate standalone project, modify the top level
project and associated CMake code to allow passing a special
QT_BUILD_STANDALONE_TESTS variable, which causes the top level project
to build only tests, and find Qt in the previously installed qt
location.

This also means that when building a repo, we generate a
${repo_name}TestsConfig.cmake file which does find_package on all the
modules that have been built as part of that repo. So that when
standalone tests bare built for that repo, the modules are
automatically found.

qt_set_up_standalone_tests_build() is modified to be a no-op because
it is not needed anymore. Its usage should be removed from all the
other repos, and then removed from qtbase.

Non-adjusted tests/CMakeLists.txt projects in other repositories
should still be buildable with the current code, until they are updated
to the new format.

Adjust the Coin build instructions to build the standalone tests in a
separate directory.

Adjust pro2cmake to generate new structure for the tests/tests.pro
projects.

Adjust the qtbase tests project.

Fixes: QTBUG-79239
Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-08 15:42:32 +00:00
Alexandru Croitor
c51fe841f4 Fix handling of _nolink targets for the QtNetwork module
When a _nolink target is exported, instead of getting the original
namespace prefix, it gets the Qt6 prefix
(OpenSSL::OpenSSL_nolink -> Qt6::OpenSSL_nolink).

There is some special case code in Network autotests which tries
to access the former target name, which doesn't exist when building
standalone tests.

Make sure to create a Qt6:: library alias for _nolink targets during a
build (so before the library is exported), and change the Network
autotests project to use this Qt6:: namespaced library, which will
ensure it is found both in a standalone tests build and in a regular
Qt build.

Also make sure to actually call find_package to find the OpenSSL
library when building standalone tests, otherwise configuration will
fail.

Change-Id: I3da5b958e72e745a50380f8ab1644459a7c6b005
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-11-08 15:09:54 +00:00
Alexandru Croitor
3cfaa19c60 Fix interface library issues on Android
Don't call qt_android_dependencies for interface libraries.
Also make sure not to set properties which don't start with
INTERFACE_ prefix.

Change-Id: I0afdffd34c9aebe0d7ac4731b57dd4d505f84570
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-08 15:09:41 +00:00
Alexandru Croitor
8294d85d80 Don't add linker scripts to interface libraries
It only makes sense for non-interface libraries.

Change-Id: I80ac942ed546a6ac866e827aa2026e4e6ac897b2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-08 15:09:31 +00:00
Alexandru Croitor
46cf1f11f0 Don't query MODULE_PLUGIN_TYPES property on interface libraries
The reason is that interface libraries have to have properties
prefixed with INTERFACE_ and more importantly we don't set the
property for interface libraries at the moment.

Amends d1542e8a73.

Change-Id: I86bf99995278b9086fa0e3815e10d5d54d9ea4dc
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-11-08 15:09:23 +00:00
Leander Beernaert
512aae3abe Fix Android x86 builds
Replace condition x86 to i386 to match other platforms.

Regenerate src/gui/CMakeLists.txt

Disable SSE4 on android x86 to match qmake.

Change-Id: Ic0d330206f2d70a79d72553aa3ff0f91ff58119c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-08 09:40:24 +00:00
Leander Beernaert
cd9813d276 Add support for benchmark conversion
Convert benchmark executables to add_qt_benchmark().

Currently add_qt_benchmark just calls add_qt_executable() and
ensures that it they build under CMAKE_CURRENT_BUILD_DIR and do not
install.

Add QT_BUILD_BENCHMARKS option to enable/disable building of benchmarks.

Change-Id: Id0bc676698d21d50048d97d9abef51d92ccb6638
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-11-04 15:48:30 +00:00
Frederik Gladhorn
92fdc6b2ea cmake: Fix setting QT_DISABLE_DEPRECATED_BEFORE
The last set would override the variable instead of appending to it,
thus QT_DISABLE_DEPRECATED_BEFORE was never set.

Change-Id: I173b91704a855fcda1f2b86172d318e3953466db
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-31 13:48:09 +00:00
Leander Beernaert
69fb4ae343 Distinguish between qt_plugin and regular plugins
If we do not encounter the load(qt_plugin) statement in the .pro file
but we do see the entry CONFIG+=plugin, treat the target as a regular
CMake library instead of treating it as a qt_plugin by default.

Change-Id: I67ad5c865a1a5ab691a6b0d86c2db4b686aa04dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-28 09:20:37 +00:00
Leander Beernaert
080f9ad160 Enable running test on Android
This patch converts all add_executable calls when building for Android
to a module library and replaces the call to add_test() to use
the android testrunner binary.

Change-Id: I10ba5919217cdc93cc2cbbb7d13ad9d10fc5ac1a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-28 09:18:28 +00:00
Alexandru Croitor
d183c21a2c Fix declarative tests
e1fd607493 in qtbase removed the
qml1 imports enum from qlibraryinfo.cpp, qconfig.cpp, etc.

With the recent merge from dev, this was not adjusted in
qt_generate_qconfig_cpp, and thus we generated one too many strings
in qconfig.cpp, which resulted in
QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath) returning
"imports" instead of "qml" subfolder, thus causing all qml modules
not being found.

Fix this by removing the extra qconfig.cpp entry, and all other
references to the location.

Change-Id: I128f667281138e2e0ef0fe1ced4af0405c532fef
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-25 16:21:06 +00:00
Leander Beernaert
790d380f8b Add custom targets to generate Android APK
This patch adds two custom targets to generate android apks. The
targets are named ${TARGET}_prepare_apk_dir and ${TARGET}_make_apk. The
first one insures the binary is copied to the right location and the
latter invokes androiddeployqt on the apk directory.

Change-Id: I8152cef387b50ec03ee2bfd92b56910a6f22754c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-23 09:08:10 +00:00
Tobias Hunger
edf61092f2 QtBuild: Use STRING type for install locations
Use STRING type for install locations as we use them relative to the
CMAKE_INSTALL_PREFIX.

PATH type will get expanded to absolute paths by newer CMake versions,
so that breaks our logic.

Change-Id: I36be1f0378c4fb07ad8db0051d540f9d243000be
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-21 11:29:04 +00:00
Tobias Hunger
1c2db89027 Write out a module description file
Write out a file with some JSON data to describe a module.

This file contains information on how that module has been built.

Change-Id: I8a604692663cbb7b76b96b97124130e30b822e4b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-21 11:28:55 +00:00
Leander Beernaert
51979657a1 Add ALLOW_UNDEFINED_SYMBOLS to add_qt_plugin
Allow plugins to be built with undefined symbols when
ALLOW_UNDEFINED_SYMBOLS is specified.

Change-Id: I6bc809e3e5257302157bf8484f850d8319674a4a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-21 10:04:22 +00:00
Leander Beernaert
077ea818af Rename builtin test data resource name
Rename the builtin test data resource name to something more unique as
there are name clashes when building tests which also add a resource
named 'testdata'.

Change-Id: Icc1bbff3134e1dbc6ea4f6a87a1715b936c723cc
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-18 13:20:56 +00:00
Leander Beernaert
373be4200b Add conversion code for Java code
Add support to pro2cmake to convert java code for android.

Add support to override API_LEVEL for the Android sdk jar file. If the
sdk is not found, we'll default to the one located by QT_ANDROID_JAR.

Change-Id: If0b746dc7f9148ac43e6592a4a4dd23d46bbd4cd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-18 13:20:46 +00:00
Simon Hausmann
7e7f41e40c Pick the latest available C/C++ standard when compiling Qt
This maps the behavior of mkspecs/features/qt_common.prf and enables the
use of C++17 for example in Android, where the toolchain supports it
anyway.

Change-Id: I41f4bdb160a3929e2fb78f36efb1ad5f2ad391a5
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-10-17 19:23:25 +00:00
Simon Hausmann
2fa23e46c0 Fix C++ standard detection
We cannot use a generator expression in an if statement, it does not
work. Instead, we could inspect the CMAKE_C/CXX_COMPILE_FEATURES list,
but unfortunately that's not reliable. For example it detects that ICPC
supports C++17 when in fact that depends on the installed libstdc++.
Therefore this patch revives our own configure tests.

Change-Id: Ic3bc5762fbe81837722523e3881ac16e84628519
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-17 16:57:25 +00:00
Alexandru Croitor
4a7e7103e7 Fix precompile header usage
Latest CMake will try to compile the given precompiled headers
as C files, due to enabling the C language in the project + also
having c files.

Make sure to wrap the precompiled headers in a CXX language only
generator expression.

For details, see https://gitlab.kitware.com/cmake/cmake/issues/19839

Change-Id: Ib3508ad920092455c300b1a566ba6152bab032db
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-15 13:50:25 +00:00
Leander Beernaert
c13bafec09 Add QT_RESOURCE_TARGET_DEPENDENCY source file property
In the plugin test in QtBase we have a scenario where we have target
binaries that are inputs to add_qt_resource(). If we do not remove these
files from the dependency list for add_custom_command() cmake will
fail to generate the build files.

If we mark them as generated source files, we'd have to add a special
rule to generate them. Furthermore, using $<TARGET_FILE:...> does not
work due processing done by add_qt_resource.

To bypass this we check whether the property is set and instead of
adding the file to the dependency list we add the target referenced
in that property. RCC will still work as expected but will fail if the
files aren't present.

Change-Id: I16855a54f5606d6fe27ab1347ed7ff4f40392c98
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-15 13:46:36 +00:00
Leander Beernaert
69bb9f7cad Fix output property for add_cmake_library()
OUTPUT_DIRECTORY by itself is not a valid cmake target property.

Change-Id: Ic3a2a81b8b982ad7ccf0551000a157f9a4d3ef22
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-15 13:12:04 +00:00
Simon Hausmann
a3fd3c193d Remove compatibility code for old call sites of qlalr processing
Change-Id: I48801c336f7546b9366c70d877d20222c16dd4ff
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-15 08:39:55 +00:00
Alexandru Croitor
190e9dcdcf Regenerate files after dev -> wip/cmake merge
Note the following bigger things that had to be done:
Handle GSS library / feature with a new custom find module.
Implement rudimentary support for relocatability (does not currently
handle extprefix).

Change-Id: Ic6cd27dda7ebca9829f51cb42ea76fff6d1767ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-14 19:01:19 +00:00
Alexandru Croitor
1e27ad1697 Don't include header directories that don't exist
If a module is marked as NO_MODULE_HEADERS, we shouldn't
try to include the non-existing include directory which is
usually generated by syncqt.

Note it seems that NO_SYNC_QT and NO_MODULE_HEADERS seems
to converge, so it might make sense to merge them in the future.

Change-Id: Iab4e2907ed68776632337b37496b015535da8784
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-14 15:06:10 +00:00
Alexandru Croitor
7119023829 Always try to find dependencies for plugins
Generated plugin CMake files should always try to call
find_dependency, especially in static builds.

pkg_check_modules sets a cache value for foo_FOUND instead of
a directory scope foo_FOUND, which means that find_dependency
will not be called in another scope, and thus fail to create
needed imported targets.

Note this makes the code be the same as in
ModuleDependencies.cmake.in.

Change-Id: I0b58b038afcb72cb27d0b433371bc9cb5e4bfec9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-14 15:02:52 +00:00
Leander Beernaert
6694689a26 Fix Android build from multi-arch qmake changes
Add condition replacements for the android ABIs.

Add a replacement for QT_ARCH to ANDROID_ABI, since QT_ARCH is only used
with the android build for now.

Change-Id: I553d7910546de32236f723ec2e9a05a18da76130
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-14 13:49:40 +00:00
Leander Beernaert
ecccb71d3d Fix handling of OUTPUT_DIRECTORY in add_cmake_library
extend_target() does not handle the OUTPUT_DIRECTORY argument, so we
must handle it ourselves.

Change-Id: I31880a516ae185f3255b2a51f41d61ee6b1d9838
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 12:18:20 +00:00
Simon Hausmann
f2d15b9683 Minor fix to qt_process_qlalr API
It's probably best to make it follow the usual calling convention that
the associated (consuming) target is the first parameter of the
function. So first this change accepts both formats.

Change-Id: I1f20706b23d5e819e0eb689eecedb3afb49df3b7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 12:02:08 +00:00
Leander Beernaert
1dd82a8843 Add SKIP_INSTALL to add_qt_plugin()
Provide a SKIP_INSTALL argument to add_qt_plugin for test cases with
plugins lacking install information.

Change-Id: Iddb3843fab1790d69d64686530a46057a2ff0477
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 09:23:13 +00:00
Joerg Bornemann
b2de87a089 CMake: Create output directory for qmlcachegen
Change-Id: I395de27bfe0eed46c595ac664b2c7218abbdb28b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-11 09:19:53 +00:00
Leander Beernaert
6167031ecc Add 'add_cmake_library' to QtBuild.cmake
Add add_cmake_library to allow us to create normal cmake targets using
all the information we have collected via the conversion script.

This function is only meant for tests. For an example,
see tests/auto/corelib/plugin/qpluginloader/lib/lib.pro.

Change-Id: I738cb8ac241b8da1a1da3ef957c24dc7a754d43f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 14:15:06 +00:00
Leander Beernaert
b42feb02ce Add install directory for plugins without type
When we run into a plugin that does not have a type and is not a
qml plugin, we try to see if we can find the target installation path
and provide INSTALL_DIRECTORY AND ARCHIVE_INSTALL_DIRECTORY to the
add_qt_plugin call.

We run into this frequently with the unit tests.

This patch also changes add_qt_plugin() to use the value provided in
INSTALL_DIRECTORY for ARCHIVE_INSTALL_DIRECTORY if no value is provided
for the latter.

Change-Id: I61278904a4d2d72308079cd362bd085b4e2f540c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-10 13:06:51 +00:00
Alexandru Croitor
87ba355d95 Fix automatic plugin importing in static builds
QtPlugins.cmake.in uses file(GENERATE) and target_sources() to
propagate the generated cpp files which contain plugin initialization
code to their consuming targets.

Unfortunately due to a bug in CMake, if the file is generated in a
different scope than the consuming target, the CMake generation
step will fail saying that the source file can not be found.
See https://gitlab.kitware.com/cmake/cmake/issues/18399 for details.

In the case of qtdeclarative, find_package(Qt6) is called at the top
level scope (this is when the file gets generated),
but the targets are created in subdirectory scopes, and the GENERATED
source file property is not propagated across scropes.

Circumvent the issue by instead using file(WRITE) and configure_file()
which create the file at configure time rather than generate time.

This will pollute the current binary directory with some more files,
but at least successfully fixes the build.

Change-Id: I3ab3b12dcbf6a9d0ab9ee87173e4a1952325b37b
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-09 09:22:27 +00:00
Jean-Michaël Celerier
d1542e8a73 Match qt_import_plugin API with qt5's
Some work was needed to make the plug-in types,
and which plug-ins are available for each type
in client code.

Change-Id: Ib71feca31069deca3d3f54c8613054f5f8ae410c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-09 09:05:39 +00:00
Leander Beernaert
5260c1d62a Update add_qml_module() to use INSTALL_QML_FILES
Update add_qml_module() to use the new INSTALL_QML_FILES argument from
qt6_add_qml_module().

This patch also updates pro2cmake.py to remove the QT_QML_SOURCE_INSTALL
property from qml files.

Change-Id: I6623b2de76bb55bd6750e48f7d45c53ca536b391
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-08 13:42:17 +00:00
Leander Beernaert
1a4f0e2583 Update add_qml_module to use DO_NOT_INSTALL_METADATA
Update to match latest changes to QtDeclarative.

Change-Id: Ie455c0418e95c288149b4b1a29b065a8876e8b7e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-08 13:28:20 +00:00
Oliver Wolff
e81441421b cmake: Add IOBluetooth to list of apple system frameworks
The framework is needed for qtconnectivity.

Change-Id: I6a502564fb5543ca94ba5ae458a544286e34564c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-01 13:41:25 +00:00
Alexandru Croitor
48699561d9 Enchance qt_find_package with opt-in debug capability
Sometimes when writing a qt_find_package and configuring a project,
you might get the following error from CMake:

CMake Error at QtBuild.cmake (set_property)
Attempt to promote imported target "WrapFreetype::WrapFreetype" to
global scope (by setting IMPORTED_GLOBAL) which is not built in this
directory.

This means that another find_package call, found WrapFreetype
in another directory scope other than the current one, and thus the
found target cat not be made global. Sometimes that implies that the
qt_find_package might not be needed if WrapFreeType will always be
found via a transitive depdendency.

By setting QT_DEBUG_QT_FIND_PACKAGE=1 on the command line, you can
make qt_find_package skip all of its behavior if the package was
already found and the provided targets were also found.

Unfortunately this behavior can not be made the default, because there
is no way to find out in what scope the package was found, and if it's
legal to make the targets global. At least I haven't found a way to do
that yet.

Thus the opt-in QT_DEBUG_QT_FIND_PACKAGE is a means to help with
debugging such cases.

Change-Id: I04242ed0f2fd0a75bc199386d28a1a0bd92da41a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-01 13:34:38 +00:00
Mårten Nordheim
ef9cef6dff Add a find_library entry for the GameController framework
Needed for QtGamepad

Change-Id: I50227949eb509c021ba8d9b4dbe2b36b6a6de87f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-01 12:50:04 +00:00
Alexandru Croitor
0ceef4cb54 Always append extra cmake modules to CMAKE_MODULE_PATH in Qt6Config
During a static build we need to use the find modules
in 3rdparty/extra-cmake-modules/find-modules when generating a
ModuleDependencies file, so that the generated find_dependency()
calls succeed. This means that the files have to be shipped with
Qt6 package, making them pseudo public API.

There is also a need to use these files when building QtWayland.

Instead of setting / unsetting CMAKE_MODULE_PATH only in module
and plugin Dependencies cmake files, just set them once when finding
Qt6.

This will allow QtWayland and QtX11Extras to easily find the required
third party packages, without having to hardcode the paths in multiple
repos.

Change-Id: I750d0421a269e5632afa1bb62498c2501d73cdb1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-01 12:05:59 +00:00
Jean-Michaël Celerier
309f96ccb6 Add CMake support for directfb plug-in
Change-Id: I126545e1da54018ce081b42a29e62ca30ee04d64
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-30 11:31:54 +00:00
Mårten Nordheim
23f19eb869 QtPostProcess: Check target link-type when collecting deps
Fixes a configure issue in qtgamepad

Change-Id: I8212d6d58fd2f28ae71a9559cf6544102a873718
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-30 11:14:48 +00:00
Alexandru Croitor
1daaaf74a6 Fix libsystemd find module name
At least on Ubuntu the name of the pkg config package
is libsystemd and not systemd.

This fixes libsystemd showing up as not found in the feature
summary.

Change-Id: I099a253026ca8096b9e2f348a5f35209d44acc6c
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Qt CMake Build Bot
2019-09-27 14:30:43 +00:00
Alexandru Croitor
fe1a018d00 Fix some find modules not setting _FOUND variable
If the target exists or the find_package() call succeeds
we still need to set _FOUND to 1.

Change-Id: Ib2267c30580082dcc177ab21708a3bc5dbde974f
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Qt CMake Build Bot
2019-09-27 14:30:23 +00:00
Alexandru Croitor
34b1c1c23c Fix qt_find_package to not show incorrect packages at features summary
qt_find_package usually does 2 find_package() calls, one in CONFIG
mode and one in MODULE mode.

If the CONFIG mode doesn't find a Config file, the package_DIR cache
variable is set to NOTFOUND, and this causes the FeatureSummary
at the end to show that the package was not found, even if it is
found by the next MODULE mode find_package call.

Make sure to unset the _DIR variable in case if the Config module
call fails.

This fixes XRender showing up as not found even when it's found via
the FindXRender.cmake file.

Change-Id: I6ce39dad9cbb11836ca71f735a3267070c75b444
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Qt CMake Build Bot
2019-09-27 14:28:04 +00:00
Alexandru Croitor
981cfe7d79 Include QtPlatformSupport as part of find_package(Qt6BuildInternals)
This is needed because the ported over requires() clauses from qmake
to CMake are executed before qt_repo_build(), which means that all the
custom platform variables that we set (like LINUX, APPLE_OSX) need
to be available immediately after finding BuildInternals.

Change-Id: I7345b69edf72c266508846766e64f42c99862d1d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-27 08:42:18 +00:00
Joerg Bornemann
992fe06b30 cmake: Support CMake-typical booly values for -DFEATURE_*
Allow setting feature defines to ON, YES, TRUE, Y, OFF, NO, FALSE, N and
non-negative numbers like it's possible for other defines.

We'll not allow IGNORE and NOTFOUND, because they're a bit strange in
the context of features.

Change-Id: I7f6cd6dff4c68972921b499b28916c9ad789d510
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-09-26 14:30:14 +00:00
Joerg Bornemann
deeddf2cb1 cmake: Fix QT_TOOL_PATH_SETUP_COMMAND
The set command looked like this:
    set \"PATH=...\"
which was setting the environment variable \"PATH.

Removing the escaped double quotes makes it actually work.

Change-Id: I2c1d5d01b4415220512b005b75b7b67c695e33ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-26 12:22:13 +00:00