Commit Graph

21 Commits

Author SHA1 Message Date
Marc Mutz
df9d882d41 Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:

  auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
  makeRule(cxxMemberCallExpr(on(QtContainerClass),
                             callee(cxxMethodDecl(hasAnyName({"count", "length"),
                                                  parameterCountIs(0))))),
           changeTo(cat(access(o, cat("size"), "()"))),
           cat("use 'size()' instead of 'count()/length()'"))

a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.

<classes> are:

    // sequential:
    "QByteArray",
    "QList",
    "QQueue",
    "QStack",
    "QString",
    "QVarLengthArray",
    "QVector",
    // associative:
    "QHash",
    "QMultiHash",
    "QMap",
    "QMultiMap",
    "QSet",
    // Qt has no QMultiSet

Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-04 07:40:08 +02:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00
Joerg Bornemann
fc16855eaa Fix qmake/qtpaths -query for static relocatable builds
The install prefix was determined incorrectly for static relocatable
builds.  The reason was that for those builds, QLibraryInfo::path()
returns the application directory, which is <prefix>/bin for qmake and
qtpaths.

Fix this by removing the bin directory part from the installation prefix
that QLibraryInfo returns if qmake/qtpaths are used.

Fixes: QTBUG-102877
Change-Id: I2e9ff96ded0ee2a7802b265741a3cfbe2bf0a4ba
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-09 08:32:04 +02:00
Joerg Bornemann
9d15854138 Fix wrong QT_HOST_* values when qt.conf is present
When a qt.conf was present, QT_HOST_* variables got a wrong default
value.  For example, QT_HOST_BINS would end with /bin/bin.

We must not provide the defaults via QSettings::value(_, defaultValue).
The assignment of the default value is done in
QMakeLibraryInfo::rawLocation() separately after retrieving the value.

This amends commit 04ec14105e.

Pick-to: 6.3
Fixes: QTBUG-99656
Change-Id: I43431664e93ab40417a5432b03e7eb38ae21bad8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-01-12 18:28:24 +01:00
Joerg Bornemann
04ec14105e Change qt.conf key Qml2Imports to QmlImports
[ChangeLog][qt.conf] The key Paths/Qml2Imports has been renamed to
Paths/QmlImports. For backwards-compatibility, Paths/Qml2Imports is
still accepted and acts as default value for when Paths/QmlImports is
not present.

Fixes: QTBUG-98335
Change-Id: If7ffedd281eb8a87e8ab1a2b69a823e615c33541
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-11-19 16:44:32 +01:00
Joerg Bornemann
d6e01ae05c Fix QT_HOST_DATA for builds setting INSTALL_MKSPECSDIR
In a Qt build that was configured with INSTALL_MKSPECSDIR set to
something different than INSTALL_DATADIR, the qmake property
QT_HOST_DATA was wrong. Consequently, mkspecs could not be loaded,
rendering qmake dysfunctional.

The reason was that we considered every QT_HOST_xxx property to have the
same value as QT_INSTALL_xxx in a non-cross build.
This is not true for QT_HOST_DATA, because users might want to set
INSTALL_DATADIR to "foo" but INSTALL_MKSPECSDIR to "bar/mkspecs".

Move the unused determination of the host data dir to the QtLibraryInfo
lib and handle QT_HOST_DATA specially.

Fixes: QTBUG-94591
Pick-to: 6.2
Change-Id: I2c44cda8405ff1d14391254fcd1d9b1361cb5855
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-23 22:12:41 +02:00
Alexey Edelev
43ba45151a Follow the generic logic of QLibraryInfo when computing QT_HOST_PREFIX
After the discussion we concluded that QT_HOST_PREFIX should not
completely replicate the QT_INSTALL_PREFIX behavior.

So this patch implements the following logic if qt.conf is provided:
  1. Prefix is not set
    a. If HostPrefix is not specified, then QT_HOST_PREFIX will be set
       to the folder containing qt.conf.
    b. If HostPrefix is specified and is relative, then QT_HOST_PREFIX
       will be relative to the folder containing qt.conf.
  2. Prefix is set
    a. If HostPrefix is not specified, then QT_HOST_PREFIX will have
       the Prefix value.
    b. If HostPrefix is specified and is relative, then QT_HOST_PREFIX
       will be relative to the folder containing the qt.conf.

The logic might change in a future commit to use the current application
directory instead of qt.conf path, since the use of qt.conf is dictated
by the bootstrap library and this is no longer the case.

Fixes: QTBUG-93707
Change-Id: I5460c97c45924bb8e0c95493afdb9585994c5f28
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 20:57:25 +02:00
Joerg Bornemann
567b154ba7 Fix warning when building qmake with MSVC
Fix the C4715 warning for 'hostToTargetPathEnum' by marking the qFatal()
branch as unreachable.

Change-Id: Id065daaffd865e85985b1a8e0ac2eba4a2ff0b1c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-22 22:32:56 +01:00
Alexey Edelev
6fb569af95 Unify QLibraryInfo settings
Exporting QLibraryInfo internals allows to reuse settings in
qmake/qtpath without having to keep its own instance.
Also there is no need to check setting groups in QLibraryInfo
except the 'Paths' group, since this logic belongs to qmake/qtpaths
only.

Change-Id: If762defba025ad7f7489f8a86ef5768a8628bd2f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-17 11:57:11 +01: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
9f5a7cb5fa qmake: Do not read from qmakeconfig.cpp
Change-Id: I6a46c2e817f8dc3f580774aba2db8bfb01f5a403
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 10:00:11 +01:00
Joerg Bornemann
a08b1f6359 Read QLibraryInfo paths directly from QLibraryInfo and not from qmakeconfig.cpp
Change-Id: I1db1c871ec6b4e572bd36df6aff7a5be8a4a706c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 10:00:01 +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
Joerg Bornemann
504d0c3755 qmake: Delegate prefix deduction to QLibraryInfo
Now, that qmake depends on QtCore, we can just ask QLibraryInfo for the
prefix instead of calculating it from QT_CONFIGURE_RELATIVE_PREFIX_PATH.
Remove that define.

Change-Id: I14be298a9d08abf33299e4cdbac55e91af318397
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 09:59:47 +01:00
Joerg Bornemann
b788c87457 QMakeLibraryInfo: Move reading of default values into separate function
Reduce code duplication.

Change-Id: Ic20c124ad664d16552e3cfea8dde465fc0b6066f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 09:59:42 +01:00
Joerg Bornemann
17055f5f48 Remove the platformsSection constant from qconfig.cpp.in
This is not configurable and doesn't have to be in the generated
q[make]config.cpp files.

Change-Id: If294d735800a3b5c6b3e269abdd86df401cf4864
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-03-11 09:59:27 +01:00
Alexey Edelev
5dab1e931d Improve QMakeLibraryInfo encapsulation
QMakeLibraryInfo uses external data to produce paths. This causes
issues when trying to use it out of the existing qmake environment.
Add data fields that contain the path to the binary that uses
QMakeLibraryInfo and manually specified qtconf.

Task-number: QTBUG-75870
Change-Id: Ic6fa274ede3a9287826ff66c79f155b10d0d455c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-01 17:37:03 +01: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
93f55570c4 Remove unused definitions
QT_CONFIGURE_CROSSBUILD is always '0', so it's not necessary to keep
conditional compilation in QMakeLibraryInfo.

Also the QT_CONFIGURE_SYSROOTIFY_PREFIX definition is never used
in the project.

Task-number: QTBUG-75870
Change-Id: I1fe42dce40fddc6a72254736883f93aa4727f6b3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-03-01 17:36:48 +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