Commit Graph

63 Commits

Author SHA1 Message Date
Joerg Bornemann
23e6eb53f3 Fix developer build
The -developer-build had not the desired effect anymore.
That argument must not be hidden from the feature logic.
This amends commit d5c3e1336b.

Change-Id: I96562ea2df43ba7de002e705f28c7cc7edb4a589
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-05-10 10:08:53 +02:00
Kai Köhne
d5c3e1336b Allow to load -developer-build without configurations into an IDE
Let -developer-build, -cmake-file-api set up the CMake File API query,
so that the build can be loaded directly into IDE's like Qt Creator.

[ChangeLog][Build System] configure -developer-build now sets up
the CMake File API query, so that a build can be loaded without
reconfiguration into Qt Creator and other IDE's. Pass
-developer-build -no-cmake-file-api to configure to disable this.

Fixes: QTBUG-89487
Change-Id: I69199b8f96da02e42e5610aa6f49881c1582f7da
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-07 21:06:58 +02:00
Joerg Bornemann
3886db82c6 Add -write-options-for-conan configure argument
Passing this configure argument will generate a JSON file that contains
information about configure options and features.

This file is used by Qt's conan recipes.

Fixes: QTBUG-92082
Change-Id: I2057ec8cbdb0a1ea198d7eeacb45f65bfa862d8a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-05 16:28:27 +03:00
Joerg Bornemann
52077d4f01 Inhibit CMake generator detection for qt-configure-module
When configuring a Qt module with qt-configure-module, we want to use
the same CMake generator that was used for building qtbase.
That generator is encoded in qt-cmake-private. But qt-configure-module
overrides the generator after trying to detect what generator should be
used. That auto-detection is only useful for qtbase-builds and top-level
builds. Turn it off for repo builds other than qtbase.

Pick-to: 6.1
Fixes: QTBUG-91405
Change-Id: I07efb4afb51ba69d2f5467d272118fa51637ab54
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-26 23:11:28 +02:00
Alexey Edelev
8194f79053 Use bracket-based escaping for all list arguments in a configure string
The 'list(TRANSFORM cmake_args REPLACE "\\[\\[;\\]\\]" "\\\\;")' call
breaks the list arguments added when evaluating the 'INPUT_' values.
Therefore, it's necessary to apply bracket-based escaping to all list
arguments instead of the standard escaping.

Amends 856fadf85c

Fixes: QTBUG-92459
Change-Id: Ifd4e0ca5f549a1c7fab9ceb587ed355250c4e677
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-12 12:05:59 +02:00
Alexandru Croitor
0e6c4224f0 CMake: Build minimal subset of tests in desktop static builds
Add new configure option -make minimal-static-tests and CMake option
QT_BUILD_MINIMAL_STATIC_TESTS. In conjunction with QT_BUILD_TESTS
it will enable building a minimal subset of tests when targeting
a static desktop Qt build.

In qtbase the minimal subset includes all the auto tests of testlib,
tools, corelib and cmake. In particular this will also do cmake build
tests and qmake build tests (tst_qmake)

Adjust CI instructions to enable building a minimal subset of static
tests when a platform configuration is tagged with the
MinimalStaticTests feature.

Fix and skip a few tests that were failing.

Pick-to: 6.1
Task-number: QTBUG-87580
Task-number: QTBUG-91869
Change-Id: I1fc311b8d5e743ccf05047fb9a7fdb813a645206
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-06 09:15:37 +01:00
Joerg Bornemann
f64ccc5f53 Make find_package in configure.cmake a hard error
qt3d/9a473a3c9b246f4895ae73d7060745b8b199a6c5 introduced a find_package
call in a configure.cmake file, very subtly breaking top-level builds
with configure.

The find_package call results in errors of the cmake call that runs
QtProcessConfigureArgs.cmake (see bug report for details).

Create a find_package stub that errors out with a helpful message.

Task-number: QTBUG-92163
Change-Id: I06db0bf219b965e93b78c690e9f7ad868196ddb9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-31 16:37:39 +02:00
Alexey Edelev
856fadf85c Fix processing of list arguments passed to the 'configure' script
list(TRANSFORM ...) unexpectedly removes semicolon escaping in list
items. So the list arguments seems to be broken. The 'bracket argument'
suppresses this behavior. Right before forwarding command line
arguments to the cmake call, 'bracket arguments'are replaced by escaped
semicolons back.

Recent fix escapes all semicolons of the 'configure_args' and glues
all arguments to a single 'list'.

Amends df8e1c8e58

Change-Id: I4a458b9e3add307b36924c4c7c7f739d348f9343
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 14:33:26 +02:00
Tor Arne Vestbø
df8e1c8e58 cmake: Handle arbitrary configure arguments that contain lists
Passing e.g. -- -DQT_BUILD_SUBMODULES="qtbase;qtdeclarative" to
configure would fail because the module list was not preserved
as a single argument.

Change-Id: If685d0d541201597a2c2a5dc3d55b5d1ae51da22
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-23 11:01:14 +01:00
Niclas Rosenvik
3c93f7dd4f Fix configure build due to use of qt_set01 in configure.cmake
The change "Enable X11 on other platforms than just Linux"
uses qt_set01 in a configure.cmake file but does not add it
to the stubs list in QtProcessConfigureArgs.cmake thus
breaking builds based on configure.
Add a defstub with qt_set01 to fix this.

Change-Id: Ia3e0ec61df5228f88f77f631968f6f96d567ec8e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-17 07:14:41 +01:00
Joerg Bornemann
081b5398f8 Remove the -qmake and -cmake configure arguments
Qt is built with CMake since 6.0 and the QMake build system was removed
in 6.1. It's time to remove the -cmake and -qmake configure arguments
for Qt 6.2.

Fixes: QTBUG-88286
Change-Id: Ie726ec364ded025f8d93bd69b469561a6ae40aa9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 16:39:50 +01:00
Joerg Bornemann
37452051d6 Add QT_CONFIGURE_RUNNING variable for configure.cmake files
configure.cmake files are read twice when using the configure script /
qt-configure-module: First, when configure is running and a second time,
when CMake creates the local build system files.

In the first run, not every function and esp. no targets are
available. Code in configure.cmake that accesses targets or calls
functions unknown to configure will fail at the configure stage.

This patch introduces the QT_CONFIGURE_RUNNING variable that can be used
in configure.cmake files to guard such code:

if(QT_CONFIGURE_RUNNING)
    set(_qt_coord_type double)
else()
    get_property(_qt_coord_type TARGET Qt6::Core
        PROPERTY INTERFACE_QT_COORD_TYPE)
endif()

Change-Id: Iff39924d6a5133379d28c8204d7b7afdf47de5c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-05 21:22:31 +00:00
Alexey Edelev
530b629349 Do not rewrite boolean INPUTs if they have a corresponding feature
Initial replacement of boolean INPUT_ variables to the FEATURE_
variables was wrongly changed to updating of the INPUT_ variable
value to ON/OFF value. This causes potential issues when INPUT_
variable has explicit check for 'yes' or 'no'.
The feature evaluation step enables FEATURE_ variables in case if
the corresponding INPUT_ variable contains a positive CMake value.
So there is no need to process boolean INPUTs at the argument
processing step.
Also no need to keep the special opengl case, since it will be
processed correctly.

Fixes: QTBUG-91158
Pick-to: 6.0
Pick-to: 6.1
Change-Id: I96bb7903a904ae3cf788d7ef7d4e0c019046eb95
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-18 11:09:22 +01:00
Joerg Bornemann
41e3d167d5 configure: Don't guess the compiler if the user already chose one
We must not guess the compiler from the -platform argument if one of the
following holds:
- the CXX/CC environment variables are set
- the CMAKE_CXX_COMPILER/CMAKE_C_COMPILER variables are passed

Pick-to: 6.1
Fixes: QTBUG-90914
Change-Id: Iff7a0e7b8857f77333f1705f118d7952af5234ba
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-02-11 08:44:20 +01:00
Joerg Bornemann
b9d1dc43f2 configure: Fix handling of -translationdir argument
This is supposed to be mapped to INSTALL_TRANSLATIONSDIR, not
INSTALL_TRANSLATIONDIR (without the s).

Pick-to: 6.0 6.1
Fixes: QTBUG-90946
Change-Id: Icec93ffc0dc80d9ac7cf6cf1b13824bc2a1e795f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-02-08 11:57:41 +01:00
Alexey Edelev
52e1603e33 CMake: Add proactive check of generator multi-config capabilities
Add explicit error, if multi-config build is requested, but selected
generator doesn't support it.

Fixes: QTBUG-88287
Pick-to: 6.0
Change-Id: I6dba589bb59ad69fa07221c657df272ec75c359b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-05 09:03:24 +01:00
Alexey Edelev
61d5b01972 CMake: Add extra targets to run single benchmark using CMake generator
Add custom targets with '_benchmark' suffixes to make run of
benchmarks using generators possible, e.g.:

$ ninja tst_bench_qudpsocket_benchmark

Extend '-[no]make' option to pass benchmark. Rework
'-[no]make' processing to unify these options processing.
Also looks like it doesn't make sense to enable benchmarks without
having test enabled. So '-DQT_BUILD_BENCHMARKS' enables test as own
dependency automatically.

Task-number: QTBUG-89076
Pick-to: 6.0
Change-Id: Ieee9eadaf6d75a1efec120242d6eb786ace1b071
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-07 14:26:07 +00:00
Joerg Bornemann
fb21a5ce1a CMake: Name QT_NO_MAKE_*/BUILD_* variables consistently
For consistency, apply the following renamings:
QT_NO_MAKE_EXAMPLES -> QT_BUILD_EXAMPLES_BY_DEFAULT
QT_NO_MAKE_TESTS    -> QT_BUILD_TESTS_BY_DEFAULT
QT_NO_MAKE_TOOLS    -> QT_BUILD_TOOLS_BY_DEFAULT
BUILD_EXAMPLES      -> QT_BUILD_EXAMPLES
BUILD_TESTING       -> QT_BUILD_TESTS

This should help to better convey the difference between "BUILD" and
"NO_MAKE".

To configure tests, but not to build them by default, pass the
following to CMake:
-DQT_BUILD_TESTS=ON -DQT_BUILD_TESTS_BY_DEFAULT=OFF

Analoguous for examples:
-DQT_BUILD_EXAMPLES=ON -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF

Tools can be excluded from the default build with:
-DBUILD_TOOLS_BY_DEFAULT=OFF

The variable BUILD_TESTING is still available and initialized with the
value of QT_BUILD_TESTS.

Pick-to: 6.0 6.0.0
Change-Id: Ie5f29dfbdca8bfa8d687981dfe8c19c0397ca080
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-20 20:38:03 +01:00
Alexandru Croitor
125113c909 CMake: Fix configure not to pass clang compilers for Android
That breaks configuration with CMake version 3.18.x (but not 3.19 for
some reason).

Specifically configure ends up passing -DCMAKE_CXX_COMPILER=clang++
which overrides the compiler set by the CMake Android toolchain file,
and at the very end of CMake's configuration it complains about

 You have changed variables that require your cache to be deleted.
 Configure will be re-run and you may have to reset some variables.
 The following variables have changed:
 CMAKE_CXX_COMPILER= clang++

Which suddenly starts another configuration with the modified
compilers, ends up detecting host compilers and libraries and
basically everything breaks apart.

Fix QtProcessConfigureArgs.cmake not to pass the compiler options if
the mkspec contains 'android'.
Who knows, we might need this for other platforms too at some point.

Task-number: QTBUG-88460
Change-Id: Idd57870a7cb1009a4e7802e5b3d5ac735f2dacf6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-11-16 12:36:33 +01:00
Alexey Edelev
d312580a05 CMake: Add special processing of opengl configure option
Since feature evaluation expects explicit 'no' value for INPUT_opengl
to disable either desktop or es2 opengl support, add special
processing for -no-opengl option into QtProcessConfigureArgs.cmake

Task-number: QTBUG-88142
Change-Id: Ib49123ee3e9f98035f6ec85a182382559f4db478
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-12 14:25:06 +00:00
Alexey Edelev
6af1358742 CMake: Fix configure arguments handling
All configure arguments should be processed as strings
and not be ignored if they satisfy CMake's FALSE criteria
(see https://cmake.org/cmake/help/latest/command/if.html)

Fixes: QTBUG-88424
Change-Id: I932038ad3c5999bed58957dec51fbf892bd650d7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-12 14:25:06 +00:00
Joerg Bornemann
88efeb9e25 CMake: Map configure -hostdatadir to INSTALL_MKSPECSDIR
In the qmake-based build, the hostdatadir is the directory where "Data
used by qmake" is located. In the CMake build the equivalent is
INSTALL_MKSPECSDIR. Create the mapping accordingly.

Fixes: QTBUG-88211
Change-Id: I9e3d1af24bc7f41333ef2269fced5ab3fcfa848d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-10 18:06:54 +01:00
Joerg Bornemann
30a9b045cc CMake: Implement configure -list-features
Extend qt_configure_get_padded_string to make the feature list look like
qmake's.

Fixes: QTBUG-88144
Change-Id: I714f2b2f3537b506365a03b5b6bc3413e9cab167
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-10 16:53:31 +01:00
Joerg Bornemann
e990b649fa CMake: Make Release the main config of a -debug-and-release build
In configure we need to set the Release configuration first to make it
the main configuration.

Change-Id: I5fe744b0dcea009c4d672bf519b38c80c87475dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-10 14:23:08 +01:00
David Skoland
e674ee5328 Add quotes to cmake_args in guess_compiler_from_mkspec function
These were omitted in the original change, which cause cmake builds to
fail configuring

Change-Id: I37996099aaa0d912ce06b1f06c175cc5cf159e33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-11-04 08:08:19 +01:00
Alexey Edelev
dc43061e9a CMake: Add handling of user-defined INPUT_foo cache variables
"configure" script translates feature-related parameters to INPUT_
variables instead of FEATURE_.

Both INPUT_ and FEATURE_ variables passed to cmake script are
equivalent. FEATURE_ has higher priority in case if both are defined.

Fixes: QTBUG-87755
Change-Id: If697a0d62ab839877a3196ea74e631582a570dda
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-03 16:28:14 +01:00
Joerg Bornemann
1bb6779389 CMake: Let configure guess the compiler from mkspec argument
The arguments -platform, -xplatform and -device determine the mkspec
that's used for the qmake companion files.

If the user specifies a mkspec that indicates usage of clang or icc,
set the respective CMake variables to use one of those compilers.

Fixes: QTBUG-87836
Change-Id: I2b10d819b0eb92a97d7f79672547b1e2d821cf33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-02 16:33:40 +01:00
Joerg Bornemann
cb7f4030bc CMake: Fix [qt-]configure[-module].bat arguments with backslashes
We must escape backslashes in CMake code that's to be evaluated and in
the arguments we read from config.opt.

Change-Id: I65d033c77f71888974983aa3d834acb2fe89f3fb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-30 08:22:35 +01:00
Joerg Bornemann
90e384d286 CMake: Fix CMake generator auto-selection on Windows
The variable to check for a Windows host system was mis-typed.

Change-Id: I25b14b80d25bfec0c1a00e99833520b6fb6a4b02
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-10-22 20:47:10 +02:00
Joerg Bornemann
9ff9a54bfb CMake: Fix INPUT_* names with dashes
In configure.json files we have inputs with dashes, e.g.
bundlex-xcb-xinput. In configure.cmake files, these are read in their
normalized form, e.g. INPUT_bundled_xcb_xinput.

Normalize the input names in QtProcessConfigureArgs.cmake like we
already do for feature names.

Change-Id: Iece414d40a0e9e2920580f2fda68e25cd32674c9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-22 18:06:19 +02:00
Joerg Bornemann
73f9c514dc CMake: Ignore license-related configure arguments
Do not print warnings for the configure arguments -commercial,
-opensource and -confirm-license. We're not removing the arguments yet
to keep existing build scripts working.

Fixes: QTBUG-86096
Change-Id: Ieb63e2f2b81c022e8559cde6c3e0be0b8ce655ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-17 23:27:31 +02:00
Joerg Bornemann
557d2adbe8 CMake: Autodetect Android toolchain file and NDK
The Android toolchain file is now autodetected from the location of the
NDK. The NDK location can be specified by setting the CMake variable
ANDROID_NDK_ROOT. Auto-detection of the Android toolchain file is the
only purpose of this variable.

In recent Android SDK installations the path to the NDK is well-known
and can be auto-detected too. If only ANDROID_SDK_ROOT is given, we try
to detect ANDROID_NDK_ROOT first and from that the Android toolchain
file.

Adjust the build instructions in cmake/README.md, and remove the part
where we suggest to set some environment variables that are only used to
create the cmake call.

Task-number: QTBUG-87068
Change-Id: Ia0df5df7651e98979e9cead1cdae7b17ecbc4afb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-13 19:44:45 +00:00
Joerg Bornemann
18357033b4 CMake: Fix the -sanitize configure option
This needs to map to ECM_ENABLE_SANITIZERS.

Fixes: QTBUG-87316
Change-Id: I9e983728af0ba69fd428944e647f0afae8c61772
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-12 13:57:56 +02:00
Alexandru Croitor
5b90b650a4 CMake: Implement missing iOS-related configure options
Detect an iOS build when either an -sdk option is passed
or when -xplatform macx-ios-clang is passed as a target
mkspec.

Now that CMake 3.17 is released, change the default behavior of the
iOS build to configure with simulator_and_device set to ON, like it
is with qmake.

Update the documentation regarding iOS configuration.

Change-Id: I91aaf706610b8d3c69f1ad4ba9dadee2b1e5db97
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-12 13:35:57 +02:00
Kai Koehne
ab4acdbeb1 Do not build tests and examples by default for configure -cmake
Tests were never built by default, except for -developer-build.
Examples were build, but aren't anymore by default if you
run cmake directly.

Let the default be figured out by cmake, and only set
BUILD_EXAMPLES and BUILD_TESTING if the user has
expicitly passed them via -make or -nomake.

Task-number: QTBUG-87217
Change-Id: I37321d96cc1e9e184a711a858c860b0205d5b74f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-08 11:12:30 +00:00
Joerg Bornemann
1f52f45836 CMake: Implement missing Android-related configure options
Implement the last remaining Android-related configure options for the
CMake build.

Print warnings for options that have no equivalent in the CMake build.

Let -android-ndk automatically deduce the CMake toolchain file, and
error out if that fails with a hint how to fix the situation.

Task-number: QTBUG-85373
Change-Id: I8399e5334ae0f1f6634e381775a308d34f7c482b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-06 06:31:18 +02:00
Joerg Bornemann
260a6e86c2 CMake: Extend message functions in QtProcessConfigureArgs.cmake
qtConfAddWarning was missing, despite being used.

All of the three qtConfAdd* functions take multiple parameters and pass
them to the CMake's message() function.

Change-Id: I1fad46c6fd00b2e733b32cda482bbf1341ffc63f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-06 06:31:18 +02:00
Joerg Bornemann
84485dfad3 CMake: Fix -[no-]warnings-are-errors configure argument
The CMake build uses the WARNINGS_ARE_ERRORS variable, and the feature
warnings_are_errors exists only in the qmake build.

Change-Id: I1e548b30b210b3dd1b2f23041d490a981312f4ba
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-01 14:56:23 +02:00
Cristian Adam
079cf55111 CMake Build: Add support for -qtlibinfix configure parameter
Rename all libQt6*.so to libQt6*<infix>.so

Task-number: QTBUG-85438
Change-Id: I4b91ffaaec7bea61454b0d3c794c77f2d0868d54
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-23 17:31:13 +02:00
Joerg Bornemann
25cc901f04 CMake: Fix configure -redo for top-level builds
When re-doing in a top-level build, we did not read the config.opt file
from the top-level directory.

Also, the config.opt file should not contain the -top-level argument.
This is an internal option, and on Windows, it was already missing. The
information whether we're doing a top-level build is now passed in the
CMake variable TOP_LEVEL.

Change-Id: Iaecd7306a4b6d9ad494684c201cf12f8e74d684b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-22 22:20:43 +02:00
Assam Boudjelthia
b9c85d6b0e CMake: build add flags for building QtAndroid.jar
Adds -source, -target, -Xlint:unchecked, -bootclasspath flags.

Setting default javac build source and target versions to 8.

Allow setting custom values for javac build versions via
-DQT_ANDROID_JAVAC_SOURCE, and -DQT_ANDROID_JAVAC_TARGET.

Task-number: QTBUG-86282
Change-Id: I98f4f193ac96016dc722d178594d7fd401202f68
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-16 20:55:16 +03:00
Joerg Bornemann
87fd930fca CMake: Fix qt-configure-module for modules without qt_cmdline.cmake
Some repos/modules don't have configure.json files and thus no
qt_cmdline.cmake files. Make qt-configure-module check for the file's
existence. As drive-by fix, surround the configure.cmake's path by
double quotes.

Change-Id: If1a91a0bba0c2fd282cfa08fa6ff2bb20f0a15ba
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-11 17:11:03 +02:00
Joerg Bornemann
96bdcdacbc CMake: Implement configure -ltcg
This configure switch sets the CMake variable
CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> per release config to ON.

The feature 'ltcg' is enabled if any of the variables
CMAKE_INTERPROCEDURAL_OPTIMIZATION,
CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG> are ON.

In order to implement the check, configurejson2cmake had to be extended
to be able to write extra CMake code before and after the feature
definition. This extra code can be added to a feature mapping below the
keys "cmakePrelude" and "cmakeEpilogue".

Task-number: QTBUG-85373
Change-Id: Ia2eb907edcf087f137977a9b090705397f83eb05
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-11 11:30:56 +02:00
Joerg Bornemann
7ddb4dcad5 CMake: Implement configure -qpa
Change-Id: I38a938cda91a525d2af22deec864c6a12af3e29d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-11 00:41:20 +02:00
Joerg Bornemann
46f8c46bee CMake: Teach QtProcessConfigureArgs.cmake to configure other modules
Until now, QtProcessConfigureArgs.cmake could only handle qtbase and the
top-level build. Add the variable MODULE_ROOT that the user can point to
the module that is to be configured.

Example - QtDeclarative can now be configured like this:

cd qtdeclarative-build-dir
echo -qml-network > config.opt
cmake -DOPTFILE=config.opt -DMODULE_ROOT=<source-root>/qtdeclarative \
    -DCMAKE_COMMAND=<install-prefix>/bin/qt-cmake-private \
    -P <source-root>/qtbase/cmake/QtProcessConfigureArgs.cmake

A convenience script that saves the user from entering this unwieldy
incantation will be added in a subsequent commit.

Change-Id: If46103de3a8eb84b15e7600ebfec25544451e1d5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-09-02 23:44:03 +02:00
Joerg Bornemann
7e7c9ba455 CMake: Support configure tests of type 'linkerSupportsFlag'
Task-number: QTBUG-86155
Change-Id: I3764d99cd4ad1c432b499ec9ba7c4c48391fa421
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-23 11:04:46 +02:00
Joerg Bornemann
c8fda317ea CMake: Fix configure setting superfluous features
Command line options like -debug result in setting the variable
INPUT_debug. INPUT_debug is mapped to the CMake argument
-DCMAKE_BUILD_TYPE=Debug. INPUT_debug also matches the feature
'debug', and the CMake argument -DFEATURE_debug=ON was passed.

Do not pass -DFEATURE_xxx CMake arguments for inputs that are already
handled.

Change-Id: If096dff1c6dd694545c6f671f5f3512a43c3ec50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-23 11:04:38 +02:00
Joerg Bornemann
df28355981 CMake: Support configure tests of type 'compilerSupportsFlag'
Task-number: QTBUG-86155
Change-Id: Iaa5c48b6508870a0f6afdf9df66cd2e634fe19b3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-20 17:07:46 +02:00
Joerg Bornemann
5f729da74a CMake: Implement configure -qreal <type>
The configure argument -qreal <type> maps to the CMake argument
-DQT_COORD_TYPE=<type>.

Fixes: QTBUG-83325
Change-Id: I94970f31ccfb241b1dd4f1d9b6cef25d6684dc05
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-19 08:28:50 +02:00
Joerg Bornemann
d6e41abd62 CMake: Handle -D, -I, -F and -L configure arguments
Introduce new CMake variables and map
-D to QT_EXTRA_DEFINES,
-I to QT_EXTRA_INCLUDEPATHS,
-L to QT_EXTRA_LIBDIRS,
and -F to QT_EXTRA_FRAMEWORKPATHS.

Those variables only affect the Qt build, not user projects.

Fixes: QTBUG-85878
Change-Id: I229df2eed1505a2619068d0d32975962b052569a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-17 18:19:24 +02:00