summaryrefslogtreecommitdiffstats
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* MSVC: Use dubbed FH4 to make C++ exception handling smallerYuhang Zhao2021-12-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Visual Studio 2019 introduced the dubbed FH4 feature which can make C++ exception handling smaller on x64. According to the article [1], it's enabled by default for UWP applications, and Microsoft also use it in their own widely-known commercial products such as Office to reduce the binary size. So make use of this feature for Qt when possible, to get smaller binary. As a drive-by, add "/EHs-c-" explicitly to the flags when we want to disable C++ exception handling. [1] Official article that introduces dubbed FH4: https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/ Change-Id: I2e3330de477f78372cf7903d0ef7a732b09552a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Install MSVC debug information for resource object librariesJoerg Bornemann2021-12-022-1/+32
| | | | | | | | | | | | | | | | Building against a static debug MSVC Qt produced LNK4099 warnings (PDB was not found with object file). This was because we did not install the .pdb files for the object libraries that are created for Qt resources. Now, these .pdb files are named like the object library targets and are installed next to the object files. Pick-to: 6.2 Fixes: QTBUG-97699 Change-Id: I7e23f8392b7ac657be1d2fb3b33e051ae2e4d407 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Enable warnings-are-errors for Visual Studio 2022Kai Köhne2021-11-301-2/+2
| | | | | Change-Id: Id0b143f668f69481f6037f94aedbfd2e87331497 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* CMake: Fix Android platform detectionJoerg Bornemann2021-11-291-1/+28
| | | | | | | | | | | | | | | ...if an Android platform < 10 is installed. The existing platform detection code preferred android-9 over android-31, because the sorting did not use natural comparison. Natural comparison was added to CMake in version 3.18. We simulate this feature for older CMake versions. Pick-to: 6.2 Fixes: QTBUG-98726 Change-Id: Ib2eb87bd47220feb672275fa5203df4f2b6d7ca7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Long live Q_GADGET_EXPORT!Marc Mutz2021-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | Like Q_NAMESPACE_EXPORT for Q_NAMESPACE, this variant of Q_GADGET allows passing an export macro. This is useful to avoid exporting the whole class just to get the staticMetaObject hidden therein exported. Before anyone asks: No, we don't need Q_OBJECT_EXPORT, because QObject subclasses, being polymorphic, always need to have a class-level export macro (to export their vtable), but while that technique also works for value classes (the Q_GADGET audience), it is not desirable for them, because it makes inline functions exported in Windows debug builds, which is not what we want, because it needlessly restricts what you can to with the inline functions (e.g. remove). [ChangeLog][QtCore] Added the Q_GADGET_EXPORT macro, which is like Q_GADGET, but allows passing an export macro (like Q_NAMESPACE_EXPORT for Q_NAMESPACE). Fixes: QTBUG-55458 Change-Id: I546297de1e8aa45d83381991bcd3fbca61e1eef0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add missing dependency of ${target}_check to ${target}_make_apkAlexey Edelev2021-11-261-0/+3
| | | | | | | | | | When building for and running the '_check' target in Android we need to make sure that target apk is assembled and ready for deployment. Pick-to: 6.2 Change-Id: Ifc63aac230f0bb8375d319ec443174c5a436485e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qt_internal_add_module: Document HEADER_MODULE and STATICFabian Kosmale2021-11-261-0/+8
| | | | | | Task-number: QTBUG-94863 Change-Id: If52ed7e17ea77d8cb6e0255e988feb0b1bd0aa76 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Win32: Enable large address aware explicitlyYuhang Zhao2021-11-261-1/+1
| | | | | | | | | | | | | | | | | Large address aware is enabled by default in 64-bit compilers, but not 32-bit compilers. But Qt users may build 32-bit Qt themself, in this case large address aware is disabled in fact, and it may cause some issues. So we pass /LARGEADDRESSAWARE to the linker unconditionally to make sure large address aware is enabled for both 32-bit and 64-bit builds. Microsoft Docs: https://docs.microsoft.com/en-us/cpp/build/reference/largeaddressaware-handle-large-addresses?view=msvc-170 Change-Id: Idb2603d9ba0ba9ef4477ce1c3174b7c7e8ba76f6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* wasm: remove duplicate “--bind” optionMorten Johan Sørvig2021-11-191-2/+0
| | | | | | | | | Not a compile option, and also added to the linker options above. Change-Id: Iab2107d4b5ee4bc73e85b3cd5070f1a96b3a5a3b Reviewed-by: David Skoland <david.skoland@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Delete -Wextra compilation flag for GHS compilerTatiana Borisova2021-11-181-1/+5
| | | | | | | | - GHS compiler doesn't have -Wextra flag and it leads to huge count of warnings. Pick-to: 6.2 Change-Id: Id2ba654a49fb163bebc75e3a22ecaa1895ecdbe8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Rename and restructure the baseline (lancelot) testing codeEirik Aavitsland2021-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | In preparation for addition of new baseline tests, establish a new test category, "baseline". This is similar to the category "benchmarks" in that it contains tests that use the QTest framework, but conceptually are not unit tests, in contrast to those under auto/. Move the existing QPainter baseline test, tst_lancelot, into this new category, and rename it accordingly. Baseline tests use the QBaselineTest extension to QTest. Move that extension too into the tests/baseline directory, allowing the clean out of the baselineserver directory. Pick-to: 6.2 Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Android: bump default QT_ANDROID_API_VERSION to 31Assam Boudjelthia2021-11-121-1/+1
| | | | | | | | | To allow using Android 12 APIs. Pick-to: 6.2 5.15 Change-Id: I5e9da66c84457888ec723125d16876891232a99b Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* configure: Fix --foo=bar argumentsJoerg Bornemann2021-11-101-1/+1
| | | | | | | | | | This amends commit c5409964b0c627b25131c73f95794314feb51b5d. When detecting a variable assignment, we must ignore arguments that start with a dash. Otherwise, arguments like --prefix=~/Qt are ignored. Change-Id: I3b143113b94ca0d8af92679c1f567fbcec298349 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add CoreBluetooth framework for macOSJuha Vuolle2021-11-101-0/+1
| | | | | | | | | | The Qt bluetooth module uses ${FWCoreBluetooth} when building for iOS, but that evaluated to empty. Pick-to: 6.2 Change-Id: I93ff2c30697a912bed454087ae260fae9cc41b0f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Don't notify/warn the user when Xcode is not foundTor Arne Vestbø2021-11-101-3/+0
| | | | | | | | | | We can technically build without Xcode, as long as the command line tools are installed. We reflect that by an empty QT_MAC_XCODE_VERSION variable. Pick-to: 6.2 Change-Id: I40ffa28a628157e0a2c63656065ea7c41a680e01 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)Yuhang Zhao2021-11-102-1/+26
| | | | | | | | | | | And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Fix default install prefix of top-level non-developer buildsJoerg Bornemann2021-11-081-1/+3
| | | | | | | | | | | | | | | A top-level non-developer build is supposed to default to a prefix like "/usr/local/Qt-6.3.0". That wasn't the case. In QtSetup.cmake we check CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT, set CMAKE_INSTALL_PREFIX and did the same thing later in QtBuildInternalsExtra.cmake, with a different value. Make sure we run the latter code only in per-repo builds. Pick-to: 6.2 Fixes: QTBUG-98087 Change-Id: I4a1291dfd126aa11c21d69809f2cf7b075c98d2e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Assume qhelpgenerator in libexec instead of binJoerg Bornemann2021-11-081-1/+1
| | | | | | Task-number: QTBUG-88791 Change-Id: I0f6dc14401e715a98322abc21da3f88e34118e27 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Provide a qtpaths wrapper script when cross-building QtJoerg Bornemann2021-11-082-16/+18
| | | | | | | | | | | | | The qtpaths tool is supposed to replace "qmake -query", and it must be available for cross-builds as a wrapper script like qmake. Re-use the existing facility for creating the qmake wrapper script for creating the qtpaths wrapper script. Pick-to: 6.2 Fixes: QTBUG-97821 Change-Id: I460bae61a531994422e1c0fba09c79e4aa65713f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* configure: Allow specifying arbitrary variable assignmentsJoerg Bornemann2021-11-051-0/+13
| | | | | | | | | | | | | | It's now possible to call configure with arbitrary variable assignments "FOO=BAR" that get passed as "-DFOO=BAR" to CMake. There is no error anymore for unknown variables. CMake already warns about those: "Manually-specified variables were not used by the project: FOO". [ChangeLog][configure] Users can directly assign CMake variables with configure, for example "configure CMAKE_CXX_COMPILE=clang++-11". Fixes: QTBUG-88210 Change-Id: Ib15e63a895df717919dd2b6623fa4d284209776f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake/qconfig.cpp: use raw strings so we support any inputThiago Macieira2021-11-041-12/+12
| | | | | Change-Id: I2bbf422288924c198645fffd16aa04379315e69e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* wasm: increase default initial memoryLorn Potter2021-11-041-2/+6
| | | | | | | | | | | | | | | | Some apps may need more initial memory when linking, emscripten will fail with: wasm-ld: error: initial memory too small This increases the default initial memory form 16MB to 20MB. Larger apps might still get this error, in which case QT_WASM_INITIAL_MEMORY can be set. Pick-to: 6.2 Fixes: QTBUG-97457 Change-Id: Icdc56c41fb3a3852a9a83f7a3dc15820e83e1148 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: enable event dispatcher asyncify supportMorten Johan Sørvig2021-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Misc. fixes, including: Fix a couple of typos in the JavaScript code. Also, macros- within-macros don’t work, (without resorting to preprocessor token pasting), so remove the debug output for now. Limit the exec() “simulateInfiniteLoop” workaround to top-level application exec() only. This way, asyncify can be used for nested QEventLoop::exec() calls. (Emscripten supports one level of suspend only, so we don’t want to use that for the top-level exec(), but instead use it for dialogs and such). Use the new QEventLoop::ProcessEventsFlag::ApplicationExec enum value to detect the exec() call type. Change-Id: Ic702bfc31faf2e9f84ac5d3ccf43d067c5c61bf0 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Move qt_finalize_framework_headers_copy to the scope finalizerAlexey Edelev2021-11-031-4/+1
| | | | | | | | | | | | | | The qt_finalize_framework_headers_copy function uses the module QT_COPIED_FRAMEWORK_HEADERS property to generate the dependency list for the ${target}_framework_headers target. In a common case elements can be added to the QT_COPIED_FRAMEWORK_HEADERS property after the qt_internal_add_module command call, that's why we need to make sure that qt_finalize_framework_headers_copy is called after collecting all headers assigned to the module. Pick-to: 6.2 Change-Id: I2878fa6b8d4b11677c3f48345bf6e239221074c2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: QtDocsHelpers: Rename generate_qdocs_args variableTopi Reinio2021-11-031-2/+2
| | | | | | | | | To be consistent with prepare_qdoc_args. Pick-to: 6.2 Change-Id: Ibd40d6c26f6f6fa49ea78b6476f396153b7c4ee5 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Improve comment about how to disable warningsKai Köhne2021-11-021-3/+5
| | | | | | Change-Id: I4367f2b585b7fdfaba2a815be885157a1db990cd Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Don't create targets if dependencies are not foundAlexandru Croitor2021-11-021-1/+1
| | | | | | | | | | | | | | | | | | If one of the dependencies in QtFooModuleDependencies.cmake is not found, QtFoo_FOUND will be set to False by find_dependency. In that case, we should not create imported targets that belong to that package. It would be misleading for projects that do target existence checks instead of package_FOUND checks as well as generally being incorrect. The created imported targets might be referencing other targets that would not exist. Pick-to: 6.2 Fixes: QTBUG-97896 Change-Id: I09198aa3f19be047b27c29329b6e62c30fa09dc0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Craig Scott <craig.scott@qt.io>
* configure: Remove unused facility to define variable assignmentsJoerg Bornemann2021-11-011-29/+0
| | | | | | | | | | | | The function qt_commandline_assignment and everything related to it is removed from configure. It was only used in qtbase, and all usage has been removed. More general variable assignments will be added in a subsequent commit. Task-number: QTBUG-88210 Change-Id: I7cfa782e89914f2b0dc0277c46e425c8a825557e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove CFBundleGetInfoString from CMake Info.plist templatesTor Arne Vestbø2021-11-012-4/+0
| | | | | | | | | | | It's been deprecated since Mac OS X 10.5. qmake templates fixed in 0768a28fbfe4c7227182b6b4b7cacbc6772c54f4. Task-number: QTBUG-74872 Pick-to: 6.2 Change-Id: If7d988f27f07b6fa095b2ea51a87c306361d63d1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qconfig.cpp: use qOffsetStringArrayThiago Macieira2021-10-291-25/+12
| | | | | | | | | | It's been there for ages, we may as well use it and remove unnecessary complexity from CMake. Pick-to: 6.2 Change-Id: I2bbf422288924c198645fffd16a9742567a7e4af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Warn when using unsuitable CMake due to issue finding host perlAlexandru Croitor2021-10-291-0/+13
| | | | | | | | | | CMake's Modules/Platform/Android-Initialize.cmake was setting CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to OFF and host perl was not picked up in PATH on Windows when building for Android. Pick-to: 6.2 Change-Id: Ic98d8b38425231ef6aaf173fdfe958b573cc0c40 Reviewed-by: Craig Scott <craig.scott@qt.io>
* CMake: Allow enabling/disabling QT_HOST_PATH checks via variableAlexandru Croitor2021-10-291-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One can now pass -DQT_REQUIRE_HOST_PATH_CHECK=OFF or -DQT_REQUIRE_HOST_PATH_CHECK=ON to force disable or enable the QT_HOST_PATH and QT_HOST_CMAKE_DIR_PATH validity checks. One potential use case is if a project wants to manually find QtFooTools packages by manipulating CMAKE_FIND_ROOT_PATH and such, in which case they might not want to pass a QT_HOST_PATH. Another potential use case is cross-building Qt with -DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON and allowing the same generated toolchain file to be used on the device image. By default the generated toolchain file would require a host path because it expects that it's still being used for cross-compiling. But once the toolchain file is deployed to the device there's no need to use the host tools anymore. Another use case is building a desktop Qt using the host tools of another desktop Qt. The new desktop Qt can use its newly built tools just fine and wouldn't need the original desktop Qt tools. QT_REQUIRE_HOST_PATH_CHECK needs to be added the list of vars to pass through to try_compile calls. Change-Id: I4b922b5d854828e6b9210dd8c07b4b1b8630aad1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Craig Scott <craig.scott@qt.io>
* CMake: Fix _QT_TOOLCHAIN_VARS_INITIALIZED check in toolchain fileAlexandru Croitor2021-10-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The environment variable check to set extra env vars was using invalid syntax. The condition always resolved to TRUE which means the env vars were constantly re-assigned inside each try_compile project. To check for undefined-ness, one can use if(NOT DEFINED ENV{...}) To check for false-ness, one can use if(NOT "$ENV{...}") To check for string emptiness, one can use if(NOT "$ENV{...}" STREQUAL "") In this particular case checking for false-ness is good enough. The extra re-assigning had no visible effect, so this is just cleanup. As a drive-by, clarify one comment. Amends ca59c20939a09587662fa8fecd4e480b68244541 Pick-to: 6.2 Change-Id: I8fd400101efa9e610a81268c33cac8c0cb33cba3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Craig Scott <craig.scott@qt.io>
* CMake: Use Qt6HostInfo dir for Tools CMAKE_PREFIX_PATH assignmentAlexandru Croitor2021-10-291-1/+2
| | | | | | | | | | | | Instead of hard-coding a lib/cmake suffix to CMAKE_PREFIX_PATH use the parent directory of the Qt6HostInfo package which is always searched for when QT_HOST_PATH is set. Amends d2359b2d4e5db6c42158d536d6e2a2af5ea1e59c Pick-to: 6.2 Change-Id: I7f3c8fe17bc82f733580d68d928146434a57d849 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Clean up and improve QT_HOST_PATH_CMAKE_DIR computationAlexandru Croitor2021-10-292-29/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously when one wanted to use a cross-compiled Qt with a host Qt installed in a non-default location, they'd have to provide both QT_HOST_PATH and QT_HOST_PATH_CMAKE_DIR. This change will now try to first check if ${QT_HOST_PATH}/lib/cmake is a valid path on disk and use that. This is nicer to the user because they don't need to specify 2 paths anymore. Furthermore the path computation and sanity checks are now done after any extra toolchain cmake files are loaded, to give an opportunity to the files to set the paths first. Finally, both variables need to be added to __qt_toolchain_used_variables so they are passed along to try_compile calls if the variables are specified manually. Otherwise when the toolchain file is loaded by a try_compile project, it will error out saying no host path found (as long as the initial paths embedded in the toolchain are invalid). Amends 93fc3afe71467ca6aeffa41d7a6f4a170f82b62e and ec90f9013b4c6b63d7e03a964f66f97329be7885 Pick-to: 6.2 Change-Id: I433239b36b084f2d0a7a0dd043fdf87d77c138f3 Reviewed-by: Craig Scott <craig.scott@qt.io>
* CMake: Fix forcing usage of host tools when doing a desktop buildAlexandru Croitor2021-10-291-7/+21
| | | | | | | | | | | | | | | | | | | | One can now set QT_FORCE_FIND_TOOLS to ON together with passing a QT_HOST_PATH to ensure that a new desktop build uses already existing tools from a different Qt host (desktop) installation. Depends on a0e56294c1e80f34147c5a992b314776e1b6c757 to work, which is not in 6.2, but this change is still included in 6.2 because it cleans up the conditions a bit to make them more clear. Amends 42d3b21c92525ea6a430c67e577a5991d679fa1d and 5a779a4ad350accadc4337d332eedb29ba1cc26b Pick-to: 6.2 Fixes: QTBUG-95099 Task-number: QTBUG-97658 Change-Id: If6258fb1091c6c1e457f22ae5f468b811bd20d57 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Enforce lookup of host Tools packages in qt_internal_add_toolAlexandru Croitor2021-10-291-13/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When cross-building, qt_internal_add_tool would accidentally find device QtFooTools CMake packages as a result of calling find_package. It should have found host Tools packages instead. The reason was due to a combination of setting CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH, find_package preferring the lookup of packages in CMAKE_FIND_ROOT_PATH before CMAKE_PREFIX_PATH and there being a Tools package in the device sysroot. Because qt_internal_add_tool didn't adjust CMAKE_FIND_ROOT_PATH to contain the host path, the device package was picked up. Change the implementation not to set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE and instead modify both CMAKE_FIND_ROOT_PATH and CMAKE_PREFIX_PATH to prefer the host packages instead. This aligns to the behavior that was introduced in ec90f9013b4c6b63d7e03a964f66f97329be7885 which is used in QtModuleDependencies when looking for Tools packages. Pick-to: 6.2 Fixes: QTBUG-97599 Change-Id: I8e38284774ae97981ccfd5071465609f3de80f01 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow disabling package version checkAlexandru Croitor2021-10-277-6/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building Qt repos, all find_package(Qt6) calls request a PROJECT_VERSION version which is set in .cmake.conf via QT_REPO_MODULE_VERSION. This means trying to configure qtsvg from a 6.3 branch using a 6.2 qtbase won't work, because qtsvg will call find_package(Qt6 6.3) and no such Qt6 package version exists. There are certain scenarios where it might be useful to try to do that though. One of them is doing Qt development while locally mixing branches. Another is building a 6.4 QtWebEngine against a 6.2 Qt. Allow to opt out of the version check by configuring each Qt repo with -DQT_NO_PACKAGE_VERSION_CHECK=TRUE. This setting is not recorded and will have to be set again when configuring another repo. The version check will also be disabled by default when configuring with the -developer-build feature. This will be recorded and embedded into each ConfigVersion file. If the version check is disabled, a warning will be shown mentioning the incompatible version of a package that was found but that package will still be accepted. The warning will show both when building Qt or using Qt in a user project. The warnings can be disabled by passing -DQT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING=TRUE Furthermore when building a Qt repo, another warning will show when an incompatible package version is detected, to suggest to the Qt builder whether they want to use the incompatible version by disabling the version check. Note that there are no compatibility promises when using mixed non-matching versions. Things might not work. These options are only provided for convenience and their users know what they are doing. Pick-to: 6.2 Fixes: QTBUG-96458 Change-Id: I1a42e0b2a00b73513d776d89a76102ffd9136422 Reviewed-by: Craig Scott <craig.scott@qt.io>
* QNX: Generate empty string for WORKING_DIRECTORY test wrapperPasi Petäjäjärvi2021-10-271-1/+4
| | | | | | | | | | | | Tests for QNX are run in qemu over ssh and setting WORKING_DIRECTORY will cause created test wrapper to try change specified directory which will fail (expects local directory) when test is invoked over ssh. Task-number: QTBUG-87628 Pick-to: 6.2 Change-Id: If991002398811cc9cb9cbac54da5d2cb0d8c3589 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add a QNetworkInformation backend based on GNetworkMonitorIlya Fedin2021-10-241-1/+47
| | | | | | | | | | GNetworkMonitor can get information from 3 sources: * org.freedesktop.portal.NetworkMonitor * NetworkManager * netlink Change-Id: Icfafe6af42148f26360449f1262093ffc6b0613a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Fix -rpath-link dependencies take twoAlexandru Croitor2021-10-221-8/+53
| | | | | | | | | | | | | | | | | | | | | | The previous implementation would pick up static Qt deps of a shared Qt library as packages to find, but packages are not created for these static libraries in a shared Qt build. For example Qt::BundledSpirv_Cross is a static helper lib that is linked directly into ShaderTools shared lib and no CMake package is created for it, so we shouldn't look for it. Separate the code path to filter out private dependencies of a shared library target that don't have packages. Amends 87215c70c0ff0bdc52dfa463f050d2aa049cdd91 Pick-to: 6.2 Fixes: QTBUG-97673 Task-number: QTBUG-86533 Change-Id: I43490b4d20c150256ccfa8b511a6e0e6b0f4b313 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Revert "CMake: Fix rpath-link dependencies when cross-compiling"Alexandru Croitor2021-10-211-10/+2
| | | | | | | | | | | | | This reverts commit 87215c70c0ff0bdc52dfa463f050d2aa049cdd91. Reason for revert: Breaks configuration of standalone tests in leaf modules Pick-to: 6.2 Fixes: QTBUG-97673 Task-number: QTBUG-86533 Change-Id: Idd5014b57a8d10070108f5b235c822863dbac088 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix rpath-link dependencies when cross-compilingAlexandru Croitor2021-10-201-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Private Qt module dependencies of a Qt module are recorded in the IMPORTED_LINK_DEPENDENT_LIBRARIES property of a Qt module. This property is used to compute the runtime dependency dir path to be passed to the linker via the -rpath-link option. If the referenced target does not exist in the scope where it's used, no -rpath-link will be generated (or at least that specific dir path won't be passed). The linking operation will either fail saying the library is not found, or a different version of the library might be silently picked up in the sysroot or other implicit lib dir. Make sure that QtFooModuleDependencies.cmake calls find_package() for all Qt module private dependencies (or other Qt provided 3rd party libs in the Qt6:: namespace) so that the targets are in scope and IMPORTED_LINK_DEPENDENT_LIBRARIES does its job. qmake also records the INTERFACE_LINK_LIBRARIES of a private Qt module as the runtime dependencies of the module. It's not clear why it does that. A private Qt module is an INTERFACE_LIBRARY so it shouldn't add any new runtime dependencies. Nevertheless, the find_package part of that has been recently addressed in 2b6500cd15c0a41cf3e5eea8178e2044012dbd97 for a different reason. This change is basically the CMake equivalent of 326b91ea788b013512ae911c51cc19497d88916d Pick-to: 6.2 Fixes: QTBUG-86533 Change-Id: Iaf514a14acaded4e8752149cca0c159a271be188 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QList: deprecate iterator<->pointer implicit conversions (2/3)Giuseppe D'Angelo2021-10-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constructor from a raw pointer should be 1) constexpr, 2) explicit, and 3) *private*. We can do 1) without too much trouble. 2) is a (easy to fix) SIC in case of implicit conversions accidentally relied upon from somewhere. 3) cannot be "easily" fixed by user code (they have to refactor), and also, it's a BIC on Windows which encodes class members' access in symbols. Someone may have been exporting some QList subclass, in turn exporting the iterator classes, and therefore that someone now has the constructors' symbols with a given access. So, don't do 2+3 _just yet_ for user code, but set a deadline: Qt 6.5 is the last that will support this. On Qt 6.6, we switch. All of this on non-Windows, againt to avoid an ABI break. One can opt-in at any time via a suitable define. Given we have this define, use it to guard the other way around as well: conversions from an iterator to a raw pointer should never be explicit (there's std::to_address for this). [ChangeLog][QtCore][QList] Converting a QList's iterator from and to a raw pointer is deprecated, and will get removed in Qt 6.6. User code can prepare for the change by defining QT_STRICT_QLIST_ITERATORS. Change-Id: I0f34bfa3ac055c02af5a3ca159180304660dfc11 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Postpone target existence check for qml plugin targetsAlexandru Croitor2021-10-151-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each included qml Qt6FooPluginTargets.cmake file checks whether all the dependency targets that are referenced in the file already exist by the time the file is included. If one of the referenced targets is missing, the file sets ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE with a message mentioning which targets are missing and also sets ${CMAKE_FIND_PACKAGE_NAME}_FOUND to FALSE. All our qml package Config.cmake and Targets.cmake files are include()d by Qt6QmlPlugins.cmake using a file(GLOB) which means the order in which the files are loaded is implementation-defined. Furthermore we didn't check the above set variables after each inclusion, which means the values are overridden and the last plugin to be loaded determines whether the Qml package is found or not. If the last included file sets no error, it effectively silences any previously set error. Ever since we added dependencies between the qml plugin targets themselves, we hit the above situation and depending on the platform, no error was shown because the last file overrode any errors. But we finally got a specific platform (wasm) which unearthed the problem (QTBUG-97478). This can happen for any static Qt build though. To fix this properly, we will most likely have to rewrite the whole inclusion mechanism to use find_package() so that dependencies can be resolved recursively as needed. This is a non-trivial change that will have to be addressed in both qtbase and qtdeclarative. In the mean time, a stop-gap solution that this change implements is to include all the files while ignoring any error messages. Then include the files one more time and check for error message after each included file. All qml plugin targets should have been brought into scope with the first round of inclusions, thus circumventing "missing referenced target" errors, while still catching any other possible errors. Amends 6fd1216801f078f65be2cbc748cc459cb6912a4f 9fc302e6d146878103b3d105dce49c7695fcf93a c368175a9e0a0c120b5bb8a0a02859bfc0cf42ba in qtdeclarative. Pick-to: 6.2 6.2.1 Fixes: QTBUG-97478 Task-number: QTBUG-95609 Task-number: QTBUG-97099 Change-Id: I157fa93fc979d726cd221d969b995b3642aeec77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add PRIVATE_MODULE_INTERFACE to the module dependency setAlexey Edelev2021-10-151-1/+1
| | | | | | | | | | | | | | PRIVATE_MODULE_INTERFACE libraries are linked as interface libraries to the module's Private target and exported as the dependencies of package targets. We need to register these modules as public package dependencies to call find_package when resolving module dependencies in user projects. Pick-to: 6.2 Fixes: QTBUG-96558 Change-Id: I4eef550aab306eaf357539ef7a0f76d69873f856 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve double call protection of qt_internal_generate_tool_command_wrapperAlexey Edelev2021-10-151-4/+15
| | | | | | | | | | | | | | | | | | file(GENERATE) might fail if an unrelated configuration error happens, and yet QT_TOOL_COMMAND_WRAPPER_PATH would already be set. Set the cache variable only if generating was successful and replace the QT_TOOL_COMMAND_WRAPPER_PATH valiable check with GLOBAL property to protect the function from double call. For CMake versions higher than or equal to 3.18 replace 'file(GENERATE' call with 'file(CONFIGURE' to generate the wrapper at configure time with the use of a plain semicolon character. Pick-to: 6.2 Fixes: QTBUG-96870 Change-Id: Icf9c40f571d9c069043604f67ffcf2762966f6d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Set QT_ANDROID_ABIS when builing qtbase for AndroidAlexey Edelev2021-10-141-0/+6
| | | | | | | | | | | | When building Qt we need to set QT_ANDROID_ABIS value to CMAKE_ANDROID_ARCH_ABI explictily since the automatical detecting of android ABI is not executed. This fixes build of the qtbase in-tree tests. Fixes: QTBUG-97133 Change-Id: Ica7057bcfcc8f4fe4b5a921ca7449f74cdbca0f1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* CMake: Make LTO build workThiago Macieira2021-10-131-1/+1
| | | | | | | | We don't need to check FEATURE_ltcg, just add -fno-lto unconditionally. That makes QtCore compile with -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON. Change-Id: Icb2516126f674e7b8bb3fffd16ada2c71d7334aa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: remove support for building Qt with the old Intel compilerThiago Macieira2021-10-139-118/+20
| | | | | | | | | | | | | | | | | | This hasn't worked for some time. It's not in our CI and I don't think it was working at all. When I tried to build it, I ran into several problems with C++17 and an Internal Compiler Error I did not have any interest in working around. After discussing with the Intel compiler team, it was decided that fixing those issues in the old compiler is not going to happen. Instead, their recommendation is to adopt the new LLVM-based compiler, which the last commit added support for. This commit does not remove qmake support for the old ICC. It's possible someone is using qmake with a non-Qt6 project and ICC. Change-Id: Icb2516126f674e7b8bb3fffd16ad6350ddbd49e5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>