Skip to content

Commit 97f58d1

Browse files
LiHua000deepin-bot[bot]
authored andcommitted
Fix Qt5 build: disable compatible mode
QThreadPool::start doesn't support lambda in Qt5. Log: as title
1 parent 2803520 commit 97f58d1

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/deb-installer/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ configure_file(${APP_RES_DIR}/environments.h.in environments.h @ONLY)
118118

119119
add_definitions(-DUSE_POLKIT -DENABLE_INACTIVE_DISPLAY)
120120

121+
# Qt5环境不支持兼容模式(QThreadPool::start不支持lambda)
122+
if (NOT QT_DESIRED_VERSION MATCHES 6)
123+
add_definitions(-DDISABLE_COMPATIBLE)
124+
message(STATUS "Qt5 environment detected, disabling compatible mode")
125+
endif()
126+
121127
# Find the library
122128
find_package(PkgConfig REQUIRED)
123129

src/deb-installer/compatible/compatible_backend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ void CompatibleBackend::packageRemoved(const CompPkgInfo::Ptr &removePtr)
126126
qCDebug(appLog) << "Removing package from list:" << removePtr->name << removePtr->version;
127127
}
128128

129+
#ifndef DISABLE_COMPATIBLE
129130
bool CompatibleBackend::supportAppCheck() const
130131
{
131132
return true;
@@ -222,6 +223,7 @@ bool CompatibleBackend::checkPackageSupportRootfs(const CompPkgInfo::Ptr &checkP
222223
qCDebug(appLog) << "Check package support rootfs finished, return true";
223224
return true;
224225
}
226+
#endif
225227

226228
QList<RootfsInfo::Ptr> CompatibleBackend::parseRootfsFromRawOutputV1(const QByteArray &output)
227229
{

src/deb-installer/compatible/compatible_backend.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ class CompatibleBackend : public QObject
5757
void packageRemoved(const CompPkgInfo::Ptr &removePtr);
5858

5959
// use app check support rootfs with special package
60+
#ifdef DISABLE_COMPATIBLE
61+
[[nodiscard]] bool supportAppCheck() const { return false; }
62+
[[nodiscard]] bool checkPackageSupportRootfs(const CompPkgInfo::Ptr &checkPtr) { Q_UNUSED(checkPtr); return false; }
63+
#else
6064
[[nodiscard]] bool supportAppCheck() const;
6165
[[nodiscard]] bool checkPackageSupportRootfs(const CompPkgInfo::Ptr &checkPtr);
66+
#endif
6267
Q_SIGNAL void packageSupportRootfsChanged(const CompPkgInfo::Ptr &checkPtr);
6368

6469
private:

tests/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ configure_file(${APP_RES_DIR}/environments.h.in environments.h @ONLY)
7979

8080
add_definitions(-DUSE_POLKIT -DENABLE_INACTIVE_DISPLAY)
8181

82+
# Qt5环境不支持兼容模式(QThreadPool::start不支持lambda)
83+
if (NOT QT_DESIRED_VERSION MATCHES 6)
84+
add_definitions(-DDISABLE_COMPATIBLE)
85+
message(STATUS "Qt5 environment detected, disabling compatible mode in tests")
86+
endif()
87+
8288
# Find the library
8389
find_package(PkgConfig REQUIRED)
8490

0 commit comments

Comments
 (0)