Commit Graph

1207 Commits

Author SHA1 Message Date
Joerg Bornemann
4ae9922166 Move bin/qt-internal-configure-tests to libexec
Pick-to: 6.1
Task-number: QTBUG-88791
Change-Id: I78613128760b5820e6db17b0c09462e34f7c7bb2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 14:39:12 +01:00
Alexey Edelev
9275edbc31 Remove the redundant code related to the QT_NAMESPACE variable
Change-Id: Ib82b199fc7761c8b84f915c2808c7f57bf23927c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-30 10:31:34 +02:00
Alexey Edelev
361daa2990 Fix plugin SKIP_INSTALL option
If SKIP_INSTALL option is specified for the qt_internal_add_plugin
function the install_directory variable become empty and finalizer unable
to call qt_finalize_plugin, because of lack of the second argument. It
makes sense to use the INSTALL_PATH single argument instead.

Change-Id: I2d4b40c8cf812a834c0e045569b45a649d339508
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-29 18:49:40 +02:00
Craig Scott
aa4a1006cb Refactor qt_internal_add_plugin() and qt6_add_plugin()
Remove code duplication by calling qt6_add_plugin() from
qt_internal_add_plugin().

Separate out the public and internal arguments for the
variables defined in QtBuild.cmake for these functions.
Provide them via commands instead for greater robustness.
This separation allows other Qt repos to access the appropriate
set of keywords where they define commands that forward
on to *_add_plugin() in their implementations. Retain
the old variables for now to simplify the integration
steps for updating other repos. The old variables can
be removed once there are no more references left to
them in any repo.

Task-number: QTBUG-88763
Pick-to: 6.1
Change-Id: I0105523afd95995923bd20fc963d245bbb15d34d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-29 18:10:22 +11:00
Joerg Bornemann
98e8180e56 Fix error when re-configuring an already installed Qt repository
When building and installing a Qt repo that provides plugins for a Qt
module within a different repository (for example, qtimageformats
providing imageformat plugins for QtGui), re-configuring that repository
would result in configuration errors like

"add_library cannot create ALIAS target "Qt6::QTgaPlugin" because
another target with the same name already exists."

This happened, because the find_package(Qt6 COMPONENTS Gui) calls pulled
in the Qt6*PluginConfig.cmake files that create imported targets for the
plugins we want to build.

To fix this, when building Qt, we now load only plugins that are
provided by repositories the currently building repository depends on.

We read the repo dependencies from dependencies.yaml when the
Qt6BuildInternals package is loaded, but only in static builds and only
if we're currently building a Qt repository.

To find out whether we're building a Qt repository, we check whether
QT_REPO_MODULE_VERSION is defined. We cannot check QT_BUILDING_QT,
because that variable is not available for the first find_package calls
in the repository's top-level project file.

In each Qt6*PluginConfig.cmake file, we bail out if the plugin's
repository is not one of the ones in QT_REPO_DEPENDENCIES.

Fixes: QTBUG-86670
Fixes: QTBUG-91887
Change-Id: I8f6c8398032227032742f1ca019e983ff2bcd745
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-26 11:52:00 +01:00
Qt CI Bot
4e5f203df6 Merge integration refs/builds/qtci/dev/1616686367 2021-03-25 19:44:35 +00:00
Joerg Bornemann
9f444ce533 Add a way to install versioned hard-links for tools
Add the option argument INSTALL_VERSIONED_LINK to qt_internal_add_tool
and qt_internal_add_app. For tools/apps with this argument we create an
install rule that creates a versioned hard link. For example, for
bin/qmake we create bin/qmake6.

Note that this only applies to prefix builds.

Apply this argument to qmake.
The qt_internal_add_app change is necessary for qtdiag and in qttools.

Task-number: QTBUG-89170
Change-Id: Id32d6055544c475166f4d854aaeb6292fbb5fbb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c19d957f45fa27f61b5ecc566f8dbc19f12a44c3)
2021-03-25 16:31:39 +01:00
Alexandru Croitor
59c3be7117 CMake: Fix qconfig.cpp embedded prefix in the CI
In the CI on a windows we configure Qt with the following prefix
-DCMAKE_INSTALL_PREFIX:PATH=\Users\qt\work\install

Note the lack of the drive letter.
This is intentional, so that we can abuse CMake's DESTDIR installation
mechanism to install into a custom path.

This causes trouble for static Qt builds in the CI.

Specifically when there is no qt.conf file next to qmake, qmake -query
will report a
  QT_INSTALL_PREFIX:/Users/qt/work/install
and ultimately qmake will fail to locate the module .pri files in such
a path, showing errors like:
  Project ERROR: Unknown module(s) in QT: core gui?

If a qt.conf is placed next to qmake (even an empty one), a differenct
code path is used in qmake to resolve the prefix, which returns a path
with a drive letter.

In a shared build, because the 'relocatable' feature is enabled by
default, a different code path is used and thus the prefix is
also successfully resolved.

So the problem is specific to static Windows Qt builds that have no
qt.conf file next to qmake.

This is the exact scenario that we encounter when running static
Qt tests (tst_qmake in particular).

To circumvent the issue, prepend a drive letter to the prefix
hardcoded into qconfig.cpp. Do that with
get_filename_component(REALPATH) which apparently resolves
to a fully qualified path.

Pick-to: 6.1
Task-number: QTBUG-87580
Change-Id: I17c885f29bfdee45bec1d6aac7c3b26723e761a3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-25 12:59:20 +01:00
Alexandru Croitor
eadfb2cc1a CMake: Remove some dead code
The code was added as part of
a6ccef651d
but the important bits were removed as part of
c431e2d33c

Change-Id: I6ba7bffa2bfdbeae2c92cd9ffeaa5f31771eedde
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-25 12:59:15 +01: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
Craig Scott
5807e1ae81 Add plugins to Qt tools and executables for static builds
In static builds, we cannot allow any part of the main build to make a
call to find_package(Qt6...) where such a call may load a
Qt6*Plugins.cmake file. That would add additional dependencies to the
main module targets, setting up a circular dependency in the set of
*Config.cmake files which cannot be resolved. This scenario would be
triggered by per-repo builds or user projects.

But Qt's tools and other executables still need to load some plugins
in static builds. Sometimes a platform plugin may be enough, other
times we may want all supportable plugins (e.g. Qt Designer).
Therefore, add all plugins we can identify as relevant for an
executable that is part of the Qt build, but add them directly to the
executable without affecting the linking relationships between the
main module libraries.

Also remove the now unnecessary check for QT_BUILD_PROJECT_NAME in
top level builds because there should be no difference between per-repo
and top level builds any more (as far as linking static plugins is
concerned).

Examples that build as part of the main build will still build
successfully after this change, but they will not run if they require
a platform plugin. Examples need to be moved out to a separate build
where they can call find_package(Qt6) without QT_NO_CREATE_TARGETS
set to TRUE to be runnable (see QTBUG-90820).

Fixes: QTBUG-91915
Pick-to: 6.1
Change-Id: I8088baddb54e394ca111b103313596d6743570ba
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-23 11:15:33 +11:00
Niclas Rosenvik
75296f347f Fix backtrace on non-linux systems
On BSD systems backtrace lies in libexecinfo. Use
FindBacktrace from CMake to be able to resolve
backtrace on more unixes than linux.

Change-Id: Ie14fd1727d2da03645fc2d6de10c0217baabad6b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-03-22 21:31:09 +00:00
Craig Scott
df121fd7f7 Remove unnecessary $<BOOL:...> generator expression
The $<NOT:...> genex already guarantees to return a value of 0 or 1,
so there's no need to wrap it with $<BOOL:...>.

Pick-to: 6.0 6.1
Change-Id: Iff4ad64ed8deaa846e1b5bc22d2e5d9dbcd77cc7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-22 10:28:48 +11:00
Niclas Rosenvik
83e222d8ca Properly set ICC and QCC
Using CMAKE_C_COMPILER to match the compiler
has its drawbacks. CMAKE_C_COMPILER can include
the whole path to the compiler and directory
names that incude icc, icl or qcc also match
even if the compiler is not icc or qcc.
Icc has the compiler id Intel according to
the CMake documentation.
The compiler id for qcc is QCC according to
CMake policy 0047, and this is set to new since
Qt requires CMake to be above 3.0.

Change-Id: Iceb428ed10f0f5bbaa19ec2d883da186c85e7a73
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-19 21:02:23 +01:00
Niclas Rosenvik
36a366c871 Set QT_DEFAULT_MKSPEC for various bsd systems
Set QT_DEFAULT_MKSPEC for various bsd systems, this is needed to
find qplatformdefs.h when compiling.

Change-Id: I9450193b737930548f32c87be3525c5ecd1e0e13
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-19 16:47:03 +00:00
Alexandru Croitor
d962c9ff85 CMake: Make Platform a dependency for all Qt internal targets
In particular that influences BundledLibrary targets.

Most internal targets already depended transitively on Qt::Platform
via Qt::Core as a public dependency. This was not the case for
BundledLibrary targets which don't link to Qt::Core.

This led to compilation issues in user projects when targeting
WebAssembly, due to mismatched flags between a bundled Harfbuzz vs
a user project. Probably other subtle issues as well (e.g. none of the
Windows specific compile definitions were passed to bundled libs).

Bundled libraries depend on PlatformCommonInternal already, so make
PlatformCommonInternal turn depend on the public Platform target.
I thought that was already the case, but we merely relied on the
Qt::Core dependency.

Note that Qt::Core should still list Platform as a public dependency,
so it gets propagated to user projects.

Amends acf9b3a68b

Change-Id: Ida3b219818f89ec6eba2c2d92c5db65ad56bc5a4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-19 12:52:49 +00:00
Craig Scott
63a0d263cf Prevent static plugin triggering autogen dependency on reconfigure
A call to file(WRITE) will unconditionally update the file's timestamp
even if the file's contents don't change. The *Plugin.cpp file was
being written using configure_file() which avoids that, but the .cpp.in
file it was configuring from was being written out using file(WRITE)
every time CMake ran. Autogen saw that file as a dependency and then
regenerated the mocs_compilation.cpp file, which in turn results in
unnecessary rebuilds and relinking when nothing is actually changing.

The file(WRITE) - configure_file() dance is no longer needed anyway,
since the generated *Plugin.cpp file is very simple with no
substitutions required. Therefore, we can simplify that file's
generation with a single file(WRITE) that only executes if the file
contents will change or the file is missing.

Pick-to: 6.1 6.0
Change-Id: I2b7d1ff678b85ea7811969d656555592c9b6865f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-18 15:06:14 +11:00
Mårten Nordheim
1d6a35c536 CMake: Don't attempt to add to a target that doesn't exist
When configuring a benchmark using the standalone-test script the
'benchmark' target is not available, causing a configure error.

Pick-to: 6.1 6.0
Change-Id: I8e480c9e72b47783c0910428187f0092049e89db
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-17 16:28:37 +01:00
Joerg Bornemann
a423c0d211 Merge "Fix installation of Find*.cmake files in shadow per-repo builds" 2021-03-17 10:39:14 +00:00
Joerg Bornemann
232c70ecc8 Fix installation of Find*.cmake files in shadow per-repo builds
In shadow per-repo builds we never hit the code that is supposed to
install cmake/Find*.cmake files. This caused problems when statically
building a Qt repo like qtshadertools against qtimageformats which
provides such Find*.cmake files.

Fixes: QTBUG-91538
Change-Id: I1147daee817ac71303d93e8bf368b2769afb0bb4
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-17 09:05:19 +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
Assam Boudjelthia
d6367aca86 CMake: make sure to collect Android dependencies for plugins
androiddeployqt relies on *-android-dependencies.xml files to know
what dependencies like jar files and permissions a Qt module requires.
CMake create those files under Qt prefix's lib dir but CMake was not
accounting for module plugins.

Fixes: QTBUG-90812
Pick-to: 6.1 6.0
Change-Id: Ib3b2e2bb237159b4851ac0f23dc75f8e56af3f7a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-17 01:02:21 +02:00
Joerg Bornemann
c5344e42df Merge "Remove superfluous variable assignments from configure.bat" 2021-03-11 19:03:13 +00:00
Joerg Bornemann
39157bcb0a Merge "Fix CMAKE_INSTALL_PREFIX when building against installer-provided Qt" 2021-03-11 15:59:46 +00: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
e6527e2f73 Fix CMAKE_INSTALL_PREFIX when building against installer-provided Qt
When building a module against an installer-provided Qt,
CMAKE_INSTALL_PREFIX would default to /home/qt/work/install, which is
the install prefix of our packaging machines.

Do not hard-code the install prefix in QtBuildInternalsExtra.cmake but
use the one that is calculated from the location of
QtBuildInternalsExtra.cmake.

Pick-to: 6.1
Fixes: QTBUG-90449
Fixes: QTBUG-91475
Change-Id: I39f214efb18796a89f00a171ef190c547bba5c0a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 13:26:42 +01:00
Joerg Bornemann
82d50925f1 Fix build of QTuioTouchPlugin with Makefile generator on macOS
For each plugin, we create a custom target with it's OUTPUT_NAME such
that one simply can do 'ninja qtuiotouchplugin' to build it.

QTuiTouchPlugin has qtuiotouchplugin as OUTPUT_NAME, which is
problematic with Makefile generators on case-insensitive file systems.
See CMake upstream issue #21915 for details.

Work around this issue by not creating the custom target in this
situation.

Pick-to: 6.1
Fixes: QTBUG-84342
Change-Id: Id9a6cf0a01c179d5c93da4146e393cf00153ac4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 11:29:25 +00:00
Joerg Bornemann
e6aff6c7ad Merge "Remove now unneeded QT_BOOTSTRAPPED check from qlibraryinfo.cpp" 2021-03-11 11:28:29 +00:00
Joerg Bornemann
e158d699e0 Remove all qmake-related data from q[make]config.cpp
Now that we're not actually using qmakeconfig.cpp anymore, we can remove
it together with all qmake-related information that was written into
qconfig.cpp.

This also moves the qtConfEntries array back to qlibraryinfo.cpp.

Change-Id: I5e57d8c55613332cc3e57b11df4398d46aed259b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 10:00:18 +01:00
Joerg Bornemann
3c12ab974f Pass target and host mkspec as defines to QMakeLibraryInfo
Change-Id: If07055286496c507310c0dbb3a06f1a42d643596
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 09:59:56 +01:00
Joerg Bornemann
c651e7ba18 Do not write Sysroot and SysrootifyPrefix into qmakeconfig.cpp
Those have fixed values.

Change-Id: I7f1ba8036f43413d3c805f4b419ae79e037343fb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 09:59:51 +01:00
Alexandru Croitor
4b2035cd0f Bump Apple platform minimum versions
Includes both minimum deployment targets and minimum sdk
versions.

As per supported Apple platforms versions which was done
in qt/qtdoc at
8807fdedce29cbbd7662fcd745234da30eace3fb

For Qt for iOS 6.0.x we only bump the minimum
deloyment target because applications seem to crash with iOS 12.4+,
and it's better to have a build error than a runtime error.

The minimum required sdk will not be bumped for 6.0.x, so we don't
accidentally break someone's existing build, given that 6.0 is already
released.

Pick-to: 6.1
Task-number: QTCREATORBUG-23574
Change-Id: I3046384164f2d7fdbd0cfd16dcb85e0d60bc56ce
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-03-10 23:39:45 +01:00
Craig Scott
78a64e310e qtdeclarative now directly handles more qml-specific logic
Associated changes in the qtdeclarative repo now ensure that arguments
for qml plugins are handled on the calling side. This reduces the
qml-specific logic needed in qtbase and gives qtdeclarative clearer
control over qml build and install locations.

As part of that work, the INSTALL_LOCATION keyword used in
qt_internal_record_rcc_object_files() has been renamed to
INSTALL_DIRECTORY to make it consistent with the keyword used for the
same concept in other commands.

Pick-to: 6.1
Change-Id: Iebd319899f63d79fbe15ce965b84ce324c28a508
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-10 18:46:48 +11:00
Joerg Bornemann
c4f5762b20 configure: Fix error when turning on/off non-emitted features
Features that are not emitted in the current
configuration (e.g. plugin-manifests on Linux) should not yield an
error. Instead, print a warning message like Qt5's configure did.

Set insignificant feature to OFF.

Remove the now unneeded emit_if parameter from
qt_feature_set_cache_value.

Pick-to: 6.1
Fixes: QTBUG-88305
Change-Id: I0f2ce152fca5f08417038c9bd2c07639ff6a3df4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-09 16:57:03 +01:00
Dominik Holland
97d9e9e68a cmake: Extend qt_configure_add_summary_section by a message type
With the existing types we can only display a list of features or
whether a feature is on or off, but we cannot display arbitrary values.

Using the new message type, it is possible to show paths or versions as
summary entries.

Change-Id: I5d16cb4b30923f3566755bd4d7440bdd1ece82f5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-09 10:26:06 +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
3875575ab6 Merge "Fix build of Core module without regularexpression feature" 2021-03-04 13:32:07 +00:00
Joerg Bornemann
94d5c1bfe0 Merge "Remove win32_system_libs feature from src/corelib/configure.json" 2021-03-04 11:26:42 +00:00
Joerg Bornemann
728baba70a Complete the renaming of qt_add_tool to qt_internal_add_tool
Fix the name in the function's doc comment and error messages.

Pick-to: 6.1
Change-Id: I918db802a0dbb0508f65d227f7c896d2ad0beeae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 11:31:21 +01:00
Joerg Bornemann
800f745140 Move syncqt.pl to libexec
To not disturb the qmake build we kept syncqt.pl in <src>/bin but
installed it to libexec. This is not necessary anymore.

This also removes the need for having syncqt.pl in both, bin and libexec
in the build dir of qtbase.

Pick-to: 6.1
Fixes: QTBUG-91076
Change-Id: I44b014ea41e3f00c420e02fd5c76f11169340b8c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-03-04 09:56:07 +01:00
Joerg Bornemann
7c62caa355 Make toolchain inspection more robust
QtAutoDetect.cmake did read the (possibly detected) toolchain file and
looked for the string "The Android Open Source Project" to deduce that
we want to build for Android. This has been done, because we're
autodetecting the platform before the first project comment, i.e. before
the toolchain file is loaded.

This magic string detection is a bit fragile, and we need a similar
approach for WebAssembly. A more robust approach would be to fetch the
value of CMAKE_SYSTEM_NAME from the toolchain file without actually
loading it.

Now, we run a CMake script that includes the toolchain file and prints
variables were interested in. The calling code reads these variables and
stores them in prefixed variables in the current scope.

Change-Id: Ide9ea3054e1453d17129523e1ec86ecaed55af2a
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-03-04 09:55:41 +01:00
Kai Köhne
b58ca067da headersclean: Compile with -std=c++latest, -Zc:__cplusplus on MSVC
c++latest does check that our headers also work with upcoming C++20
support in MSVC. It also implicitly sets -permissive-, which checks for
stricter standards compliance.

Pick-to: 6.1
Task-number: QTBUG-91117
Change-Id: Iaf1547191969213d570a1b2f59888ad04a7977ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-04 09:40:56 +01:00
Kai Köhne
5bbd700124 Improve support for QT_ADDITIONAL_PACKAGES_PREFIX_PATH
Allow to set QT_ADDITIONAL_PACKAGES_PREFIX_PATH as both an env
variable and CMake cache variable. Also normalize path and list
separators, so that they can be used similar to CMAKE_PREFIX_PATH.

The environment variable is intended to be set by the conan virtualenv
generator, so that e.g.

  find_package(Qt6 COMPONENTS NetworkAuth REQUIRED)

also works if NetworkAuth is not installed into the Qt prefix.

Pick-to: 6.1
Fixes: QTBUG-91142
Change-Id: Ia9f9b9fa2b1b051d33073629139640d0f4c7a843
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-03-03 10:21:28 +01:00
Joerg Bornemann
b1ad7f938e Generate information about user-facing applications in build dir
When packaging different Qt versions for Linux distributions (or any
distribution with a common bin dir), Qt tools cannot be installed to
/usr/bin, because the executable names of the different Qt versions
clash.

To solve this conflict, our recommendation is to install Qt's tools to
/usr/lib/qt6/bin and to create versioned symlinks to user-facing tools
in /usr/bin.

User-facing tools are tools that are supposed to be started manually by
the user. They are marked in Qt's build system. Distro package
maintainers can now configure with
  -DCMAKE_INSTALL_PREFIX=/usr
  -DINSTALL_BINDIR=/usr/lib/qt6/bin
  -DINSTALL_PUBLICBINDIR=/usr/bin
and will find a file called user_facing_tool_links.txt in the build
directory after the cmake run. Nothing will be installed to
INSTALL_PUBLICBINDIR.

Each line of user_facing_tool_links.txt consists of the installation
path of a user-facing application followed by a space and the versioned
link name in INSTALL_PUBLICBINDIR.

Example content:
/usr/lib/qt6/bin/qmake /usr/bin/qmake6

To actually create the versioned symlinks, the content of this file can
be fed to ln like this:
  xargs ln -s < build-dir/user_facing_tool_links.txt

Or the package maintainer may decide to do something completely
different as suits their needs.

This patch adds the USER_FACING argument to qt_internal_add_tool to mark
tools as user-facing. In addition, every Qt created by
qt_internal_add_app is treated as user-facing.

The only tool this patch marks as user-facing in qtbase is qmake.

Pick-to: 6.1
Fixes: QTBUG-89170
Change-Id: I52673b1c8d40f40f56a74203065553115e2c4de5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-03-02 22:00:51 +01:00
Craig Scott
c6bbca7486 Make qt_get_module_for_plugin() internal and do what its name says
Contrary to its name, this command was also setting a target property.
Since it was only called in one place and that caller can just as
easily set the property instead, rename the command to make clear its
internal nature and refactor it so that the caller is responsible for
setting that property instead.

Also make it an error rather than just a warning if the command is used
for a target that doesn't belong to any module. Since this is now
unambiguously an internal command, we should always expect the target
to belong to a module.

Pick-to: 6.1
Change-Id: I929a652ddd482653868fc9df887f38f4bc7f35d9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-02 16:44:45 +11:00
Alexey Edelev
d1101c460e Simplify prefix-related functionality of qmake
Since the QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and
QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH definitions keep the same
value in modern CMake build, no need to have special handling in cases
where these values are used in qmake. Also it will be useful to
specify the relative path to the prefix directory from the directories
different of 'bin' when use QMakeLibraryInfo.

Task-number: QTBUG-75870
Change-Id: I5a777001eb334dcf05e22853a514d4257352d59b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-01 17:36:56 +01:00
Alexey Edelev
43c28aa904 Use Core library for qmake instead of the Bootstrap library
Move the qmake-specific logic of the QLibraryInfo class to
qmake internals. 'qconfig.cpp.in' now stores information about
the library info entries to keep them consistent between qmake
and the Core library. qmake requires specific features enabled
in the Core library, so building qmake will be skipped if the
features are not enabled.

All flags directly related to the qmake have been removed from
Core lib.

Remove all bootstrap related sections from qmake CMakeLists.txt

Task-number: QTBUG-89369
Change-Id: I26de157d3bfd4a5526699296e9d46e1c180b89ae
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-02-25 16:08:43 +01:00
Joerg Bornemann
be6bf1a313 Remove INTERNAL argument from qt_internal_add_linker_version_script
The code branch for the INTERNAL argument did nothing, and we never call
qt_internal_add_linker_version_script with INTERNAL.

Change-Id: Ie369b4dac29cd1a977433ebfd662c198a3e1d0f2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-02-25 07:55:43 +01:00
Craig Scott
10b3681c72 CMake: Prevent qt_remove_args() from accessing out-of-range list index
Pick-to: 6.1
Change-Id: Ie9c5f0551722c7d3fb11879b209c11ce3d7ccd6d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-02-24 21:51:47 +11:00
Craig Scott
844e37ca39 CMake: Reformat shared keyword lists
Putting each keyword on its own line makes it much easier to read and
improves maintainability. It is friendlier to source control when
keywords need to be added or removed.

This commit introduces no functional change.

Pick-to: 6.1
Change-Id: I79efd039e5afa5f11f1d859405d6487ad6b3beb2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-02-24 10:38:28 +11:00