Commit Graph

1940 Commits

Author SHA1 Message Date
Alexey Edelev
2e514f8511 Add CONDITION_INDEPENDENT_SOURCES argument to qt_internal_extend_target
The argument allows to ignore the condition for source files if they
are used in the Qt code without corresponding guards. The header files
of this kind usually have internal guards, that suppress the error
at the location where they are used, so AUTOGEN is skipped for these
header files to suppress the warnings from CMake. If file belongs to
a module, it will display AUTHOR_WARNING which should urge Qt
maintainers to guard the use of the source file properly.

Task-number: QTBUG-103196
Change-Id: I7b4c12031a5d19ff15868d4782c0d396ef7aed8c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-08 23:24:22 +01:00
Amir Masoud Abdol
270a2f7ee2 Use native path for host_qt_bindir
Task-number: QTBUG-109271
Change-Id: I85fe825ee49f21caea9c973b3a3ee9bf1449fab6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-08 19:00:16 +01:00
Cristian Adam
501018ea33 Win32: Add "longPathAware" manifest / rc for internal tools
This will enable all qt internal tools to be able to access files
on paths longer than 255 characters.

Two examples that were not working before: moc and windeployqt.

Fixes: QTBUG-109207
Change-Id: I93f9770f1d3c4f3f2cca4655e4bed89c95b9786b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-08 17:56:47 +01:00
Alexey Edelev
cfcc4ef8ed Add _lib_pri targets to all
In CMake versions older than 3.20 add_dependencies have no effect
when adding interface libraries. So need to add the '_lib_pri'
targets to ALL to make sure that the related rules executed.

Amends 190e58e1f4

Pick-to: 6.2 6.4
Fixes: QTBUG-109240
Fixes: QTBUG-109239
Change-Id: I7c565ce3bc15e549569317454c2f7caac823cf66
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-07 14:58:41 +01:00
Amir Masoud Abdol
ca24ee14df Create the versioned variant of Qt tools in cross platform build
In cross builds, we are not creating versioned links for qt tools. This
patch addresses that. I've changed the signature of the
`qt_internal_install_versioned_link` such that it can be used for
non-target as well, so in cross build the qmake or qtmake.bat can be
processed with the same function.

Fixes: QTBUG-109024
Change-Id: I246621c18325d084622ca92b422e815ed06f1381
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-07 07:09:15 +01:00
Amir Masoud Abdol
d8abcc969b Remove the deprecated TYPE option from qt_add_plugin
As far as I can tell nothing uses TYPE anymore.

[ChangeLog][QtCore][CMake] The deprecated TYPE option of the
qt_add_plugin() has been removed. You can specify the plugin
type using the PLUGIN_TYPE option instead.

Change-Id: I786fbc772a23ae0037d9a4cf68018e3af5cb061d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-07 06:09:15 +00:00
Lorn Potter
924eec1daa wasm: add support for wasm64 build
This adds a new platform named wasm-emscripten-64
which sets the build and link argument -MEMORY64

 You may see this warning, please ignore at your own discretion:

 em++: warning: -sMEMORY64 is still experimental. Many features may not work.
 [-Wexperimental]

Fixes: QTBUG-104891
Change-Id: I8d3150d239ba72dbef5c2352e0171d6cfbe51b59
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-07 08:30:46 +10:00
Kai Köhne
f5f5a29bba CMake: Properly quote paths in FindPPS.cmake
PPS_LIBRARY and PPS_INCLUDE_DIR cannot be empty at this point (otherwise
PPS_FOUND would be FALSE). But it's arguably good practice to puth paths
in quotes.

Task-number: QTBUG-108930
Pick-to: 6.4
Change-Id: I87128da50f37cd6aa1a66811261a05ceb8c3e790
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 19:02:59 +01:00
Amir Masoud Abdol
d77ce33082 Move Some of the Private CMake Helper Scripts from bin/ to libexec/
After this change, private CMake scripts are mostly live in
`libexec/`, except the `qt-cmake` which will stay in `bin/`.
This doesn't affect the Windows configuration.

- `qt-cmake` stays in `bin/`
- `qt-configure-module` moves into `libexec/`
- `qt-cmake-private` moves into `libexec/`
- `qt-cmake-private-install.cmake` moves into `libexec/`
- `qt-cmake-standalone-test` moves into `libexec/`
- `qt-internal-configure-test` moves into `libexec/`

In cases where `QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS` is set to
ON, e.g., ANDROID, WASM, both Batch and Bash files will be generated
and placed in `bin/` and `libexec/` accordingly; in both cases,
qt-cmake and qt-cmake.bat will be in `bin/` anyway.

[ChangeLog][CMake] The private Qt CMake scripts, i.e.,
qt-configure-module, qt-cmake-private, qt-cmake-private-install.cmake,
qt-cmake-standalone-test and qt-internal-configure-test were moved
into $prefix/libexec on Unix platforms.

Fixes: QTBUG-107621
Change-Id: Ic4f4ec85f64d2ede0e208bca928959e30be906a6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-05 18:02:59 +00:00
Eric Lemanissier
be4352cb84 fix pcre2 detection
pcre2-16 is not the target name provided by the upstream Config file. It is PCRE2::16BIT.
2410fbe386/cmake/pcre2-config.cmake.in (L122)

Pick-to: 6.2 6.4
Change-Id: I89f167e11bf1c72c9fae474ddd12380636ac5df8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-03 15:41:35 +01:00
Yuhang Zhao
0d708a9aad MSVC: Improve the LTCG build
When we use MSVC to build static libraries, enabling LTCG will
generate very large output, for example, Qt's bundled 3rd party
libraries can be greater than 100MB per file (some of them even >200MB!).
This is not good if we are building a shared version of Qt and
enabling LTCG at the same time. On Windows Qt's bundled 3rd party
dependencies will be built as static libraries and they will make
the final Qt package way too large. From my side, if I only build
a release version, the package size is usually around 500MB but
when LTCG is enabled, it become over 2GB. The exe and dlls' size
don't vary much, but there are many large static libraries.

Fixes: QTBUG-108719
Change-Id: Ic521f500b9c24389524e96a8cdc2e7b3427b51a9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2022-12-03 12:55:20 +08:00
Joerg Bornemann
9204ac23a0 CMake: Don't setup deployment when building Qt without examples
Introduce the variable QT_SKIP_SETUP_DEPLOYMENT to turn off the
generation of deployment support files. Set this variable when building
Qt - but only if we're not building examples.

This avoids a warning about missing patchelf when building Qt with CMake
< 3.21.

Change-Id: I8ff5491eb314ff870c210884fbf90dd4c9ad0219
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-01 08:53:32 +01:00
Joerg Bornemann
84c76d6205 CMake: Make it possible to specify a debug MySQL client library
An MSVC debug-and-release build of Qt with the MySQL plugin requires
separate builds of the MySQL client library: a debug and a release
build. There was no way to specify the debug version of the library.

Now, it's possible to configure Qt like this:
cmake ... \
    -DMySQL_ROOT=D:\mysql-connector-c-6.1.11-winx64 \
    -DMySQL_LIBRARY_DIR=D:\mysql-connector-c-6.1.11-winx64\lib\vs14

This will automatically detect the include dir and the debug and release
library files. We expect that the debug build of the MySQL client
library resides in a "debug" subdirectory below MySQL_LIBRARY_DIR.

If the automatic detection doesn't work to due a different layout on the
build machine, one can set the variable MySQL_LIBRARY_DEBUG to specify
the debug variant of the MySQL client library.

[ChangeLog][CMake] If pkg-config is not used, a debug build of the MySQL
client library can be specified with
-DMySQL_LIBRARY_DEBUG=<path-to-library>. The debug and release variants
of the library are automatically detected. Setting MySQL_ROOT and
MySQL_LIBRARY_DIR is sufficient in most cases.

Pick-to: 6.2 6.4
Task-number: QTQAINFRA-4999
Change-Id: I663fb8ac1dbd07bc73484791be9cc21bff2f4a9b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-12-01 08:53:19 +01:00
Mikolaj Boc
65b7aacb40 Add a dummy target for tests that get batched
This is done to avoid cmake syntax errors when adding new tests.

Change-Id: I8106b13a865b990c52e09573488881bd18e64c7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-01 08:52:44 +01:00
Alexey Edelev
a395d08c3b Remove _pri_dep_timestamp targets
It looks like these targets used to manage some custom commands that
belong to HEADER_MODULES. We don't currently have a need to use them,
so we clean up the code.

Change-Id: I8095f4de2c91a6c310cccb9b89514c2ce77e32f0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-01 02:23:52 +01:00
Alexey Edelev
190e58e1f4 Link ${target}_lib_pri directly to INTERFACE_LIBRARY targets
There is no reason for adding dependency to the custom
'_pri_dep_timestamp' target instead of the INTERFACE_LIBRARY target
itself. This will close the chains of dependency between repo targets
and the HEADER_MODULE dependencies.

Pick-to: 6.4 6.2
Fixes: QTBUG-108815
Change-Id: I0e170d3e0e42d342881beb8aca1cc5a764425826
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-01 02:23:52 +01:00
Alexey Edelev
ada76ac8b6 Add INTERFACE_LIBRARIES to dependencies of repo targets
Building repo targets may be incomplete as we skip adding
INTERFACE_LIBRARIES as dependencies. This leads to the missing
artifacts belonging to HEADER_MODULES. It seems reasonable and safe to
include INTERFACE_LIBRARIES in the list of dependencies of the repo targets.

Pick-to: 6.4 6.2
Task-number: QTBUG-108815
Change-Id: I83f44018f42dcf2fb1e3299461e17ef53e79c2e5
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-01 02:23:52 +01:00
Alexey Edelev
81931f8c54 Add an option to select the preferred compression type for mime type db
Add the '-mimetype-database-compression' command line argument that
allows to select the preferred compression type for the mime type
database, including 'none' compression type, which avoids mime type
database compression even if respective compression APIs are present
in the system. The argument has the CMake alias called
'INPUT_mimetype_database_compression'.

Change-Id: I66daddae7014d109fa175a5f397e984928f4ee47
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>
2022-12-01 02:23:51 +01:00
Amir Masoud Abdol
60968090ad Update -redo option such that it removes CMakeCache.txt and CMakeFiles/
In the case of re-doing, `configure` and `configure.bat` pass an extra
parameter to the `QtProcessConfigureArgs.cmake`. As a result, CMake
removes CMakeCache.txt and CMakeFiles/ before the reconfiguration. If
the user is using CMake 3.24 or newer, this is achieved by passing
the `--fresh` option to CMake call. In older CMake(s), CMakeCache.txt
and CMakeFiles/ found in CMAKE_BINARY_DIR will be removed using a
file(REMOVE_RECURSIVE call.

[ChangeLog] The -redo option now additionally removes existing
CMakeCache.txt file, and CMakeFiles/ directory, and recreates them from
scratch.

Task-number: QTBUG-108287
Change-Id: I11a5c8f9df1247d11eb7097552e6764463583346
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-12-01 02:23:51 +01:00
Tor Arne Vestbø
f2415df24d Bump macOS minimum deployment target to 11 (Big Sur)
macOS Catalina (10.15) has reached its end-of-life, and is no longer
supported with bug fixes or security updates by Apple.

Change-Id: I65d0f572785bc77a563be925cf64823c20b9e015
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-11-30 13:48:51 +00:00
Amir Masoud Abdol
cf471f9a91 Address, and remove an obsolete FIXME comment
If I'm right, it seems that the work has already been done, and nothing
uses the `_qt_internal_wrap_tool_command` anymore.

Change-Id: Ib8a5951e8351a26df123045bb5c6001470650b38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-11-30 08:41:10 +01:00
Alexandru Croitor
6847a19e3e CMake: Reconfigure faster by not looking for missing packages
Instead of constantly trying to find packages by calling
qt_find_package on each reconfiguration, record which packages were
found during initial configuration. Then on a second reconfiguration,
skip looking for packages that were not found on the initial
configuration.

This speeds up reconfiguration on certain platforms and repos.

Here are some stats for my macOS qtbase build.

not skip 3.69s user 4.96s system 98% cpu 8.750 total
skip     2.69s user 1.00s system 97% cpu 3.792 total

Top-level build with -submodules=qtquick3d

not skip 15.03s user 10.58s system 97% cpu 26.334 total
skip     13.87s user 5.16s system 96% cpu 19.724 total

Note this is a behavior change from how find_package is used in most
CMake projects, where if a package was previously missing, the
developer can just install the package and reconfigure to pick it up.

With this change, they will first have to remove their CMakeCache.txt
file and configure from scratch, or remove the
QT_INTERNAL_PREVIOUSLY_FOUND_PACKAGES cache variable and reconfigure.

For this reason, we enable this behavior by default only in
-developer-builds.
Builders can also opt in or out by setting the
QT_INTERNAL_SAVE_PREVIOUSLY_FOUND_PACKAGES variable to either ON or
OFF.

Note this behavior does not apply to user projects, or direct
find_package calls (as opposed to qt_find_package).

Fixes: QTBUG-107251
Change-Id: Iee9c5d120eb09e2a94eebb059a2174ef6b241e03
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-29 12:43:46 +01:00
Alexey Edelev
7f4aa1a3fa Remove perl related functionality from CMake files
Avoid using perl in CMake scripts. Remove the syncqt.pl specific
code.

Task-number: QTBUG-87480
Change-Id: I7fcd5cc83d173ec463c275b5b50b84f25044a118
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-11-29 12:35:47 +01:00
Thiago Macieira
0afb8f5c45 CMake/syncqt: export the TEST_ld_version_script variable
So other modules can see it when they're built outside of qt5.git.

Change-Id: I76216ced393445a4ae2dfffd172a52168a2a55b4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-28 11:24:02 -08:00
Thiago Macieira
9cc0fc385e CMake: add SYSTEM_INCLUDE_DIRECTORIES to qt_internal_extend_target
This allows one to add an extra set of directories to the build, but let
the compiler know that they are system paths (that is, the compiler
should refrain from emitting warnings in code found there). This extends
INCLUDE_DIRECTORIES and is by necessity a private include set.

Will be used by qtquick3dphysics, due to its PhysX dependency.

Change-Id: I76216ced393445a4ae2dfffd1729c556db0cce3d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-28 10:58:21 -08:00
Thiago Macieira
645cae16ed CMake: add a way to skip trying to set up docker on Linux
I keep getting this warning because docker-compose is not installed.

Change-Id: Id8e48e8f498c4a029619fffd172932bd86ed03ba
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-28 10:58:20 -08:00
Thiago Macieira
4234ce12dc CMake: install the metatypes inside Qt's own arch-specific data dir
We don't want it in /lib64/metatypes, but instead /lib64/qt6/metatypes

Pick-to: 6.4
Change-Id: Id8e48e8f498c4a029619fffd17293602d7fd8bd8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-11-28 10:58:13 -08:00
Alexey Edelev
8155bd5426 Avoid converting paths to relative for headersclean comment if they are relative
When calling file (RELATIVE_PATH), check if the base directory and
header path are absolute. Use the original file path if the paths are
relative to avoid critical errors.

Fixes: QTBUG-108617
Change-Id: I6daddd5c1553cdbfd965650b7c469673c62f0a3d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2022-11-28 15:09:04 +01:00
Amir Masoud Abdol
c675c1c56d Fix a mistake in the documentation of qt_internal_read_repo_dependencies
If I understood the function correctly, then the example was not quite
right.

Change-Id: I6b6a4845c5ded2a058050dfbecf5db158d32d12a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-26 11:23:13 +01:00
David Skoland
ef7d17ed15 wasm: Enable asyncify for tests
Since a good number of tests use exec and friends, we want to use
asyncify for them. Asyncify is still possible to enable universally
with device options.

Change-Id: I0916f55328c98f2ba179cda3757eeee9d27f3e47
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-11-24 18:49:40 +01:00
David Skoland
770c849a31 wasm: Enable batch tests by default on wasm
Batched tests is the default supported test mode of wasm and should
be enabled without explicitly passing a command line argument.

Change-Id: I79424384e4e8ca6f670de1cb056f4713740a584f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-11-24 18:49:39 +01:00
Alexey Edelev
60b5ca5a23 Use module-specific names for 'module_headers[_generated]' files
Fix the syncqt issue when two modules are created in the same
CMakeLists.txt and share the build directory. In this case the
second module in the dependency chain rewrites
'module_headers[_generated]' files, so syncqt is not able to
proccess these files correctly.

Amends b89d63515b

Task-number: QTBUG-87480
Change-Id: Ibdcb66e96bdaabadc1c51611f5ed4a637d2f797f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-11-10 19:29:52 +01:00
Tor Arne Vestbø
3d03001d2d macOS: Add dependency to Foundation for permission plugins
Fixes: QTBUG-108270
Change-Id: Ic09c3422d2006e18ab355af564ac1bb3f24318c2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
2022-11-08 19:44:58 +01:00
Timur Pocheptsov
f0a7d74e1d Add permission API backend for macOS and iOS
When submitting applications to the iOS and macOS AppStore the
application goes through static analysis, which will trigger on
uses of various privacy protected APIs, unless the application
has a corresponding usage description for the permission in the
Info.plist file. This applies even if the application never
requests the given permission, but just links to a Qt library
that has the offending symbols or library dependencies.

To ensure that the application does not have to add usage
descriptions to their Info.plist for permissions they never
plan to use we split up the various permission implementations
into small static libraries that register with the Qt plugin
mechanism as permission backends. We can then inspect the
application's Info.plist at configure time and only add the
relevant static permission libraries.

Furthermore, since some permissions can be checked without any
usage description, we allow the implementation to be split up
into two separate translation units. By putting the request in
its own translation unit we can selectively include it during
linking by telling the linker to look for a special symbol.
This is useful for libraries such as Qt Multimedia who would
like to check the current permission status, but without
needing to request any permission of its own.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: Ic2a43e1a0c45a91df6101020639f473ffd9454cc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-11-03 15:02:36 +01:00
Morten Sørvig
2ab347b0dd wasm: add support for enabling wasm excptions
Add support for enabling -fwasm-exceptions at compile and
link time, which enables use of C++ exceptions.

Wasm-exceptions is an in-progress roadmap item (see
https://webassembly.org/roadmap/), but is supported
by the major browsers

Change-Id: I6e2847206a46ed8038320c99725bc09a0344d1b4
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-11-03 12:22:50 +00:00
Alexey Edelev
7c1270ea76 Handle the QT_SKIP_WARNINGS_ARE_ERRORS property when running syncqt
When creating the syncqt custom target we only check if the
WARNINGS_ARE_ERRORS variable is set. But the warnings-are-errors
feature can be disabled using the QT_SKIP_WARNINGS_ARE_ERRORS
target property. Add the genex condition to opt out the
'-warningsAreErrors' argument using the QT_SKIP_WARNINGS_ARE_ERRORS
property.

Change-Id: I8e6f89453500335c2b31e6e69c65b351c79dddc2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-11-03 09:15:33 +01:00
Alexandru Croitor
83ecb65ec0 CMake: Propagate usage of WARNINGS_ARE_ERRORS when building repos
When configuring a qtbase developer build, WARNINGS_ARE_ERRORS is
set to ON and -Werror flags are added to the PlatformInternal
targets. But the value of WARNINGS_ARE_ERRORS is not exported.

This means that CMake code can't make decisions based on that variable
when building other repos, and we now have such code with the new
syncqt.cpp in qt_internal_target_sync_headers.

Export the value of WARNINGS_ARE_ERRORS in
QtBuildInternalsExtra.cmake.in.

Fixes: QTBUG-108151
Change-Id: I5de2633fcb1f20fead7d436c201852424e726842
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-11-02 20:50:43 +01:00
Alexey Edelev
703ac911f9 Make sure that the generated dbus sources get extra compiler flags
Process the regular SOURCES and DBus sources the same way in
the qt_internal_extend_target call. Previously the specified
COMPILE_FLAGS had no effect on DBus sources.

[ChangeLog][General] The internal DBus source files that are
generated, now are compiled with the same set of compilation
flags and options as other source files of the Qt module.

Change-Id: I9bdeb8f45c6af1b0cb0235425b0ff7efcb952d59
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-31 15:39:14 +02:00
Alexey Edelev
ecc4250397 Cleanup qt_internal_extend_target function
Extract function arguments to the corresponding variables and use
variables when parsing arguments. Remove whitespace between if keyword
and parentheses. Adjust size of code lines. Document function-specific
arguments.

Change-Id: I1c77fbf268618a844726683768575aff05894c70
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-31 15:39:14 +02:00
Giuseppe D'Angelo
365904085e QFile: make constructors taking a path explicit
This is a level A SIC, as it breaks

  QFile f = "/some/path";

In general, it's not a good idea to have this implicit conversion. A
QFile is not a representation of a path, so the conversion should be
explicit.

I am going to keep the current semantics (implicit conversion) up to and
including Qt 6.8 (LTS). Starting from 6.9, the constructor will be
unconditionally explicit. This is deliberate, and done in order to make
users fix their code while staying in Qt 6, rather than encountering
this issue (and countless many more) if and when they upgrade from Qt 6
to Qt 7. In the meanwhile, users can opt-in to the new semantics by
defining a macro.

[ChangeLog][QtCore][QFile] The QFile constructors that take a path are
going to become unconditionally `explicit` in Qt 6.9. Code like `QFile f
= "/path";` will need to be ported to equivalent one (e.g. `QFile
f{"/path/"}`). This has been done in order to prevent a category of
mistakes when passing strings or paths to functions that actually take a
QFile. Users can opt-in to this change even before Qt 6.9 by defining
the QT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH macro before including any
Qt header.

Change-Id: I065a09b9ce5d24c352664df0d48776545f6a0d8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-29 23:22:25 +02:00
Amir Masoud Abdol
887bdc5e73 FEATURE_pkg_config Should be BOOL
It might not matter as far as I understand, but having it saved as BOOL
is better if it's a boolean.

Change-Id: If35485425257ca5518f0f8a49ca5353b9ac875a8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-28 18:41:17 +02:00
Amir Masoud Abdol
50b8f22012 Align FindWrapSystemMd4c with Other FindWrapSystem* Modules
FindWrapSystemMd4c now uses `find_package_handle_standard_args` like
all the other similar modules. This also fixes a case where CMake config
log for finding `md4c` was missing the CMAKE_MESSAGE_CONTEXT,
e.g., `[QtBase]`, which was caused by using `find_package` and let it
log outside the scope of the project, and not `QUIET`ing it.

In addition, the `CONFIG` parameter of the `find_package` was removed to
avoid unexpected issues when 3rd party package managers were used.

Change-Id: Id0bee436e8965452f9089c0e8c8793c3f1b63f02
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-28 10:53:06 +00:00
Alexey Edelev
433d711670 Add NO_HEADERSCLEAN_CHECK flag to qt_internal_add_module
Some modules may have header files that do not pass headersclean check
under some conditions. It's nice to have an option in the
qt_internal_add_module function to disable the check for the modules of
this kind. At the moment this flag is useful for the ActiveQt module,
since it syncs and installs header files that don't belong to it.

Amends b89d63515b

Task-number: QTBUG-103196
Change-Id: I21a82d50d50bdac225ed483ab0cc50339c2a4873
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-27 16:49:42 +02:00
Amir Masoud Abdol
626ebf4738 Fix a bug in detecting system
Since QtAutoDetect is called before the project, we still don't have
access to our IOS, WATCHOS, TVOS variables, and we must use
CMAKE_SYSTEM_NAME variable instead.

Pick-to: 6.4
Change-Id: I61afe216baec85b3fcd489957f4b6774134f8078
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-27 15:14:29 +02:00
Amir Masoud Abdol
f157e223c2 Cleanup the watchOS and tvOS References from CMake files
In addition, I simplified some of the routines as we don't need the
extra check for them.

Task-number: QTBUG-107903
Pick-to: 6.4
Change-Id: Idaf6ab1338a54bc1a9f242fcc8400ae200174beb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-26 17:12:26 +02:00
Amir Masoud Abdol
5fcfacdb7f Use CMAKE_MESSAGE_CONTEXT for Better CMake Output Messages
Each module now identifies its actions during the configuration by a
prefix, e.g., `[QtBase]`. In addition,

- I have slightly modified some of the `message()` commands to get
  a more coherent output.
- `syncqt.cpp` prints its output as WARNING if any

Change-Id: I3922d75a668d94f402068f4121751b7fcb6522b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-25 23:24:30 +02:00
Amir Masoud Abdol
10d5c0adaf Remove the Unnecessary CMake Module, include(CMakeParseArguments)
From CMake 3.7 both flavors of `cmake_parse_arguments` are natively
available in CMake, and loading the
`CMakeParseArguments` module is not needed anymore.

Fixes: QTBUG-107574
Pick-to: 6.4
Change-Id: I7c8a6c5871cdb2f92a4aa43932b6f2ee99e1f57f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-25 20:14:35 +02:00
Amir Masoud Abdol
ef822cf03d Sync CMake Version with .cmake.conf
As stated in `QtBuildInternalsConfig.cmake`, `cmake_minimum_required`
versions should be synced with `qtbase/.cmake.conf`, but it wasn't at
the moment.

Change-Id: I8100370778707d46abe973b681fd4aba182a7513
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-25 18:14:35 +00:00
Alexey Edelev
d90935f2c2 Fix issues in qt_internal_add_headersclean_target
Avoid using top-level ${target} variable in the function. Align the
module's '_header_check_exceptions' file name, so it should use
_qt_module_interface_name property, but not the qt_module_include_name
proeprty as the prefix.

Amends b89d63515b

Task-number: QTBUG-87480
Change-Id: I1a3ceee1a29f2f4a7cb727310b4fdac63d8144e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-25 18:56:09 +02:00
Tor Arne Vestbø
4709c938db Apple: Add CFBundleAllowMixedLocalizations=YES to Info.plist files
We currently don't have any machinery for qmake or CMake to map
translations declared via TRANSLATIONS += or qt_add_translations
to the Info.plist CFBundleLocalizations key.

This results in macOS and iOS falling back to the development region,
CFBundleDevelopmentRegion, as the only supported localization of the
app, which is in most cases set to 'en'.

Unfortunately this doesn't work well with the behavior of iOS 11+
and macOS 10.13+ where the OS will set the locale of the app to
the best match between the app's supported localizations and the
user's preferred language.

https://developer.apple.com/library/archive/qa/qa1828/

Since we only support a single localization, the development region,
the locale always ends up as 'en_<REGION>', which after QTBUG-104930
is also reflected in the QLocale's uiLanguages(), resulting in the
QTranslator machinery always picking English translation for the app.

As long as we don't explicitly declare CFBundleLocalizations we need
to opt out of the system's behavior of finding the best match between
the app's declared localizations and the user's preferences, which we
can do via the CFBundleAllowMixedLocalizations key.

Fixes: QTBUG-63324
Pick-to: 6.4
Change-Id: If7586d342148cbbb1d2a152cef039aad4448b13c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-25 10:06:59 +00:00