Commit Graph

1901 Commits

Author SHA1 Message Date
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
Tor Arne Vestbø
d84ddf5905 Apple: Use 'en' instead of 'English' as development region
This is consistent with what $(DEVELOPMENT_LANGUAGE) reports, as well as
the Apple Locales Programming Guide which states that "Locale names such
as “English”, “French”, and “Japanese” are deprecated in OS X and are
supported solely for backward compatibility."

Pick-to: 6.4
Change-Id: I99779d678ef9d4ea90249572f2f977e9b4df6c62
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-23 17:36:46 +02:00
Amir Masoud Abdol
71f020b365 Fix Some Typos
Changed `proviude` to `provide`, and removed an extra space in a `xcrun`
command.

Change-Id: Iccbf6f87b9f4c86b686a6b1d0723458a1387a7ea
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-19 19:24:26 +02:00
Morten Sørvig
ef3813fc1e wasm: add wasm_simd configure feature
Add Qt configure feature for enabling WebAssembly SIMD usage:

   ./configure ... -feature-wasm-simd128

Enabling this feature makes Qt add the -msimd128 flag to
the compile options, which enables SIMD instruction usage
for the compiler.

(This should not be confused with the previously added SSE
SIMD support, which uses Emscripten's support for translating
SSE SIMD to WASM SIMD)

Change-Id: I84a36ccef8abf9199c304d68ce371c6b1747b832
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-19 15:02:36 +00:00
Volker Hilsheimer
f5de333192 MSVC: Disable conformance check that breaks with default WinSDK
The default Windows SDK installed for VC++ 2022 is 10.0.19041, and still
has the issue described here, breaking builds if -Zcpreprocessor is set:

https://developercommunity.visualstudio.com/t/stdc17-generates-warning-compiling-windowsh/1249671

The issue might be fixed in SDK version 2104 (10.0.20348.0), but until
that is the default SDK when installing the compiler, turn that
conformance check off again.

Partially reverts commit 8cb832090a

Change-Id: Ib22f8d196b978274ce31be727826b902e79aaa99
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-10-19 17:02:36 +02:00
Thibaut Cuvelier
e8d6accb93 Fix a typo in a comment
Change-Id: I3ff1bd0d00fd56fa980bc86f71c557f8f833cb45
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-10-18 18:09:55 +02:00
Yuhang Zhao
ade68c9949 MSVC: Disable buggy conformance check
/Zc:lambda seems buggy. Although in my experiments it works well
for 99% Qt repos, it seems some tests will trigger the bug and it
also blocks some new commits. So disable it for now, it's not stable
enough.

Now that this check is disabled, the workaround for tst_qstringapisymmetry
is also not needed anymore, so remove the workaround as well.

Partially reverts commit 8cb832090a

Change-Id: Icf0ecbbaa6262522470e5f5dea05705985ab18f1
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-18 19:31:25 +08:00
Yuhang Zhao
8cb832090a MSVC: Enable all possible conformance checks
For the full list, please refer to [1].

Needed to change the qstringapisymmetry unit test:
In theory we don't need the array to be static and it did compile
without any problems so far, indeed. However, with this patch applied,
MSVC complains that the lambda function below can't access the array.
I don't understand why, because we use [&] in the lambda and it should
capture all the variables in theory, but in reality it failed to
capture this variable in the end. And making the variable static
solves this issue. Maybe it's a MSVC bug.

Already tested locally. Most Qt repos build without any issues,
only very few repos are not tested, as my local environment
can't build them.

[1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-conformance?view=msvc-170

Change-Id: I658427aa171ee1ae26610d0c68640b2f50789f15
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-15 13:34:20 +00:00
Amir Masoud Abdol
d159767318 Clarify a Point for Building Locally on Apple Silicon
On Apple Silicon, Homebrew is installed under `/opt/homebrew` instead of
`/usr/local`, so I made a minor change clarifying this.

Change-Id: Ifccb51325339f80f8ed3c2a4f8acab485686af7e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-14 19:16:28 +02:00
Morten Sørvig
69033876c6 wasm: use standard clang optimization options
These were mostly identical. Use the base clang config
and then specialize for Emscripten in a separate section.

Behavior changes: QT_CFLAGS_OPTIMIZE_SIZE is now -Oz instead
of -Os. Emscripten does not allow -Og, replace that flag
with -O2 -g.

Change-Id: I08163551ad6b84377b99f287983cc1191521055c
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
2022-10-14 11:17:32 +00:00
David Skoland
20144aab0b wasm: Make Chrome default testing browser
Currently, emrun will pick the browser to run tests on somewhat
arbitrarily. For predictability and stability, we should use one
browser as a basis, and Chrome seems to be a good fit as wasm features
are generally in good shape on it and it has good support for launching
from command-line.

Change-Id: I1d06a5916ad24ab9df9b0826c0773c652e6d3fcd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-10-11 16:10:58 +02:00
Alexandru Croitor
f7a34630a1 CMake: Use unix paths in android xml files
We aim to allow building Qt for Android on one host, and make it
usable on any host.

Previously when built on a Windows host, we embedded windows style
paths into the android -dependencies.xml files, which caused
androideployqt to fail deployment when building a project on a unix
host.

In Qt 5, the dependencies xml files for Windows Android packages had
unix style paths. Thus switch to always using unix styles paths on
all platforms.

Amends a9d2c5b6d7.

Fixes: QTBUG-107249
Change-Id: I851d3e0b08415b4c7f0d22baf43c10c715879ee7
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-10-07 18:18:23 +02:00
Ivan Solovev
9d1e928512 Do not include qglobal.h into the new headers
Several new headers were extracted from qglobal.h in scope of
QTBUG-99313. This commit makes sure that none of them actually includes
qglobal.h.
As those files are new, it should be safe to introduce this change, as
it shouldn't have any impact on the user code.

This patch also modifies the autogenerated module exports header to
include qglobal.h before the include guard. This is needed to prevent
circular dependencies which result in Q_<MODULE>_EXPORT being
undefined.

Task-number: QTBUG-107046
Change-Id: I8d998792fd8129173d9ec811557e7d7604282813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-06 14:26:25 +02:00
Alexey Edelev
658c166f96 Add 'warnings are errors' functionality to syncqt.cpp
Add the -warningsAreErrors command line argument to syncqt.cpp that
causes a fail at build step if any of header files doesn't fit the
syncqt standards. The argument reflects the WARNIGS_ARE_ERRORS CMake
variable state.

Output the syncqt.cpp warnings at configure time.

Fix the faulty positive IncludeChecks failure flag.

Task-number: QTBUG-107088
Change-Id: Id30af4c7b78fd44c1c99c7e9306965d03a0f992d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-01 16:24:01 +02:00
Joerg Bornemann
5818dd3cad CMake: Write all Host* properties to target_qt.conf
Otherwise, qmake won't work if the host Qt was built with custom
INSTALL_BINDIR and friends.

Pick-to: 6.4
Task-number: QTBUG-106712
Change-Id: I436103efc21f245cc220f4706adcab369feba836
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-29 06:45:32 +00:00
Alexey Edelev
bcd08f86da Check if configure-time executable need to be recompiled
Respect source files that belong to configure-time executable when
reconfiguring Qt.

Amends: ac74b60c9c

Task-number: QTBUG-87480
Change-Id: I7e42ffe8b1b79686c0cf93a02101f0b8e6be0bea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-28 21:47:14 +02:00
Joerg Bornemann
ea92137e76 CMake: Fix HostData qmake property for cross builds
The target_qt.conf file contained a wrong HostData value if the
effective data dirs were set to paths of different levels in the host
and target Qt builds.  Fix this by computing the relative path from the
mkspec dir's parent to the ext prefix' data dir.

Note that qmake's HostData dir is the root directory of the mkspecs
directory.

Pick-to: 6.4
Task-number: QTBUG-106712
Change-Id: Id8c9de925f5ff51901677b7218621747169a5cec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-28 09:48:20 +02:00
David Skoland
c3730ffa92 wasm: enable QT_BUILD_MINIMAL_STATIC_TESTS by default
Wasm doesn't play well with these baseline tests in general,
so we can disable them for now.

Pick-to: 6.4
Change-Id: I5a66a932449c8934d88b94e419aae5ddcc89ee78
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-28 09:48:06 +02:00
Lucie Gérard
38f8d531a2 Apply fixes for SPDX compliance and easier parsing
Task-number: QTBUG-106233
Change-Id: Ic636bcfc7d5efcf23c67482beebe2fff1f184073
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-27 20:38:14 +02:00
Alexey Edelev
b89d63515b Replace the syncqt.pl script with syncqt tool
syncqt.pl adds an extra dependency on perl when building Qt. Modern C++
provides the convenient cross-platform way to access a filesystem and
to use regular expressions, so we may replace the perl script with C++
application. The syncqt executable is built at configure time and
installed as QtCore tool. It's running at configure time to deliver the
required header files for IDE to build a consistent code model and at
the build time to keep tracking changes in header files and generate
the missing aliases without reconfiguring. 'syncqt' only parses header
files from a CMake build tree, so the resulting Qt installation only
contains interfacing headers that belong to the platform that Qt is
built for. 'sync.profile' files are not used as the 'source of truth'
for sync qt procedure anymore, all the necessary information is taken
from either CMake files at configure time or from the module header
files while parsing them.

syncqt.pl is still in place since it's required as fallback solution
for a smooth transition to the new syncqt implementation for all qt
repositories.

This patchset only enables the C++ based syncqt for 'qtbase'
repository.

From the performance perspective C++ version works faster then perl
script, also the configure time is reduced significally on subsequent
reconfigurations - up x2 times faster when re-configuring repository,
but it also takes time to compile the tool itself the first time.
Numbers for qtbase:
           syncqt.pl  syncqt.cpp
 initial:  0m16,035s  0m20,413s
 reconfig: 0m6,819s   0m3,725s

The syncing procedure can be run separately for each module using
<ModuleName>_sync_headers targets. The 'sync_headers' target can be
used to sync all the modules at once.

Task-number: QTBUG-87480
Task-number: QTBUG-103196
Change-Id: I8c938bcaf88a8713b39bbfd66d9e7ef12b2c3523
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-27 13:12:11 +02:00
Alexey Edelev
0a4761522b Avoid the 'file' command shadowing
Avoid the 'file' command shadowing by a variable and use file name when
filtering header files by type.

Amends 8539e641f6

Task-number: QTBUG-103196
Change-Id: If012975efafaf119cffbd89baf84df334bc057ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-21 20:41:43 +02:00
Alexey Edelev
6f12603cb1 Use PARSE_ARGV signature to process arguments instead of escaping
Use PARSE_ARGV signature of the cmake_parse_arguments function to avoid
escaping of semicolons when passing arguments to the
qt_internal_add_configure_time_tool and
qt_internal_add_configure_time_executable function.

Amends ac74b60c9c

Task-number: QTBUG-87480
Change-Id: I343abbd75107e56aaccab6e388db8dbda0525af3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-21 14:00:37 +02:00
Alexey Edelev
0b59c204a4 Add qt_configure_file_v2 function
The function does the same as the original one but respects semicolons
in CONTENT argument due to the use of the cmake_parse_arguments variant
with PARSE_ARGV.

Change-Id: I263662dc18e411a735b586995b82791fc6b888ea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-21 14:00:37 +02:00
Ulf Hermann
00b9409843 Android: Disable androidtestrunner extra timeout
We already have:

a, a timeout as part of QtTest. By default it lets each test function
   run for 5 minutes. This timeout can be configured using
   QTEST_FUNCTION_TIMEOUT.
b, maxTimeBetweenOutput in the CI. The CI will kill the process if too
   much time passes between individual output lines of a test.
c, maxTimeInSeconds in the CI. This does exactly the same as the
   androidtestrunner timeout.

The CI timeouts can be centrally tuned per platform and Qt module. This
is preferable over a special timeout just for android.

As other people may be using androidtestrunner for unrelated projects,
don't delete the timeout, but simply disable it from CMake by setting
it to -1.

Task-number: QTBUG-106479
Task-number: QTBUG-101596
Task-number: QTBUG-100242
Change-Id: If4ce00948e204182bb12ac4859d3b0dd193de7ad
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-09-21 14:00:37 +02:00
Mikolaj Boc
a5205d983b Set NO_EXCEPTIONS on executables on wasm
This reflects the true state of exceptions on WASM, which are always
disabled (DISABLE_EXCEPTION_CATCHING is always set with 1).

Change-Id: I7b681846159caf61f291f78a7b4ddf5260dc341f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-19 12:44:21 +02:00
Mikolaj Boc
bb582f7fd5 Use the js test runner for all tests on wasm
Make cmake changes that have ctest run the emrun test runner for
all tests that are build for wasm.

Change-Id: I8c07068d79cfd0d745dbcc3d3f025c7c48fe1069
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-19 08:54:02 +02:00
Alexandru Croitor
469dbe5c6d CMake: Fix _qt_is_test_executable assignment for tests
_qt_is_test_executable can only be set on a test that is backed by a
real target. QMLTESTs might not backed by an executable target, if
they are missing cpp SOURCES.

Which led to errors like

 CMake Error at
  cmake/QtTestHelpers.cmake:510
 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  textedit
 Call Stack (most recent call first):
  tests/auto/qmltest/textedit/CMakeLists.txt:10 (qt_internal_add_test)

Amends 62c681a599

Change-Id: Ie66fd3e94484562061f851c0a034629959d091da
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-09-17 00:30:39 +02:00
Alexandru Croitor
865b1721bd CMake: Fix return value of applicationName() on macOS
QCore::applicationName() is influenced by what values we insert into
the Info.plist file of an application bundle.

We accidentally inserted tokens like ${PRODUCT_NAME} that are meant to
be expanded by xcodebuild, even when using a generator like Ninja.

This caused the applicationName() to report "${PRODUCT_NAME}".

Make sure to only call relevant finalizers for macOS applications
when using a generator other than Xcode.

Amends d5580aa719

Pick-to: 6.4 6.4.0
Fixes: QTBUG-106652
Change-Id: Idbc9c84557a8f17b1302e6969f6eb317e3ef225d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-16 14:32:51 +00:00
Mikolaj Boc
62c681a599 Set target property _qt_is_test_executable on all tests
This is needed to later determine what kind of runner should be
selected on WASM for the executable. Tests use the test runner,
whereas other executables use qtLoader.

Change-Id: I75aa361403b72f8e82a288967b8a81b8232d68dc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-16 16:32:51 +02:00
Alexandru Croitor
59e08d2105 CMake: Add function to get tool wrapper shell script path
The _qt_internal_wrap_tool_command function has a limitation
that it is not possible to use it when a command needs to be wrapper
in a generator expression.

Provide a lower level API called
_qt_internal_get_tool_wrapper_script_path
to just get the path to the wrapper script, ensuring that the script
is created if needed.

Deprecate _qt_internal_wrap_tool_command, in favor of replacing it
with the new API.

Pick-to: 6.4
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ie4a4a17178bf2061ae01ee2b03b052d84560abf9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-09-15 22:47:12 +02:00
Alexandru Croitor
74083599f8 CMake: Rework tool wrapper shell script creation
Instead of creating the tool wrapper shell script only
during a Qt build in QtBuild.cmake,
ensure it is created any time _qt_internal_wrap_tool_command is
called, regardless if we're building Qt or a user project.

As a transitional period not to break compatibility, we also need
to create the script in QtBuild.cmake, until all usages of
QT_TOOL_COMMAND_WRAPPER_PATH are replaced with function calls.
Currently such usages are present in qtdeclarative.

When considering which bin dirs to add to the script's PATH
environment variable assignment, in addition to the build
internals relative bin dir, also add QT_BUILD_DIR,
QT_ADDITIONAL_PACKAGES_PREFIX_PATH and QT6_INSTALL_PREFIX.

QT_BUILD_DIR is important so we always pick up the just-built
but not installed libraries in a prefix build when running just-built
tools.

QT_ADDITIONAL_PACKAGES_PREFIX_PATH is important when building examples
as ExternalProjects in prefix builds, to ensure that the
not-yet-installed tools and libraries are picked up from the repo
build dir, which is passed via QT_ADDITIONAL_PACKAGES_PREFIX_PATH
to the external projects.

QT6_INSTALL_PREFIX is there in case if the build internals relative
dir is located in a different places than the Qt6 package.

Pick-to: 6.4
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I4d76fbbc275ca961379971054f87991adac36539
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-15 22:47:12 +02:00
Alexandru Croitor
828e402a19 CMake: Move __qt_internal_prefix_paths_to_roots
Move it into QtPublicCMakeHelpers.cmake so it is available also when
configuring qtbase and the Qt6Config.cmake file is not yet loaded.

Pick-to: 6.4
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I88127fe0439ae26af1d125eb584244d315574a48
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-15 22:47:12 +02:00
Alexandru Croitor
59f0f25f71 CMake: Move __qt_internal_collect_additional_prefix_paths
Move it out of QtConfig.cmake.in into QtPublicCMakeHelpers.cmake
so that the Qt6Config file is less cluttered.

Pick-to: 6.4
Change-Id: I772a0cca35d5c03cd688c3f1de34984484444105
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-15 22:47:12 +02:00
Joerg Bornemann
c9c04291f5 CMake: Add Linux support to qt_deploy_runtime_dependencies
Before this change, qt_deploy_runtime_dependencies supported Windows and
macOS only.  We add a generic deployment method implemented in
cmake-language with file(GET_RUNTIME_DEPENDENCIES).  This deployment
method is now enabled for shared builds on Linux.

The file(GRD) command requires that the EXECUTABLE argument points to
the executable in the build directory.

Only libraries in Qt's installation directory are considered for
deployment.  This includes Qt's own libraries and also things like
libicu*.so we're shipping with the installer.

Unlike macdeployqt and windeployqt, the generic
qt_deploy_runtime_dependencies does not yet support deploying
translations.  We will catch up on this in a later commit.

Change-Id: Iea23abcdba774d4c1885c8d2c243eb3e48fb7fae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-15 12:55:23 +02:00
David Skoland
3bd54f285d wasm: Replace QT6_INSTALL_PREFIX with WASM_BUILD_DIR in cmake helper
The change b515fa56a3
introduced checking the emsdk version of a qt installation.
However, this checked for QT6_INSTALL_PREFIX where it may not be
defined. This fails when trying to build tests because
when configuring tests, it calls into add_target_helpers which
calls into this logic, and QT6_INSTALL_PREFIX is set after
this is called into, causing the qconfig.h lookup to fail.
To fix this so it works in all conditions,
we need to check if either install prefix or
build_dir is set and use whichever is set.

Pick-to: 6.4
Change-Id: I3cf7e20d3d830f04e5b632fc51d8bf3b2758a717
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-13 18:13:00 +02:00
Alexey Edelev
ac74b60c9c Add function to add and compile executables at configure time
qt_internal_add_configure_time_executable compiles the executable
at configure time and exposes it to the CMake source tree. This is
useful when need to run a small C++ program at configure time.

Task-number: QTBUG-87480
Change-Id: I031efe797c8afa0721d75b46d4f36f67276bf46e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-13 00:50:47 +02:00
Alexey Edelev
553185e8c3 Skip AUTOGEN for config files
Amends c7d1d56b09

Task-number: QTBUG-103196
Change-Id: I319ca96bb54b9d0274270790d8c92151ea3398f0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-12 20:31:04 +02:00
Alexey Edelev
0c1368c7e4 Move the tool look-up functionality to a separate function
Change-Id: Ibe9ef9de981afac4b585068c62eef5af01989417
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-12 20:09:03 +02:00
Alexey Edelev
c7d1d56b09 Add <module>-config[-p].h files to the module sources
<module>-config[-p].h files need to be added to the CMake source tree

Amends 8539e641f6

Task-number: QTBUG-103196
Change-Id: I8baaa672ad869da8a030d890da8bdea5bd8c7794
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-09 17:04:16 +02:00
Morten Sørvig
8c959a3609 wasm: don't set GL_DEBUG
This spams the console with "writeStackCookie"/"checkStackCookie"
messages, which makes finding relevant debug output harder.

Pick-to: 6.4
Change-Id: I352b633f02f9ecc1333d1d91f5ffc21a4a937e53
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2022-09-08 12:15:24 +00:00