1 From 55d08df3c15818e238a44dc93aa92b0befad36fa Mon Sep 17 00:00:00 2001
2 From: Iru Cai <mytbk920423@gmail.com>
3 Date: Tue, 11 Aug 2020 12:43:52 +0800
4 Subject: [PATCH] drop Qt4 support
7 CMakeLists.txt | 53 +++++++------------------------
8 CMakeLists.txt.linux | 28 +++++-----------
10 src/common/CMakeLists.txt | 21 +++---------
11 src/fqterm/CMakeLists.txt | 47 +++++++++++----------------
12 src/protocol/CMakeLists.txt | 11 ++-----
13 src/terminal/CMakeLists.txt | 11 +++----
14 src/ui/CMakeLists.txt | 16 +---------
15 src/ui/imageviewer/CMakeLists.txt | 4 +--
16 src/utilities/CMakeLists.txt | 11 +++----
17 10 files changed, 57 insertions(+), 150 deletions(-)
19 diff --git a/CMakeLists.txt b/CMakeLists.txt
20 index 5bc5f61..5dda9e7 100644
23 @@ -22,30 +22,17 @@ ELSE(MCGGIT_WC_REVISION MATCHES "NOTFOUND")
24 message("Git revision: " ${MCGGIT_WC_REVISION})
25 ENDIF(MCGGIT_WC_REVISION MATCHES "NOTFOUND")
27 -SET(USE_QT5 OFF CACHE PATH "Do the Qt5 build")
30 - set(CMAKE_INCLUDE_CURRENT_DIR ON)
31 - set(CMAKE_AUTOMOC ON)
32 - find_package(Qt5Core REQUIRED)
33 - find_package(Qt5Widgets REQUIRED)
34 - find_package(Qt5LinguistTools REQUIRED)
35 - qt5_add_translation(fqterm_qm_files
36 - ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
37 - ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
38 - ${CMAKE_SOURCE_DIR}/res/dict/protocol_zh_CN.ts
39 - ${CMAKE_SOURCE_DIR}/res/dict/common_zh_CN.ts
42 - find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork QtScript QtXml REQUIRED)
43 - include(${QT_USE_FILE})
44 - qt4_add_translation(fqterm_qm_files
45 - ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
46 - ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
47 - ${CMAKE_SOURCE_DIR}/res/dict/protocol_zh_CN.ts
48 - ${CMAKE_SOURCE_DIR}/res/dict/common_zh_CN.ts
51 +set(CMAKE_INCLUDE_CURRENT_DIR ON)
52 +set(CMAKE_AUTOMOC ON)
53 +find_package(Qt5Core REQUIRED)
54 +find_package(Qt5Widgets REQUIRED)
55 +find_package(Qt5LinguistTools REQUIRED)
56 +qt5_add_translation(fqterm_qm_files
57 + ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
58 + ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
59 + ${CMAKE_SOURCE_DIR}/res/dict/protocol_zh_CN.ts
60 + ${CMAKE_SOURCE_DIR}/res/dict/common_zh_CN.ts
63 add_custom_target(fqterm_qm_target
64 DEPENDS ${fqterm_qm_files}
65 @@ -59,24 +46,6 @@ else (PYTHONLIBS_FOUND)
67 endif (PYTHONLIBS_FOUND)
71 - FILE(READ ${QT_LIBRARY_DIR}/QtCore.prl FQ_CORE_QT_CONFIG)
74 - FILE(READ ${QT_LIBRARY_DIR}/QtCore.framework/QtCore.prl FQ_CORE_QT_CONFIG)
76 - FILE(READ ${QT_LIBRARY_DIR}/libQtCore.prl FQ_CORE_QT_CONFIG)
80 - IF(NOT FQ_CORE_QT_CONFIG MATCHES "static")
81 - SET(FQTERM_USE_STATIC_QT false)
82 - ELSE(NOT FQ_CORE_QT_CONFIG MATCHES "static")
83 - SET(FQTERM_USE_STATIC_QT true)
84 - ENDIF(NOT FQ_CORE_QT_CONFIG MATCHES "static")
87 SET(SUB_CMAKELIST "UNKNOWN")
89 ADD_DEFINITIONS(-D "FQTERM_VERSION_STRING=\\\"${FQTERM_VERSION}\\\"")
90 diff --git a/CMakeLists.txt.linux b/CMakeLists.txt.linux
91 index ea457f5..1c890d5 100644
92 --- a/CMakeLists.txt.linux
93 +++ b/CMakeLists.txt.linux
94 @@ -32,23 +32,13 @@ IF (WITH_ASAN)
95 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
99 - find_package(Qt5Core REQUIRED)
100 - find_package(Qt5Widgets REQUIRED)
101 - find_package(Qt5Network REQUIRED)
102 - find_package(Qt5Script REQUIRED)
103 - find_package(Qt5Multimedia REQUIRED)
104 - find_package(Qt5Xml REQUIRED)
109 - include_directories(
111 - ${QT_QTCORE_INCLUDE_DIR}
112 - ${QT_QTGUI_INCLUDE_DIR}
115 +find_package(Qt5Core REQUIRED)
116 +find_package(Qt5Widgets REQUIRED)
117 +find_package(Qt5Network REQUIRED)
118 +find_package(Qt5Script REQUIRED)
119 +find_package(Qt5Multimedia REQUIRED)
120 +find_package(Qt5Xml REQUIRED)
123 ${CMAKE_CURRENT_SOURCE_DIR}/src/common
124 ${CMAKE_CURRENT_SOURCE_DIR}/src/protocol
125 @@ -89,9 +79,7 @@ target_link_libraries(fqterm.bin
130 - target_link_libraries(fqterm.bin Qt5::Core Qt5::Widgets)
132 +target_link_libraries(fqterm.bin Qt5::Core Qt5::Widgets)
134 add_dependencies(fqterm.bin
136 diff --git a/README.md b/README.md
137 index f8cb574..5fd7455 100644
140 @@ -33,21 +33,20 @@ git clone https://github.com/mytbk/fqterm.git
141 # 假设FQTerm源码目录为fqterm
144 -# 用cmake生成Makefile,默认为Qt4版本,Qt5版本请添加-DUSE_QT5=1参数
147 # 以root身份安装,以下用sudo获取root权限
151 -在 macOS (Sierra) 中编译建议使用 Qt5 分支,利用 HomeBrew 安装依赖。目前支持并不完善。
152 +在 macOS (Sierra) 中编译,利用 HomeBrew 安装依赖。目前支持并不完善。
154 brew install openssl qt5
157 CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake \
158 OPENSSL_ROOT_DIR=/usr/local/opt/openssl \
159 -cmake ../fqterm -DUSE_QT5=1
164 diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
165 index cc4a354..2f4f14e 100644
166 --- a/src/common/CMakeLists.txt
167 +++ b/src/common/CMakeLists.txt
168 @@ -24,24 +24,13 @@ set(fqterm_common_SRCS
169 fqterm_shortcuthelper.cpp
173 - set(CMAKE_INCLUDE_CURRENT_DIR ON)
174 - find_package(Qt5Core REQUIRED)
175 - find_package(Qt5Widgets REQUIRED)
176 - find_package(Qt5Multimedia REQUIRED)
178 - include_directories(
180 - ${QT_QTCORE_INCLUDE_DIR}
181 - ${QT_QTGUI_INCLUDE_DIR}
182 - ${CMAKE_CURRENT_BINARY_DIR}
185 +set(CMAKE_INCLUDE_CURRENT_DIR ON)
186 +find_package(Qt5Core REQUIRED)
187 +find_package(Qt5Widgets REQUIRED)
188 +find_package(Qt5Multimedia REQUIRED)
190 add_library(fqterm_common
191 ${fqterm_common_SRCS}
195 - target_link_libraries(fqterm_common Qt5::Core Qt5::Widgets Qt5::Multimedia)
197 +target_link_libraries(fqterm_common Qt5::Core Qt5::Widgets Qt5::Multimedia)
198 diff --git a/src/fqterm/CMakeLists.txt b/src/fqterm/CMakeLists.txt
199 index 80bc734..72f9fa7 100644
200 --- a/src/fqterm/CMakeLists.txt
201 +++ b/src/fqterm/CMakeLists.txt
202 @@ -28,10 +28,8 @@ ELSE(WIN32)
203 set(global_shortcut_impl_SRCS 3rdparty/qxtglobalshortcut_mac.cpp)
205 set(global_shortcut_impl_SRCS 3rdparty/qxtglobalshortcut_x11.cpp)
207 - find_package(Qt5X11Extras REQUIRED)
208 - set(QXTLIB Qt5::X11Extras)
210 + find_package(Qt5X11Extras REQUIRED)
211 + set(QXTLIB Qt5::X11Extras)
214 set(GLOBAL_SHORTCUT_SRC
215 @@ -53,22 +51,15 @@ set(3rdparty_SRCS
216 ${GLOBAL_SHORTCUT_SRC}
220 - find_package(Qt5Core REQUIRED)
221 - find_package(Qt5Widgets REQUIRED)
222 - find_package(Qt5Network REQUIRED)
223 - find_package(Qt5Script REQUIRED)
224 +find_package(Qt5Core REQUIRED)
225 +find_package(Qt5Widgets REQUIRED)
226 +find_package(Qt5Network REQUIRED)
227 +find_package(Qt5Script REQUIRED)
229 - qt5_create_translation(fqterm_qm_file
231 - ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
234 - qt4_create_translation(fqterm_qm_file
236 - ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
239 +qt5_create_translation(fqterm_qm_file
241 + ${CMAKE_SOURCE_DIR}/res/dict/fqterm_zh_CN.ts
246 @@ -100,13 +91,11 @@ add_dependencies(fqterm_main
251 - target_link_libraries(
260 +target_link_libraries(
268 diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt
269 index 0b505af..ddd7707 100644
270 --- a/src/protocol/CMakeLists.txt
271 +++ b/src/protocol/CMakeLists.txt
272 @@ -52,11 +52,8 @@ set(internal_SRCS
273 internal/fqterm_ssh_channel.cpp
277 - find_package(Qt5Core REQUIRED)
278 - find_package(Qt5Network REQUIRED)
281 +find_package(Qt5Core REQUIRED)
282 +find_package(Qt5Network REQUIRED)
286 @@ -77,6 +74,4 @@ add_dependencies(fqterm_protocol
291 - target_link_libraries(fqterm_protocol Qt5::Core Qt5::Network)
293 +target_link_libraries(fqterm_protocol Qt5::Core Qt5::Network)
294 diff --git a/src/terminal/CMakeLists.txt b/src/terminal/CMakeLists.txt
295 index 5abe2c6..26deb8b 100644
296 --- a/src/terminal/CMakeLists.txt
297 +++ b/src/terminal/CMakeLists.txt
298 @@ -42,10 +42,7 @@ add_dependencies(fqterm_terminal
303 - find_package(Qt5Core REQUIRED)
304 - find_package(Qt5Network REQUIRED)
305 - find_package(Qt5Widgets REQUIRED)
306 - target_link_libraries(fqterm_terminal Qt5::Core Qt5::Widgets Qt5::Network)
309 +find_package(Qt5Core REQUIRED)
310 +find_package(Qt5Network REQUIRED)
311 +find_package(Qt5Widgets REQUIRED)
312 +target_link_libraries(fqterm_terminal Qt5::Core Qt5::Widgets Qt5::Network)
313 diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
314 index c42c262..e5c9a07 100644
315 --- a/src/ui/CMakeLists.txt
316 +++ b/src/ui/CMakeLists.txt
317 @@ -85,7 +85,6 @@ set(fqterm_ui_UIS
322 qt5_wrap_ui(fqterm_ui_UIS_H
325 @@ -99,17 +98,6 @@ qt5_create_translation(fqterm_ui_qm_file
327 ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
330 -qt4_wrap_ui(fqterm_ui_UIS_H
334 -qt4_create_translation(fqterm_ui_qm_file
337 - ${CMAKE_SOURCE_DIR}/res/dict/ui_zh_CN.ts
343 @@ -134,6 +122,4 @@ IF(NOT MCGGIT_WC_REVISION MATCHES "NOTFOUND")
344 ADD_DEFINITIONS(-D "FQTERM_GIT_REVISION=\\\"${MCGGIT_WC_REVISION}\\\"")
345 ENDIF(NOT MCGGIT_WC_REVISION MATCHES "NOTFOUND")
348 - target_link_libraries(fqterm_ui Qt5::Core Qt5::Widgets)
350 +target_link_libraries(fqterm_ui Qt5::Core Qt5::Widgets)
351 diff --git a/src/ui/imageviewer/CMakeLists.txt b/src/ui/imageviewer/CMakeLists.txt
352 index d8cf46a..54f087c 100644
353 --- a/src/ui/imageviewer/CMakeLists.txt
354 +++ b/src/ui/imageviewer/CMakeLists.txt
355 @@ -31,6 +31,4 @@ include_directories(
356 add_library(fqterm_imageviewer
357 ${fqterm_imageviewer_SRCS})
360 - target_link_libraries(fqterm_imageviewer Qt5::Core Qt5::Widgets)
362 +target_link_libraries(fqterm_imageviewer Qt5::Core Qt5::Widgets)
363 diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt
364 index 8470516..a657b18 100644
365 --- a/src/utilities/CMakeLists.txt
366 +++ b/src/utilities/CMakeLists.txt
367 @@ -28,10 +28,7 @@ add_dependencies(fqterm_utilities
372 - find_package(Qt5Core REQUIRED)
373 - find_package(Qt5Widgets REQUIRED)
374 - find_package(Qt5Network REQUIRED)
375 - target_link_libraries(fqterm_utilities Qt5::Core Qt5::Widgets Qt5::Network)
378 +find_package(Qt5Core REQUIRED)
379 +find_package(Qt5Widgets REQUIRED)
380 +find_package(Qt5Network REQUIRED)
381 +target_link_libraries(fqterm_utilities Qt5::Core Qt5::Widgets Qt5::Network)