Commit Graph

91 Commits

Author SHA1 Message Date
Alexandru Croitor
9cc9ef232d CMake: Regenerate configure.cmake files
And adjust configure.json files that were stale

Amends d385158d52

Change-Id: I851838a12c3773a6e8119ebc7f1de941ae7fe224
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-27 21:33:48 +02:00
Niclas Rosenvik
fadd87ed15 Add Solaris support in cmake build
Add SOLARIS cmake platform definition.
Add settings for QT_DEFAULT_MKSPEC so that qplatformdefs.h can be found.
Solaris has its gssapi symbols in libgss.
Solaris supports @ORIGIN.

Solaris ld does not support --dynamic-list needed for reduce relocations.
Make solaris fail the reduce relocation test.

getauxval is specific to GNU libc and some other libc implementations on
Linux but sys/auxv.h is not. The bootstrap uses sys/aux.h as the only
indication for getauxval. This breaks builds on Solaris, so only make
sys/auxv.h an indicator for getauxval on linux or glibc based systems.

Solaris uses X11 so add it to the X11_SUPPORTED list.

Solaris network libraries for sockets etc are in socket and nsl.
ifreq does not have a member ifr_ifindex on Solaris, it uses
ifr_index. Add test to check if ifr_index is a member of ifreq.
The first struct in the in_addr union on solaris is defined as four
uint8_t, therefore four arguments are needed for its initializer list.

Change-Id: Ieed4c1bbac8559a7ae1db9c4e1e91f609f150270
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-04-21 20:57:04 +00:00
Alexandru Croitor
b25eb6e0bd CMake: Introduce zlib find script to work around hardcoded iOS SDK
Xcode allows building a project targeting either the device or
simulator sysroot in one single build dir, but for the sysroot
switching to work there should be no linker or compiler flags
referencing absolute paths of a specific sysroot.

During CMake configuration of a project targeting iOS, all found
system libraries will be within one single sysroot, either the device
one or the simulator one, whichever one was passed to
CMAKE_OSX_SYSROOT. CMake will then generate the Xcode project
and pass those absolute paths, which makes sysroot switching within
Xcode not work.

To avoid that, the CMake documentation recommends passing linker and
framework flags of the form '-lfoo' and '-framework bar' instead of
absolute paths. Xcode then takes care of setting the correct framework
search path.

Zlib is one of the libraries found in the iOS sysroot and thus passed
as absolute path.
To avoid that, create a new FindWrapZLIB find script. The target it
creates will pass the absolute path to the library on non Apple
platforms and an -lz linker flag on Apple platforms (macOS and iOS).

To avoid issues with target global promotion when system PNG package
is found, ensure that a found ZLIB::ZLIB target is promoted to global
manually in src/gui/configure.cmake.

Pick-to: 6.1
Change-Id: I8bd8649be4f680a331ad51925f27cb9d13ac5e5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-04-19 20:30:45 +02:00
Joerg Bornemann
f4417bf7e8 Check whether CMake was built with zstd support
CMake 3.18 introduced the file(ARCHIVE_CREATE) API that we use with
COMPRESSION Zstd for compressing corelib's mimedatabase.

It's possible to build CMake without proper zstd support, and we have
encountered such builds in the wild where the file(ARCHIVE_CREATE) call
crashes.

Add a configure test to determine whether CMake properly supports the
Zstd compression method.

Fixes: QTBUG-89108
Change-Id: I37e389c878845162b6f18457984d4f73a265b604
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-16 16:49:28 +02:00
Michal Klocek
4b4642143a "Export" linker features
We need to feed gn with linker info for qtwebengine build.

Change-Id: I4bd96af8bb8a1927e4c03e5c5d4ade10a0876eb1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-07 12:16:20 +02:00
Alexandru Croitor
659817e287 CMake: Fix building multi-arch universal macOS Qt
Use the same approach we use for iOS, which is to set multiple
CMAKE_OSX_ARCHITECTURES values and let the clang front end
deal with lipo-ing the final libraries.

For now, Qt can be configured to build universal macOS libraries by
passing 2 architectures to CMake, either via:

  -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"

or

  -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"

Currently we recommend specifying the intel x86_64 arch as the first
one, to get an intel slice configuration that is comparable to a
non-universal intel build.
Specifying the arm64 slice first could pessimize optimizations and
reduce the feature set for the intel slice due to the limitation
that we run configure tests only once.

The first specified architecture is the one used to do all the
configure tests.

It 'mostly' defines the common feature set of both architecture
slices, with the excepion of some special handling for sse2 and
neon instructions.

In the future we might want to run at least the Qt architecture config
test for all specified architectures, so that we can extract all the
supported sub-arches and instruction sets in a reliable way.

For now, we use the same sse2 hack as for iOS simulator_and_device
builds, otherwise QtGui fails to link due to missing
qt_memfill32_sse2 and other symbols.

The hack is somewhat augmented to ensure that reconfiguration
still succeeds (same issue happened with iOS). Previously the sse2
feature condition was broken due to force setting the feature
to be ON. Now the condition also checks for a special
QT_FORCE_FEATURE_sse2 variable which we set internally.

Note that we shouldn't build for arm64e, because the binaries
get killed when running on AS with the following message:

  kernel: exec_mach_imgact: not running binary built against
  preview arm64e ABI.

Aslo, by default, we disable the arm64 slice for qt sql plugins,
mostly because the CI provisioned sql libraries that we depend on only
contain x86_64 slices, and trying to build the sql plugins for both
slices will fail with linker errors.
This behavior can be disabled for all targets marked by
qt_internal_force_macos_intel_arch, by setting the
QT_FORCE_MACOS_ALL_ARCHES CMake option to ON.
To disble it per-target one can set
QT_FORCE_MACOS_ALL_ARCHES_${target} to ON.

Task-number: QTBUG-85447
Change-Id: Iccb5dfcc1a21a8a8292bd3817df0ea46c3445f75
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-04-01 18:14:59 +02:00
Lorn Potter
4972fdb350 wasm: add cmake build support
A few configure defines get changed:
QMAKE_WASM_PTHREAD_POOL_SIZE is now QT_WASM_PTHREAD_POOL_SIZE
QMAKE_WASM_TOTAL_MEMORY is now QT_WASM_INITIAL_MEMORY
QMAKE_WASM_SOURCE_MAP_BASE is now QT_WASM_SOURCE_MAP_BASE

device-option EMSCRIPTEN_ASYNCIFY=1 is QT_EMSCRIPTEN_ASYNCIFY=1

To create source maps for debugging. use
device-option QT_WASM_SOURCE_MAP=1

Task-number: QTBUG-78647
Change-Id: If9f30cd7fb408c386d6d69b5f7b1beecf1ab44b5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-04-01 19:23:42 +10:00
Alexandru Croitor
8f2795b17f CMake: Expose sub-arch test results as features
Needed for QT_FEATURE_foo checks in repos other than qtbase when
building SIMD specific files (e.g. qtimageformats).

Task-number: QTBUG-85447
Change-Id: Ibd2200fe24cecbb0b2a092f645ca622baf738601
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-31 23:27:54 +02:00
Joerg Bornemann
e6cee41c53 Error out on attempt to configure framework build with lib infix
Setting a lib infix is not supported with framework builds due to the
nature framework of include resolution: includes like <QtCore/qstring.h>
won't work if the framework is named QtCoreInfix.

The combination framework build and lib infix was agreed on to be out of
scope in the comments of QTBUG-35604.

Pick-to: 6.1
Change-Id: Ib7c6983f2f64ea1a7cfcd56657d31eeab3f55fe3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-17 09:04:57 +01:00
Edward Welbourne
18bf641777 Use newlines more consistently in generate compile-test code
The generated code contained many repeated blank lines.
Most main()s were preceded by one, but not all.
Only include blank lines for actual empty entries in lists, where
configure.json specified them, plus one before main if anything else
precedes it.

Change-Id: I6e6c34940e08712a1aa848a3c9ad1b0fb5806d77
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:45:14 +01:00
Edward Welbourne
73fbf8bd30 Simplify test-snippets in configure.cmake
The main(void) signature obviates the need for unused parameters and
has existed since (at least) C89; so use that instead of the
old-fashioned argc/argv arguments we don't use in any of these tests.

Change-Id: Ibfe850a1fce378673c9781011475ea623fd75ad4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:43:52 +01:00
Edward Welbourne
5645ef305a Add some special case markers that seem to have been neglected
At least, running util/cmake/configurejson2cmake.py changes these lines.
Adding them has provoked the script to add a .prev_configure.cmake file.

Change-Id: Idc123d1dee2ce51cd640c090c7910ecc1f0fc5a4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-15 13:43:42 +01:00
Kai Köhne
3c412c93c2 Update name of c++2a to c++20
Keep the c++2a feature, but make it an alias for compatibility
purposes.

Pick-to: 6.1
Change-Id: I6f153109be84659806f1b7a57a88a187875166d8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-02-10 07:54:06 +01:00
Joerg Bornemann
9d84bafeba Make it possible to disable the PrintSupport module
Introduce the 'printsupport' feature to control whether the PrintSupport
module is built.

[ChangeLog][QtPrintSupport] Building of QtPrintSupport can be disabled
by passing -no-feature-printsupport to configure.

Fixes: QTBUG-90778
Change-Id: I8a9a4b7f8dd8f39a81565c8eb14ce1ae0839267d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-02-09 09:17:21 +01:00
Alexey Edelev
bbebfa0be2 CMake: Add --enable-new-dtags flag support
Remove enable-new-dtags from feature mapping, handle it as regular
feature. Regenerate configure.cmake with 'enable-new-dtags' enabled.
Check for enable_new_dtags feature, add -Wl,--enable-new-dtags if
enabled.

Fixes: QTBUG-89013
Pick-to: 6.0
Change-Id: Ice57c02dc85f7f9ecf14e3bc65f31a57b589ce24
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2020-12-22 10:28:34 +00:00
Alexandru Croitor
2f1c087573 CMake: Fix conditions for some subarch features
The AES and SHA features were checking for the wrong TEST_subarch_foo
variables.

Pick-to: 6.0
Task-number: QTBUG-87376
Change-Id: I46cd14d98832529aebac22cfcb01180330c5e091
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-12-04 11:22:38 +01:00
Joerg Bornemann
e559da3c6a CMake: Fix detection of the ltcg feature
When checking the value of CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>,
then <CONFIG> must be the upper case configuration name.

Also, we must not unset __qt_ltcg_detected, because the feature
condition evaluation happens way after the feature definition, and
__qt_ltcg_detected was not available anymore there.

This commit amends 96bdcdacbc.

Fixes: QTBUG-87874
Change-Id: I2b555bd1d7fbc8973e1d9493045c27d61b0d2c1b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-06 22:03:50 +01:00
Joerg Bornemann
4f75c24b3e CMake: Allow Debug-only iOS builds
They are disabled for the qmake build due to QTBUG-71990, but the issue
doesn't apply to the CMake build.

Task-number: QTBUG-71990
Change-Id: I6c659e9dbbc947fd3c6241f9fab2ea306c98020b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-16 13:53:03 +02:00
Alexandru Croitor
2354274f39 CMake: Allow embedding debug info in object files with MSVC
Introduce a new feature called 'FEATURE_msvc_obj_debug_info' which
should allow usage of sccache for Windows MSVC configs.

Enabling the feature will replace the default '/Zi' compile flag
that CMake sets in Windows-MSVC.cmake with '/Z7'.

This ensures that the debug info is placed into the compiled object
file instead of placing it in the compilation .pdb file via
mspdbsrv.exe.
The final pdb file will still be created for shared libraries and
executables due to the linker '/debug' flag.
Static libraries will not have a .pdb file, instead the debug info
being embeeded in the .lib file.

The downsides of using '/Z7' are more disk space usage, slower
link times, more memory used for linking because the linker needs
to deal with more symbols.

The upside is that caching each indepedent cl.exe call is possible.
This is what Chromium uses with goma, and Firefox with sccache.

We're not enabling the feature by default to allow easier
testing (and switching it off) in the CI if it proves not to be
feasible.
It will probably have to be disabled at least for building
qtwebengine due to high memory requirements.

Task-number: QTQAINFRA-3934
Change-Id: I89e0e57995e938a780be318d1faec700194aa93f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-06 10:07:10 +02:00
Alexandru Croitor
98bea5857a CMake: Introduce CMake-only optimize_full feature
Enabling it will force usage of '-O3' flag when building Qt.
If the platform has no '-O3' flag, use '-O2' as a fallback.

Task-number: QTBUG-86866
Change-Id: If13f7de954ba5c01dc9634f06a85529828fe90a9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-06 10:07:08 +02:00
Joerg Bornemann
c09df7b57c CMake: Implement configure -reduce-exports
This option maps to FEATURE_reduce_exports. The feature is on by
default, except for MSVC. The reduce_exports configure test is not used
in the CMake build.

The <LANG>_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target
properties are now explicitly initialized in the
qt_set_common_target_properties function, because we don't have access
to the feature in QtSetup.cmake where the CMAKE_<LANG>_VISIBILITY_PRESET
variables were set before.

Task-number: QTBUG-85373
Change-Id: I378453f0e0665731970016170302871e20ceb4e2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-10-05 10:05:20 +02:00
Alexandru Croitor
9bcabd71a7 By default don't try to use pkg-config when targeting Android
It causes issues in our Windows CI, because the strawberry perl
pkg-config is found. And even that one is unusable, due to a bug in
CMake which is tracked at
https://gitlab.kitware.com/cmake/cmake/-/issues/21239

Change-Id: I58816195d35459e8a44c923399c35a4956c222a2
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-09-28 15:48:17 +02:00
Alexandru Croitor
75c4fd52d1 CMake: Regenerate configure.cmake files
Change-Id: I844e82b4655cf1967b16a7785b4e1ef777e61c22
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-09-15 15:55:47 +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
069fc33e8a Remove the -no-compile-examples configure switch
If '-make examples -no-compile-examples' was specified, sources of Qt's
examples would be installed, but the examples would not be built.

This switch has always been a source for confusion and is only
interesting for distributors, who can just package the examples
directory tree.

Change-Id: I0291d70e4951d98b553a4abf217db49d05316d3a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-09-11 00:40:46 +02:00
Assam Boudjelthia
ff1a44be33 Android: don't use avx and avx2 when building for Android x86_64
The Android build for x86_64 fails with CMake. It should also fail with
qmake builds but the current multi-ABI build is testing the feature for
arm64-v8a only.

In [1], it's stated that AVX and AVX2 are not supported on x86_64 ABI.

[1] https://developer.android.com/ndk/guides/abis#86-64

Task-number: QTBUG-85982
Change-Id: I20c9366bdee2a13ca554ec67f5d0c041bd068b91
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-09-10 18:29:05 +03:00
Joerg Bornemann
721812c5d2 CMake: Implement configure -gdb-index
Change-Id: Iea0fb99297751b1baf830a416ea5041d0b9a3b63
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-23 11:05:01 +02:00
Joerg Bornemann
4306fc019a CMake: Fix detection of the 'debug' feature
The debug feature for the CMake build is solely determined by the value of
CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES. There is no point in
restricting the autoDetect expression to developer builds or MSVC and
macOS builds.

User-visible result: -DCMAKE_BUILD_TYPE=Debug now actually turns the
'debug' feature on, also for non-developer builds on Linux.

Change-Id: I65c92575c9483bff16beb78b60606c55aeadcece
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-23 11:04:55 +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
48cf015906 CMake: Implement configure -optimize-size
This configure switch controls the feature 'optimize_size'.

This isn't merely a mapping to CMAKE_BUILD_TYPE=MinSizeRel, because
we potentially want to combine -optimize-size with -force-debug-info,
which maps to CMAKE_BUILD_CONFIG=RelWithDebInfo.

Task-number: QTBUG-85373
Change-Id: I1a9343ebc54816f52e90e9d33ea3df4c99b1ec9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-23 11:04:42 +02:00
Joerg Bornemann
729d102b1c CMake: Implement configure -optimize-debug
Task-number: QTBUG-85373
Change-Id: I3aba1fcf96e36544dd75a5e6adc5f770a9a45726
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-20 17:07:53 +02:00
Joerg Bornemann
2f1a55c0b1 CMake: Implement configure -linker [bfd,gold,lld]
Fixes: QTBUG-86155
Change-Id: I5ba2d3b52d9ca240b48904c492f7902a056c0292
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-20 17:07:49 +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
f4f4557835 Remove Qt 5.1 binary-compatibility warning
There's no way that Qt 6 will be binary-compatible with Qt 5.1.

Change-Id: Ic1abfbdc8dc497dcb24494a8f3e2d96bcf27ef83
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-08-18 12:55:38 +02:00
Alexandru Croitor
3c52f8af9d CMake: pro2cmake: Specify library versions for 3rd party libraries
If certain 3rd party libraries have a version that's not suitable for
Qt, the configure summary should say so, rather than use them and fail
at build time.

With the current situation, we have to duplicate the version
information from the configure.json files in helper.py, by assigning
the version number as an extra find_package variable.

Rerunning configurejson2cmake then embeds this version info into the
qt_find_package calls in configure.cmake.

Some of the Find modules are rewritten to take the  specified version
into account when looking for the libraries.
This involves moving around the code for creating a target, after
calling find_package_handle_standard_args() so we know if a good
enough version was found.

Task-number: QTBUG-82917
Change-Id: I139748d8090e0630cda413362760034dc3483e11
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-08-10 11:56:54 +02:00
Joerg Bornemann
79fda7a549 Make -qtlibinfix affect the names of plugins by default
In Qt5, the -qtlibinfix option did not affect the naming of plugins,
unless -qtlibinfix-plugins was set. This option was added in
5641650993 to offer a way to have -qtlibinfix affect the plugin names
without changing the default behavior. We now remove the
-qtlibinfix-plugins option, as the old behavior is not desirable.

[ChangeLog][configure] The -qtlibinfix option now affects the names of
plugins. The -qtlibinfix-plugins configure option was removed.

Task-number: QTBUG-15192
Fixes: QTBUG-85439
Change-Id: I96f5c2577b76274929c431621967df0e9b4631b7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-07-13 20:30:18 +02:00
Joerg Bornemann
943340222e CMake: Generate qdevice.pri when cross-building
This adds the CMake equivalent to the classical -device-option key=value
configure argument:
-DQT_QMAKE_DEVICE_OPTIONS=key1=value1[;keyN=valueN]
The keys and values get dumped verbatim into qdevice.pri.

This patch also ports the machineTuple configure test. Its result is
written into qdevice.pri as value for the GCC_MACHINE_DUMP variable.

Change-Id: I29f2323fd87639fafaed99ec7446c7ee75504705
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-06-29 12:47:59 +02:00
Alexandru Croitor
7e03bc39b8 CMake: Improve sanitizer detection
The change fixes the labels to show up correctly in the configure
summary.
It also allows enabling the sanitizer via the feature flags, e.g.
-DFEATURE_sanitize_address=ON.
Finally the qtbase sanitizer option is saved in QtBuildInternalsExtra
so that repos built after qtbase have the same sanitizer options
enabled.

Change-Id: Ic9d9e3ce3c7ebbc244ced2e6d163d1ac8ee06b12
Fixes: QTBUG-84721
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-06-15 18:41:35 +02:00
Alexandru Croitor
a08bf7f00a CMake: Fix usage of gc_binaries feature
The qt_internal_apply_gc_binaries function should apply both compile
and link flags, not just link flags.

The flags should be applied publically to all consumers of Bootstrap
regardless if the gc_binaries feature is enabled.

The flags should be applied publically to Core only in case if the
feature is enabled (aka for static builds only).

Change-Id: Id42af0d9b527004d74c04eff2c9e3c2be1e76aac
Fixes: QTBUG-84461
Task-number: QTBUG-83929
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-12 22:34:12 +02:00
Oliver Wolff
45b0f1be68 Remove winrt
Macros and the await helper function from qfunctions_winrt(_p).h are
needed in other Qt modules which use UWP APIs on desktop windows.

Task-number: QTBUG-84434
Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-06 20:25:49 +02:00
Alexandru Croitor
71e3b04282 CMake: Regenerate rest of configure.cmake files
Change-Id: I17cca57c18f33d4283eb6009ba4c5ebb0c1847c3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-05-29 23:23:06 +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
Lars Knoll
7ea6cee525 Don't enable -headerclean by default even for developer builds
The CI system can test this, but there's little reason to blow
up every developers compile time by 30%.

Change-Id: I7677b0411103fb1301ad087c884cc9bd22a5aee2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-05-14 19:16:33 +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
Joerg Bornemann
2a0585e7cb CMake: Port the 'pkg-config' feature
Change-Id: If571208aaaba8c1d0af834e8ae11869872d42135
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-04-21 09:01:39 +02:00
Joerg Bornemann
3eed6d76b7 CMake: Port the 'ccache' feature
This maps to the CMake variable QT_USE_CCACHE.

Change-Id: I3258027301284d907f6ecde6c65d2c0dde8f0a11
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 23:10:11 +02:00
Joerg Bornemann
8a5ffc4f73 CMake: Port the 'ltcg' feature
This maps to the CMake variable CMAKE_INTERPROCEDURAL_OPTIMIZATION.

Change-Id: Id0ce48f176b95c27e74ab80276e89503b1660f79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 23:10:09 +02:00
Joerg Bornemann
9b45ca7411 CMake: Port the 'cross_compile' feature
Change-Id: Iccd1d55e95797740a4a8689462ce9ab1e49a62c1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-04-17 20:42:42 +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