From 10c4a4b4bdfdd468e52ae0fbbf84c77b64df2f8f Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 3 Dec 2021 22:33:28 +0200 Subject: WIP: Change the build system to enable building with Qt 6 This was built with: -DQT_MAJOR_VERSION=6 \ -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.90.0 \ -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055a00 Move the include(KDEInstallDirs) call before the first find_package(Qt*, the former is what auto-detects the Qt version, and defaults to 5. This is needed to be able to build against Qt5 by default. All unit tests still pass. --- autotests/kconfigtest.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'autotests/kconfigtest.cpp') diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp index 4657ea8d..95a87584 100644 --- a/autotests/kconfigtest.cpp +++ b/autotests/kconfigtest.cpp @@ -1974,18 +1974,30 @@ void KConfigTest::testXdgListEntry() void KConfigTest::testThreads() { QThreadPool::globalInstance()->setMaxThreadCount(6); - QList> futures; // Run in parallel some tests that work on different config files, // otherwise unexpected things might indeed happen. - futures << QtConcurrent::run(this, &KConfigTest::testAddConfigSources); - futures << QtConcurrent::run(this, &KConfigTest::testSimple); - futures << QtConcurrent::run(this, &KConfigTest::testDefaults); - futures << QtConcurrent::run(this, &KConfigTest::testSharedConfig); - futures << QtConcurrent::run(this, &KConfigTest::testSharedConfig); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const QList> futures = { + QtConcurrent::run(&KConfigTest::testAddConfigSources, this), + QtConcurrent::run(&KConfigTest::testSimple, this), + QtConcurrent::run(&KConfigTest::testDefaults, this), + QtConcurrent::run(&KConfigTest::testSharedConfig, this), + QtConcurrent::run(&KConfigTest::testSharedConfig, this), + }; +#else + const QList> futures = { + QtConcurrent::run(this, &KConfigTest::testAddConfigSources), + QtConcurrent::run(this, &KConfigTest::testSimple), + QtConcurrent::run(this, &KConfigTest::testDefaults), + QtConcurrent::run(this, &KConfigTest::testSharedConfig), + QtConcurrent::run(this, &KConfigTest::testSharedConfig), + }; +#endif + // QEXPECT_FAIL triggers race conditions, it should be fixed to use QThreadStorage... // futures << QtConcurrent::run(this, &KConfigTest::testDeleteWhenLocalized); // futures << QtConcurrent::run(this, &KConfigTest::testEntryMap); - for (QFuture f : std::as_const(futures)) { + for (QFuture f : futures) { f.waitForFinished(); } } -- cgit v1.2.1