summaryrefslogtreecommitdiffstats
path: root/src/corelib/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
...
* Add QAndroidApplication as a nativeInterfaceAssam Boudjelthia2021-02-201-0/+2
| | | | | | | | | | QAndroidApplication provides the Android specific app context() and isActivityContext() to determine whether the context is an Activity or otherwise a Service. Task-number: QTBUG-90499 Change-Id: Iae2eef7ec44859a89825b09f52f09506b20b5420 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove the corelib_add_mimetypes_resources call for the Core libraryAlexey Edelev2021-02-151-1/+0
| | | | | | | | | | | | | | Looks like the corelib_add_mimetypes_resources call is redundant and deprecated. It duplicates the mime-type database in the Core library. This also fixes the static build of the qmimedatabase tests, since avoids propagation of the resource symbols by the Core library. Fixes: QTBUG-89952 Pick-to: 6.0 Pick-to: 6.1 Change-Id: I5c0dbd761b7726589fdf6970cd546af89d2ff837 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Implement futexes for WindowsThiago Macieira2021-02-131-12/+12
| | | | | | | | | | | | | Windows 8 added this pair of functions that can be used to implement the same functionality as we have on Linux. For ease of understanding, I'm calling them "futex" on Windows too. From Qt 6 our minimum platform is Windows 10 so we can use this unconditionally. Change-Id: Ifea6e497f11a461db432ffff1448c6806ecfc36c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix compilation with system double-conversionMårten Nordheim2021-02-121-20/+21
| | | | | | | | | | | | | | A recent patch made it so we don't need to keep patching the includes of the sources. However it changed how we use double-conversion ourselves which meant that system installs would no longer work. Keeping an extra directory and adding another INCLUDE_DIRECTORY fixes both of our problems. Amends dca74b45a33de3ec098b936b087a112c7112241b Fixes: QTBUG-90961 Change-Id: If17aa1670535867343374eec846055441592f36b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use the double-conversion sources without rearrangementEdward Welbourne2021-02-031-16/+15
| | | | | | | | | This simplifies the include path addition we need when compiling and eliminates the need to rewrite all the #include lines on update. Change-Id: I14e301d277f1eb49286721b012559f0ec84ea520 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Ensure Core target has INTERFACE_QT_COORD_TYPE property definedCraig Scott2021-02-021-0/+3
| | | | | | | | | | | | | | | | | | In order for other Qt modules to be able to reliably use this property, it needs to be defined under all supported scenarios. Previously, it would only have been defined for a per-repo build and not for a top level superbuild. The only place it was being set was in the Qt6CoreConfigExtras.cmake file and only when QT_NO_CREATE_TARGETS was false (so it wouldn't be defined for examples even in a per-repo build). It was also noticed that INTERFACE_QT_MAJOR_VERSION was also being handled in Qt6CoreConfigExtras.cmake, but this was not needed. This was already being done as part of a call to qt_autogen_tools_initial_setup() which occurs inside qt_internal_add_module(). Fixes: QTBUG-90617 Change-Id: I589316ffb8138bd2df8a1d49fdd6335d2e2836f1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Update double-conversion library to current masterEdward Welbourne2021-02-011-10/+19
| | | | | | | | | | | | | | | | | | | | | | Turned our local diffs into a side-branch in the upstream repo, got material changes upstreamed (leaving only our #include changes), rebased it to master, copied back to our version. Upstream has made no new release since 3.1.5 in 2019 May, but there is substantial change since then, including acceptance of our upstreaming. Our patches have been refined in the process of upstreaming. The list of source files is slightly changed. The double-conversion.* files are split in two, string-to-double.* and double-to-string.*, but the old double-conversion.h header is retained, simply pulling in its two halves. These thus need to be present in the include directory. Changed the patches/ directory to be in git format-patch form, for sending or applying to the upstream repo, before copying files into the qtbase source tree. This should make future upstreaming easier. Task-number: QTBUG-90214 Change-Id: Id94198f58ef7bdf02af117c35cb9678b5c34ac0e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make QJniObject and QJniEnvironment public APIAssam Boudjelthia2021-01-271-0/+2
| | | | | | | | | | | | | | | | | | | | As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Workaround MinGW not handling error suppression macro correctlyFabian Kosmale2021-01-261-0/+6
| | | | | | | | Fixes: QTBUG-90353 Change-Id: I9270f4107f3f7083d28228f2426b34bc1e198112 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* FindLibb2: Don't rely solely on pkg-configCraig Scott2021-01-181-1/+1
| | | | | | Task-number: QTBUG-86283 Change-Id: Ie455d7cfc6e6f9ae8297f8bc0daf2816ccce91b6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Prevent compiler and linker flags from growing every cmake runCraig Scott2021-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Functions in QtFlagHandlingHelpers.cmake try to update the CMake cache variables for compiler and linker flags. These were using the current value of those variables and writing the modified ones back to the cache every time CMake ran. If a toolchain file sets or modifies any of these variables, that updated value is used and written back into the cache instead of the original cache variable's value. The next time CMake executes, the toolchain file re-applies the same change and the variable grows longer each time with flags repeated. With Ninja, this causes a complete rebuild every time CMake is re-run. The Android NDK toolchain file is one example where this behavior is triggered (the fault is shared, one could argue that the NDK should only be setting ..._INIT variables, but that's out of our control). Another related bug in the previous implementation was that the flags used to build after the first CMake execution could be different to those used for all builds after the second and later CMake runs. This is because the CMake cache was being updated, but not always the calling scope of the functions that modified them. If a toolchain file set any of the compiler or linker flag variables as non-cache variables, then updating the cache variable would have no effect on the calling scope. The non-cache variable would continue to take precedence for that scope for that run. The next time CMake executes though, the updated cache variable would now have been used by the toolchain file and the change *will* be part of the non-cache variable's value. The above are examples of why you should try to avoid updating these cache variables from project code. We could leave the cache alone and always update only non-cache variables, but then a developer looking at the cache may wonder why the values they see there don't match the values being used in builds. Or worse, they think the cache values are being used and don't realize the builds are using something different. Ultimately, we have to choose which downside we are happy to live with. The changes here preserve the previous intent of updating the cache, but it's still a bit fragile. Fixes: QTBUG-89821 Task-number: QTBUG-85992 Task-number: QTBUG-86866 Change-Id: I8a16753e159bde338e6d2e5dd2ce91fc8ac5c39d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix build with GCC and ltcgChristophe Giboudeaux2021-01-131-13/+18
| | | | | | | | | | | The porting script could not handle this special case. To achieve the same thing, we'll use an intermediate 'OBJECT' library which will get the '-fno-lto' build flag if the conditions are met. Fixes: QTBUG-89426 Pick-to: 6.0 Change-Id: Ied62502ce9c7f7fd6b89fab166f7bccfcd6e7433 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix 'static' conditionsJoerg Bornemann2020-12-171-2/+2
| | | | | | | | | The pro2cmake script doesn't handle static scopes correctly, and the generated "CONDITION static" must read "CONDITION NOT QT_BUILD_SHARED_LIBS". Change-Id: Ic5a5763e9fd5f5d04fb4c12227cbe85fac17b826 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Remove unneeded qatomic_msvc.hChristian Ehrlicher2020-12-041-1/+0
| | | | | | | | | Since Q_COMPILER_ATOMICS is defined for every supportied MSVC compiler in qcompilerdetection.h, qatomic_msvc.h is not included anymore in qbasicatomic.h and can be removed. Change-Id: I6505da5d5e9f1c3f9a060ad30cabb4b652634aa3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QVariant/QMetaType::compare APIsGiuseppe D'Angelo2020-11-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::optional<int> is the wrong datatype to use for compare. First and foremost, it can't be used in the idiomatic form of auto r = a.compare(b); if (r < 0) ~~~ // a is less than b if (r > 0) ~~~ // a is greater than b which we *already* feature in Qt (QString, QByteArray). Also, std::optional<int> (explicitly) converts to bool, which is a trap, because the result of the comparison can be accidentally tested as a bool: if (a.compare(b)) ~~~ // oops! does NOT mean a<b Not to mention extending this to algorithms: auto lessThan = [](QVariant a, QVariant b) { return a.compare(b); }; // oops! std::ranges::sort(vectorOfVariants, lessThan); which thankfully doesn't compile as is -- std::optional has an *explicit* operator bool, and the Compare concept requires an implicit conversion. However, the error the user is going to face will be "cannot convert to bool because the operator is explicit", which is deceiving because the fix is NOT supposed to be: auto lessThan = [](QVariant a, QVariant b) { return (bool)a.compare(b); }; // big oops! Instead: backport to Qt the required subset of C++20's <compare> API, and use that. This commits just adds the necessary parts for compare() (i.e. partial ordering), the rest of <compare> (classes, functions, conversions) can be added to 6.1. Change-Id: I2b5522da47854da39f79993e1207fad033786f00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 3e59c97c3453926fc66479d9ceca03901df55f90) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Use lower cased property name for entrypoint library opt-outAlexandru Croitor2020-11-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need this to enable headersclean functionality to work with CMake <=3.18 which is our minimum required CMake version to build Qt (it's not a problem for 3.19). Otherwise we hit a configuration error while trying to evaluate generator expressions for INTERFACE only libraries for which we need to do the headersclean check (e.g. UiPlugin in qttools). Sample error message: INTERFACE_LIBRARY targets may only have whitelisted properties. The property "QT_NO_ENTRYPOINT" is not allowed. More info: https://gitlab.kitware.com/cmake/cmake/-/issues/21484 Naming it lower case avoids the issue, but is inconsistent with all our other public property names. Furthermore if we do this change, it should probably go to 6.0.0 due to it being a property that a user is meant to set in their project. Task-number: QTBUG-82615 Change-Id: I1f1439f1e5cbc816010eba7301605a8f60b88fd1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 6ca66de9120537134b63d42de6c53c6e5834e8f3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace qt_make_unique with std::make_uniqueAllan Sandfeld Jensen2020-11-231-1/+0
| | | | | | | We can depend on C++14 now. Change-Id: Iee9796cd22dbfbb70d4bdb25f0eee1662a026d6d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove QScopedSharedPointerGiuseppe D'Angelo2020-11-201-1/+1
| | | | | | | It's private and unused since ~2012. Change-Id: Iea11af27f7eebf3eae2467b22b68cd4c26885edd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* cmake: Remove indirection via Startup target for EntryPointTor Arne Vestbø2020-11-121-5/+19
| | | | | | | | | | | | | The EntryPoint interface target now contains all the logic for what flags and optional static libraries to add when the entrypoint is enabled. The target property QT_NO_ENTRYPOINT can be used to disable the entrypoint. Change-Id: I9b14ff729366cd6307789c969ebd4b2ca19de77d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Add possibility to opt-out of file(ARCHIVE_CREATE) usageJoerg Bornemann2020-11-061-1/+1
| | | | | | | | | | | If CMake 3.18 was built with insufficient library dependencies then Qt's build will fail when file(ARCHIVE_CREATE) is called. Configure with -DQT_AVOID_CMAKE_ARCHIVING_API=ON to choose code paths were file(ARCHIVE_*) is not used. Change-Id: I30c390498337ab0fa78b88b66d2f8feaa1f3f10b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Regenerate qtbase projectsAlexandru Croitor2020-10-301-8/+8
| | | | | | | | | | In preparation for some further regeneration. Also modify pro2cmake to add forgotten mapping for the Qt::EglFsKmsGbmSupportPrivate module. Change-Id: I92425c566c2b275b40eec8c652496290754ac385 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix unnecessary rebuilding upon reconfigurationAlexandru Croitor2020-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The following MR in upstream CMake makes sure that the autogen targets depend on the CMakeLists.txt file associated with the autogen target, as well as any files it includes. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5166 When doing a no-op reconfiguration in the build dir (call 'cmake .') we used file(WRITE) to prepare the contents of a file to be used with configure_file() for creation of a .qrc resource file. Because this file was always rewritten on reconfiguration, its timestamp was newer than then autogen target's timestamp which caused the autogen targets to-be rerun, as well as some compilation and relinking. To avoid this, instead of using file(WRITE) ship a template file next to the Qt6CoreMacros.cmake file, and use it as a template for the qrc configure_file() call. This ensures that a reconfiguration doesn't necessarily rebuild things it shouldn't rebuild. Amends 113f1ad324202ea2b861a3dbdec2ee7ef716c283 Task-number: QTBUG-88004 Change-Id: Icd95b28ca3642434cf21e5c49dcbd1ec65d76252 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Remove Q_IS_ENUMAllan Sandfeld Jensen2020-10-301-1/+0
| | | | | | | Deprecated since 5.8 already. Change-Id: I01ea32b5f4b922cecb18c5760a1b5fa49c4e54c0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMetaContainer: Consistently coerce typesUlf Hermann2020-10-191-1/+1
| | | | | | | | | | | | | | | The high-level iterable interfaces should coerce the types of most QVariants passed to the expected ones. To do this, move the type coercion code into qvariant.{h|cpp} so that it is available to the QVariantRef specializations. The exception are variants passed to the find() functions of associative iterables. Here, we should not coerce values we cannot convert to the default-constructed keys. Instead we return end() in such cases. Fixes: QTBUG-87687 Change-Id: I0bd4e5c4e4e270dd3bf36cb3fb115794828077f2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Rename some public API functionsAlexandru Croitor2020-10-161-1/+1
| | | | | | | | | | | | | | | | | | | Some of them have a different (hopefully better) name now. Some are marked as Technical Preview. Some are renamed to be internal. Marking add_qt_gui_executable as TP with the intention to un-TP it after we rename it and change its behavior as discussed in the API review meeting. Additional changes to add_qt_gui_executable and qt6_add_resources have been filed as separate tasks that will be worked on separately. See comments on PS1 for details. Task-number: QTBUG-86827 Change-Id: I56a84a1943b0902bb807310dc620eb381824e8dd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Introduce Qt6::Startup targetAlexandru Croitor2020-10-121-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Add an abstraction over Qt::WinMain (aka qtmain.lib) and iOS's runtime linker entry point (_qt_main_wrapper). The Core target will now link against the Startup target on all platforms, instead of just WinMain on Windows. The creation and linkage interface definition of the Startup target is done at find_package(Qt6Core) time via the private call of _qt_internal_setup_startup_target(). This will add automatic linkage of WinMain to executables marked with the WIN32_EXECUTABLE property on Windows. As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag when linking iOS executables. Qt users can opt out of this behavior by either setting the QT_NO_LINK_QTMAIN property or variable. This is in line with Qt 5 behavior. Task-number: QTBUG-87060 Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Remove leftover debug outputAlexandru Croitor2020-10-061-2/+0
| | | | | | | Amends 07b6d3367debd8f15974abf0f5cdf48f0fe3a536 Change-Id: I8d5922af13903c6a10f967035bca70a89b19f86f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Refactor optimization flag handling and add optimize_fullAlexandru Croitor2020-10-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a bunch of helper functions to manipulate compiler flags and linker flags for the CMAKE_<LANG>_FLAGS_<CONFIG> and CMAKE_<LINK_TYPE>_LINKER_FLAGS_<CONFIG> CMake variables. These variables can be assigned and modified either in the cache or for a specific subdirectory scope, which will apply the flags only to targets in that scope. Add qt_internal_add_optimize_full_flags() function which mimics qmake's CONFIG += optimize_full behavior. Calling it will force usage of the '-O3' optimization flag on supported platforms (falling back '-O2' where not supported). Use the function for the Core and Gui subdirectories, to enable full optimization for the respective Qt modules as it is done in the qmake projects. To ensure that the global qmake-like compiler flags are assigned eveywhere, qt_internal_set_up_config_optimizations_like_in_qmake() needs to be called after Qt global features like optimize_size and optimize_full are available. This means that qtbase and its standalone tests need some special handling in regards to when to call that function. Task-number: QTBUG-86866 Change-Id: Ic7ac23de0265561cb06a0ba55089b6c0d3347441 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Android: rename Android's package name for Qt 6Assam Boudjelthia2020-10-031-1/+1
| | | | | | | | | | Rename Android package name org.qtproject.qt5.android to org.qtproject.qt.android to avoid inconsistency with Qt 6 name. Also, we include the major version number in the jar target. Task-number: QTBUG-86969 Change-Id: Ibb68947289be1079911b34ea157bf089cc52c47f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake Build: Add mimetype database compression with CMakeCristian Adam2020-10-011-17/+94
| | | | | | | | | | | | | The mimetype database needs to be compressed as gzip / zstd, then saved as hex byte blob in a cpp file. Previously this was done with a combination of Perl / PowerShell script. With CMake 3.18 we can do this only from the CMake script. With CMake 3.19 we will have the best compression rate set for zlib/zstd. Change-Id: I059bd90457c5a9da83b2b7c839a36e72e103b7eb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove QNX/Blackberry-related qpps* files from corelib/kernel/Edward Welbourne2020-09-261-10/+0
| | | | | | | | | They appear to be no longer in use. Task-number: QTBUG-85700 Change-Id: Id4c134b99372ccb26eead2a033d99196778c418e Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-105/+105
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate projectsAlexandru Croitor2020-09-221-20/+15
| | | | | | | | | Clean up the state of the projects, before changing the internal CMake API function names. Task-number: QTBUG-86815 Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Extend QSequentialIterable and add QAssociativeIterableUlf Hermann2020-09-191-1/+3
| | | | | | | | | And add mutable iterators. This requires some refactoring of the existing iterators. Task-number: QTBUG-81716 Change-Id: I61b3a3e8c0df5fd449679257a29d9f0c3d19c4f0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Fix race condition in -trace configured buildJoerg Bornemann2020-09-101-0/+5
| | | | | | | | | | | | qt_create_tracepoints(Core) creates a dependency from Core to Core_tracepoints_header, but the helper library Core_qobject also uses qtcore_tracepoints_p.h and must therefore depend on Core_tracepoints_header too. This amends 5c092c2b401. Change-Id: I0ed51f3ab9accea00f524c170cd319bb8af11df7 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Remove some pre-Qt6 codeEdward Welbourne2020-09-101-1/+0
| | | | | | Task-number: QTBUG-85700 Change-Id: Id4856d035b697276f6a7090956359044bac7d817 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Get rid of the MSVC specific fileLars Knoll2020-09-051-7/+0
| | | | | | | | | It used to contain the MSVC specific export hack for QVector, but that one is not required in Qt 6 anymore and the file was not doing anything anymore. Change-Id: Ic8b4aa355a8934beb6abcf10235d218344a294cc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Reimplement QSequentialIterable using QMetaSequenceUlf Hermann2020-09-031-0/+1
| | | | | Change-Id: Ie721a5f0caa697c4bf15a81f3762cf79d3c54f5a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix static buildFabian Kosmale2020-09-021-1/+1
| | | | | Change-Id: I52a31c76d2acb996ae5cf0b2ee6d221864d76b28 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add a QMetaSequence interfaceUlf Hermann2020-09-011-0/+2
| | | | | | | | | | | | | | | This is in line with QMetaType and will be used to implement a mutable QSequentialIterable. Later on, a QMetaAssociation will be added as well, to implement a mutable QAssociativeIterable. The code here represents the minimal set of functionality needed to have a practical sequential container. The functionality is not completely orthogonal. In particular, the index based operations could be implemented in terms of iterator-based operations. Task-number: QTBUG-81716 Change-Id: Ibd41eb7db248a774673c701549d9a03cbf2e48b6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live Q{Any,Utf8}StringView!Marc Mutz2020-08-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to add these two classes at the same time, because QAnyStringView makes all QUtf8StringView relational operators moot. We might want to add some later, esp. for UTF-8/UTf-8 comparisons, to avoid the pessimization that we can't early-out on size() mismatch in QAnyStringView equality operators, but that's an optimization, not a correctness issue, and can be fixed in a source-compatible way even after Qt 6 is released. To deal with the char8_t problem in C++20, make QUtf8StringView a class template out of which two UTF-8 views can be instantiated: the Qt 7 version, which depends on C++20 char8_t as value_type, and the Qt 6 version where value_type is a char. Use inline namespaces to map the QUtf8StringView identifier to one or the other, depending on the C++ version used to compile the user code. The inline namespace names must needs be a bit ugly, as their inline'ness depends on __cpp_char8_t. If we simply used q_v1/q_v2 we'd be blocking these names for Qt inline namespaces forever, because it's likely that inline'ness of other users of inline namespaces in Qt depends on things other than __cpp_char8_t. While inline'ness of namespaces is, theoretically speaking, a compile-time-only property, at least Clang warns about mixed use of inline on a given namespace, so we need to bite the bullet here. This is also the reason for the QT_BEGIN_..._NAMESPACE macros: GCC is ok with the first declaration making a namespace inline, while Clang warns upon re-opening an inline namespace as a non-inline one. [ChangeLog][QtCore][QUtf8StringView] New class. [ChangeLog][QtCore][QAnyStringView] New class. Change-Id: Ia7179760fca0e0b67d52f5accb0a62e389b17913 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove MSVC workaround for QPolygonMarcel Krems2020-08-291-1/+1
| | | | | Change-Id: I62f7c6da7629dcdfda653a136d3bcd483359c86c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move QStateMachine from QtCore to QtScxmlKarsten Heimrich2020-08-241-13/+0
| | | | | | Task-number: QTBUG-80316 Change-Id: I2ee74110fd55e94d86321d3b3dc5bb8297424ed4 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Get rid of the unused meta type switcherLars Knoll2020-08-241-1/+0
| | | | | Change-Id: I8771feb68227bf69643b66314284c645cccdec6f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor qxmlstream_p.hLars Knoll2020-08-191-0/+2
| | | | | | | | | | Pull the file apart, so that the parts generated from qxmlstream.g are separated from the definition of the private class. This will in the future simplify maintenance and refactoring. Change-Id: I4a9c1bb1e377dee1e6d3b9aa9b0dfa64c5806c45 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Remove binary compat sources for qbytearray and qstringAllan Sandfeld Jensen2020-08-191-3/+0
| | | | | | | No longer needed in Qt6. Change-Id: I29567e175e07cc3658f0619acfd604abf64f6459 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Fix what Android plugin suffix should be passed as a defineAlexandru Croitor2020-08-171-1/+1
| | | | | | | | | | | | | | | | CMAKE_SYSTEM_PROCESSOR has the value i686 when targeting the x86 Android ABI, which is set by the Android CMake toolchain. This is not the value that Qt expects, and potentially breaks loading of Qt plugins. The same with aarch64 instead of arm64-v8a. In qmake the proper values for QT_ARCH variable are the equivalent of the ANDROID_ABI variable set by the CMake toolchain file, so use ANDROID_ABI. Task-number: QTBUG-85399 Change-Id: Ia2eaceb75168cddb2d28414f1f4bf481ec76f29e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Disentangle QIODevice dependenciesLars Knoll2020-08-151-0/+1
| | | | | | | | | | | | | | | | | Move the QIODevice::OpenMode enum into a base class, so that we can remove the full QIODevice (and thus QObject) dependency from qdatastream.h and qtextstream.h. This is required so that we can include QDataStream in qmetatype.h without getting circular dependencies. As a nice side effect, QDataStream and QTextStream can now inherit QIODeviceBase and provide the OpenMode enum directly in their class scope. Change-Id: Ifa68b7b1d8d95687ed032f6c9206f92e63bfacdf Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* CMake: Split out some Android functions into a public API fileAlexandru Croitor2020-08-141-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix CMake Qt For Android projects to configure, we need to move some functions from a private CMake API file only, to a public one. Add Qt6AndroidMacros.cmake which will be loaded by Qt6Core package. We'll have to decide how we proceed with Qt5AndroidSupport.cmake, because that file automatically runs code when included in Qt5, and we usually don't want to do it. We'll also have to decide how to handle the define_property() calls that are still left in the private QtPlatformAndroid.cmake file. With this fix, Qt example CMake projects that use add_qt_gui_executable should now be buildable. An APK can be created with 'ninja apk'. Unfortunately Qt Creator 4.13 does not currently seem to support opening and building CMake Qt For Android projects properly. While the build succeeds after fiddling with the Kit settings, the APK deploy step fails to run (at least on my machine). So the simplest way to run the built APK is to open the android-build dir with Android Studio and launch the example application from there. Task-number: QTBUG-85399 Change-Id: I77f246331de7a6e9e6d4ba7d973730190138f136 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Properly handle CONFIG += thread aka Threads::ThreadsAlexandru Croitor2020-08-061-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mkspecs/features/qt.prf adds a dependency on the system threading library if the Qt Core thread feature is enabled. Because qt.prf is loaded by any public or internal Qt project, it's essentially a public dependency for any Qt consumer. To mimic that in CMake, we check if the thread feature is enabled, and and set the Threads::Threads library as a dependency of Qt6::Platform, which is a public target used by all Qt modules and plugins and Qt consumers. We also need to create a Qt6Dependencies.cmake file so we find_package(Threads) every time find_package(Qt6) is called. For the .prl files to be usable, we have to filter out some CMake implementation specific directory separator tokens 'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call target_link_libraries() with a target created in a different scope (I think). As a result of this change, we shouldn't have to hardcode Threads::Threads in other projects, because it's now a global public dependency. Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>