Skip to content

Commit 056abc4

Browse files
committed
[统一配置与C++20升级]: 重构项目配置并启用C++20标准
- **引入公共配置文件** `common.pri`,集中管理编译选项、版本信息和公司元数据 - **移除各子项目重复配置**,如`CONFIG += c++17`和弃用警告定义,改为继承公共配置 - **升级C++标准至C++20**,要求编译器最低版本为GCC 8/Clang 10/MSVC 2019 16.10 - **优化异步日志模块**: - 使用C++20标准库的`std::binary_semaphore`替代`QMutex`+`QWaitCondition` - 改进日志文件名格式,增加应用版本号字段 - 规范枚举命名(`Orientation::StandardAndFile`) - **规范资源文件顺序**,统一将`RESOURCES`声明放在`SOURCES/HEADERS`之后 - **增强版本元数据**,统一设置应用程序厂商、版权、产品名称等基础信息 - **强制Qt最低版本要求**,通过`QT_DISABLE_DEPRECATED_BEFORE=0x060000`禁用Qt6之前废弃API
1 parent 6a953e1 commit 056abc4

File tree

37 files changed

+136
-331
lines changed

37 files changed

+136
-331
lines changed

Battery/Battery.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
batterywidget.cpp \
209
main.cpp \

Bootstrap/Bootstrap.pro

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
main.cc
139

@@ -26,10 +22,10 @@ unix:!macx{
2622
SOURCES += bootstrap_linux.cc
2723
}
2824

25+
RESOURCES += \
26+
resouce.qrc
27+
2928
# Default rules for deployment.
3029
qnx: target.path = /tmp/$${TARGET}/bin
3130
else: unix:!android: target.path = /opt/$${TARGET}/bin
3231
!isEmpty(target.path): INSTALLS += target
33-
34-
RESOURCES += \
35-
resouce.qrc

BubbleWindow/BubbleWindow.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
bubblewidget.cpp \
209
main.cpp \

Chart/Chart.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui charts
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
areachart.cpp \
209
callout.cpp \

CheckBoxStandardItem/CheckBoxStandardItem.pro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
checkboxstandarditem.cc \
139
main.cc \

Clock/Clock.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
clockwidget.cpp \
209
main.cpp \

DashBoard/DashBoard.pro

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
dashboardwidget.cpp \
209
main.cpp \

DragDrop/DragDrop.pro

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# The following define makes your compiler emit warnings if you use
8-
# any Qt feature that has been marked deprecated (the exact warnings
9-
# depend on your compiler). Please consult the documentation of the
10-
# deprecated API in order to know how to port your code away from it.
11-
DEFINES += QT_DEPRECATED_WARNINGS
12-
13-
# You can also make your code fail to compile if it uses deprecated APIs.
14-
# In order to do so, uncomment the following line.
15-
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17-
187
SOURCES += \
198
draglistwidget.cpp \
209
droplistwidget.cpp \
@@ -30,18 +19,3 @@ HEADERS += \
3019
qnx: target.path = /tmp/$${TARGET}/bin
3120
else: unix:!android: target.path = /opt/$${TARGET}/bin
3221
!isEmpty(target.path): INSTALLS += target
33-
34-
# Output directory
35-
CONFIG(debug, debug|release) {
36-
output = debug
37-
TARGET = $$TARGET
38-
}
39-
CONFIG(release, debug|release) {
40-
output = release
41-
}
42-
43-
DESTDIR = bin
44-
OBJECTS_DIR = $$output
45-
MOC_DIR = $$output
46-
RCC_DIR = $$output
47-
UI_DIR = $$output

FlowLayout/FlowLayout.pro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
flowlayout.cpp \
139
flowwidget.cc \

GridViewModel/GridViewModel.pro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
include(../common.pri)
2+
13
QT += core gui
24

35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

5-
CONFIG += c++17
6-
7-
# You can make your code fail to compile if it uses deprecated APIs.
8-
# In order to do so, uncomment the following line.
9-
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10-
117
SOURCES += \
128
gridmodel.cpp \
139
gridview.cpp \

0 commit comments

Comments
 (0)