-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
258 lines (186 loc) · 5.8 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.21.1)
set (QT_MIN_VERSION "5.4.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(PROJECT "tea-qt")
project ($PROJECT VERSION 63.1.0 LANGUAGES CXX C)
enable_language(CXX)
enable_language(C)
#find_package(Qt6 COMPONENTS Core Widgets OPTIONAL_COMPONENTS PrintSupport)
find_package(Qt6 COMPONENTS Core Widgets)
if (NOT Qt6_FOUND)
find_package(Qt5 5.15 REQUIRED COMPONENTS Core Widgets)
endif()
if (Qt6_FOUND)
message("+ Qt6 found")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#find_package(Qt6 COMPONENTS Core5Compat REQUIRED)
endif()
#qt_standard_project_setup()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
qt_add_resources(QT_RESOURCES resources.qrc)
add_definitions(-DVERSION_NUMBER="\\"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}\\"")
option(USE_NUSPELL "Use Nuspell" OFF)
option(USE_ASPELL "Use Aspell" OFF)
option(USE_HUNSPELL "Use Hunspell" ON)
option(USE_PRINTER "Use printer support" OFF)
option(USE_PDF "Use libpoppler" OFF)
option(USE_DJVU "Use djvu support" OFF)
option(USE_MAC "Build for Mac" OFF)
option(USE_SPEECH "Use Speech Dispatcher" OFF)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-DQ_OS_LINUX)
add_definitions(-DQ_OS_UNIX)
endif()
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QtWidgets_EXECUTABLE_COMPILE_FLAGS}")
file(GLOB tea_SRCS "src/*.c" "src/*.cpp")
file(GLOB tea_HEADERS "src/*.h" "src/.*hpp")
set(tea_ICONPNG32
./icons/32/tea.png
)
set(tea_ICONPNG48
./icons/48/tea.png
)
set(tea_ICONPNG64
./icons/64/tea.png
)
set(tea_ICONPNG128
./icons/128/tea.png
)
set(tea_ICONSVG
./icons/svg/tea.svg
)
set(tea_DESKTOP
./desktop/tea.desktop
)
add_custom_target(dist
COMMAND git archive --format=tar --prefix=${PROJECT}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}/ HEAD | gzip >${PROJECT}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.tar.gz
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
add_executable(tea ${tea_SRCS} ${QT_RESOURCES})
#if (USE_MAC)
#set_target_properties(tea PROPERTIES MACOSX_BUNDLE TRUE)
#endif()
set_target_properties(tea PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
find_package(PkgConfig REQUIRED)
if (Qt6_FOUND)
if(USE_NUSPELL)
pkg_check_modules(nuspell QUIET nuspell)
if(nuspell_FOUND)
add_definitions(-DNUSPELL_ENABLE)
target_link_libraries(tea ${nuspell_LIBRARIES})
include_directories(${nuspell_INCLUDE_DIRS})
message("+ nuspell support")
endif()
endif()
endif()
#end of Qt6/Nuspell
if(USE_HUNSPELL)
pkg_check_modules(hunspell QUIET hunspell)
if(hunspell_FOUND)
add_definitions(-DHUNSPELL_ENABLE)
message("+ hunspell support")
endif()
endif()
if(USE_SPEECH)
pkg_check_modules(SPEECH QUIET speech-dispatcher>=0.0.1)
if (SPEECH_FOUND)
Message ("+ speech support")
add_definitions(-DSPEECH_ENABLE)
target_include_directories(tea PUBLIC ${SPEECH_INCLUDE_DIRS})
target_link_libraries(tea ${SPEECH_LIBRARIES})
endif()
endif()
if(USE_PRINTER)
find_package(Qt6PrintSupport QUIET)
if (Qt6PrintSupport_FOUND)
Message ("+ Qt6 printer support")
add_definitions(-DPRINTER_ENABLE)
target_link_libraries(tea Qt6::PrintSupport)
else()
find_package(Qt5PrintSupport QUIET)
if (Qt5PrintSupport_FOUND)
Message ("+ Qt5 printer support")
add_definitions(-DPRINTER_ENABLE)
target_link_libraries(tea Qt5::PrintSupport)
endif()
endif()
endif()
if (EXISTS "/usr/include/linux/joystick.h")
message("+JOYSTICK_SUPPORTED")
add_definitions(-DJOYSTICK_SUPPORTED)
endif()
if(USE_ASPELL)
message("SEARCH ASPELL")
find_path(ASPELL_INCLUDES aspell.h
"/usr/include/"
"/usr/local/"
)
if(ASPELL_INCLUDES)
message("+ aspell support")
add_definitions(-DASPELL_ENABLE)
if(OS2)
target_link_libraries(tea aspell_dll.a)
else()
target_link_libraries(tea libaspell.so)
endif()
endif()
endif()
if(USE_PDF)
find_package(PkgConfig)
pkg_check_modules(popplercpp QUIET poppler-cpp)
if(popplercpp_FOUND)
add_definitions(-DPOPPLER_ENABLE)
target_link_libraries(tea ${popplercpp_LIBRARIES})
include_directories(${popplercpp_INCLUDE_DIRS})
message("+ popplercpp support")
endif()
endif()
if(USE_DJVU)
find_package(PkgConfig)
pkg_check_modules(ddjvuapi QUIET ddjvuapi)
if(ddjvuapi_FOUND)
add_definitions(-DDJVU_ENABLE)
target_link_libraries(tea ${ddjvuapi_LIBRARIES})
include_directories(${ddjvuapi_INCLUDE_DIRS})
message("+ djvuapi support")
endif()
endif()
#if(UNIX OR MINGW OR OS2)
# find_package(ZLIB REQUIRED)
#else(UNIX OR MINGW)
# set(ZLIB_INCLUDE_DIRS "${QT_ROOT}/src/3rdparty/zlib" CACHE STRING "Path to ZLIB headers of Qt")
# set(ZLIB_LIBRARIES "")
# if(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
# message("Please specify a valid zlib include dir")
# endif(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
#endif(UNIX OR MINGW OR OS2)
#if (ZLIB_FOUND)
# include_directories(${ZLIB_INCLUDE_DIRS} )
# target_link_libraries(tea ${ZLIB_LIBRARIES} )
#endif( ZLIB_FOUND )
if(hunspell_FOUND)
include_directories(${hunspell_INCLUDE_DIRS} )
target_link_libraries(tea ${hunspell_LIBRARIES} )
endif()
#if (Qt6_FOUND)
#target_link_libraries(tea Qt::Core5Compat)
#endif()
target_link_libraries(tea Qt::Widgets Qt::Core)
install (TARGETS tea DESTINATION bin)
install (FILES ${tea_ICONSVG} DESTINATION share/icons/hicolor/scalable/apps)
install (FILES ${tea_ICONPNG32} DESTINATION share/icons/hicolor/32x32/apps)
install (FILES ${tea_ICONPNG48} DESTINATION share/icons/hicolor/48x48/apps)
install (FILES ${tea_ICONPNG64} DESTINATION share/icons/hicolor/64x64/apps)
install (FILES ${tea_ICONPNG128} DESTINATION share/icons/hicolor/128x128/apps)
install (FILES ${tea_DESKTOP} DESTINATION share/applications)