-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
299 lines (265 loc) · 8.35 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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
cmake_minimum_required(VERSION 3.5)
project(uPDF2 VERSION 2.4.0 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS ui)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Sql Svg Widgets Xml)
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES /usr/local/lib ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
configure_file(src/cmake_cfg.h.in cmake_cfg.h)
include_directories(${PROJECT_BINARY_BIN})
set(PROJECT_SOURCES
src/bookmarksbrowser.cpp src/bookmarksbrowser.h
src/bookmarksdb.cpp src/bookmarksdb.h
src/bookmarkselector.cpp src/bookmarkselector.h
src/config.cpp src/config.h
src/documenteditdialog.cpp src/documenteditdialog.h
src/documentmapperdelegate.cpp src/documentmapperdelegate.h
src/documentmodel.cpp src/documentmodel.h
src/documenttab.cpp src/documenttab.h
src/entrymapperdelegate.cpp src/entrymapperdelegate.h
src/filescache.cpp src/filescache.h
src/loadpdffile.cpp src/loadpdffile.h
src/main.cpp
src/mainwindow.cpp src/mainwindow.h
src/newbookmarkdialog.cpp src/newbookmarkdialog.h
src/pagenbrdelegate.cpp src/pagenbrdelegate.h
src/pdffile.cpp src/pdffile.h
src/pdfloader.cpp src/pdfloader.h
src/pdfpageworker.cpp src/pdfpageworker.h
src/pdfviewer.cpp src/pdfviewer.h
src/preferencesdialog.cpp src/preferencesdialog.h
src/selectrecentdialog.cpp src/selectrecentdialog.h
src/updf.h
src/utils.cpp src/utils.h
ui/bookmarksbrowser.ui
ui/bookmarkselector.ui
ui/documenteditdialog.ui
ui/mainwindow.ui
ui/newbookmarkdialog.ui
ui/preferencesdialog.ui
ui/selectrecentdialog.ui
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(uPDF2
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET uPDF2 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(uPDF2 SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(uPDF2
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(uPDF2 PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Sql
Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Xml
poppler
)
target_include_directories(uPDF2 PRIVATE
/usr/include/poppler
/usr/local/include
/usr/local/include/poppler
)
set_target_properties(uPDF2 PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
set(updf_resource_files
"updf_resources/img/updf-128x128.png"
"updf_resources/img/updf-256x256.png"
"updf_resources/img/updf-48x48.png"
"updf_resources/img/updf-512x512.png"
"updf_resources/img/updf-64x64.png"
"updf_resources/svg/16x16/arrow-left.svg"
"updf_resources/svg/24x24/arrow-left.svg"
"updf_resources/svg/24x24/book.svg"
"updf_resources/svg/24x24/bookmark.svg"
"updf_resources/svg/24x24/chevron-down.svg"
"updf_resources/svg/24x24/chevron-up.svg"
"updf_resources/svg/24x24/chevrons-down.svg"
"updf_resources/svg/24x24/chevrons-up.svg"
"updf_resources/svg/24x24/file-text.svg"
"updf_resources/svg/24x24/folder.svg"
"updf_resources/svg/24x24/maximize-2.svg"
"updf_resources/svg/24x24/minimize-2.svg"
"updf_resources/svg/24x24/minus-square.svg"
"updf_resources/svg/24x24/plus-square.svg"
"updf_resources/svg/24x24/power.svg"
"updf_resources/svg/24x24/search.svg"
"updf_resources/svg/24x24/settings.svg"
"updf_resources/svg/24x24/zoom-in.svg"
"updf_resources/svg/24x24/zoom-out.svg"
)
qt_add_resources(uPDF2 "updf_icons.qrc"
PREFIX
"/icons"
BASE
"updf_resources"
FILES
${updf_resource_files}
)
set(updf1_resource_files
"updf_resources/img/busy.gif"
)
qt_add_resources(uPDF2 "updf_agif.qrc"
PREFIX
"/agif"
BASE
"updf_resources"
FILES
${updf1_resource_files}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(uPDF2)
endif()
#-------------------
if(false)
cmake_minimum_required(VERSION 3.16)
project(uPDF2 VERSION 2.3.0 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Sql Svg Widgets Xml)
qt_standard_project_setup()
qt_add_executable(uPDF2
src/bookmarksbrowser.cpp src/bookmarksbrowser.h
src/bookmarksdb.cpp src/bookmarksdb.h
src/bookmarkselector.cpp src/bookmarkselector.h
src/config.cpp src/config.h
src/documenteditdialog.cpp src/documenteditdialog.h
src/documentmapperdelegate.cpp src/documentmapperdelegate.h
src/documentmodel.cpp src/documentmodel.h
src/documenttab.cpp src/documenttab.h
src/entrymapperdelegate.cpp src/entrymapperdelegate.h
src/filescache.cpp src/filescache.h
src/loadpdffile.cpp src/loadpdffile.h
src/main.cpp
src/mainwindow.cpp src/mainwindow.h
src/newbookmarkdialog.cpp src/newbookmarkdialog.h
src/pagenbrdelegate.cpp src/pagenbrdelegate.h
src/pdffile.cpp src/pdffile.h
src/pdfloader.cpp src/pdfloader.h
src/pdfpageworker.cpp src/pdfpageworker.h
src/pdfviewer.cpp src/pdfviewer.h
src/preferencesdialog.cpp src/preferencesdialog.h
src/selectrecentdialog.cpp src/selectrecentdialog.h
src/updf.h
src/utils.cpp src/utils.h
ui/bookmarksbrowser.ui
ui/bookmarkselector.ui
ui/documenteditdialog.ui
ui/mainwindow.ui
ui/newbookmarkdialog.ui
ui/preferencesdialog.ui
ui/selectrecentdialog.ui
)
target_include_directories(uPDF2 PRIVATE
/usr/include/poppler
/usr/local/include
/usr/local/include/poppler
)
target_compile_definitions(uPDF2 PRIVATE
APP_VERSION="2.3.0"
QT_DEPRECATED_WARNINGS
)
target_link_libraries(uPDF2 PRIVATE
Qt::Core
Qt::Gui
Qt::Sql
Qt::Svg
Qt::Widgets
Qt::Xml
poppler.a
-L/usr/local/lib
)
target_compile_options(uPDF2
-Wall
-Wextra
-Wno-unused-parameter
-isystem
)
# Resources:
set(updf_resource_files
"updf_resources/img/updf-128x128.png"
"updf_resources/img/updf-256x256.png"
"updf_resources/img/updf-48x48.png"
"updf_resources/img/updf-512x512.png"
"updf_resources/img/updf-64x64.png"
"updf_resources/svg/16x16/arrow-left.svg"
"updf_resources/svg/24x24/arrow-left.svg"
"updf_resources/svg/24x24/book.svg"
"updf_resources/svg/24x24/bookmark.svg"
"updf_resources/svg/24x24/chevron-down.svg"
"updf_resources/svg/24x24/chevron-up.svg"
"updf_resources/svg/24x24/chevrons-down.svg"
"updf_resources/svg/24x24/chevrons-up.svg"
"updf_resources/svg/24x24/file-text.svg"
"updf_resources/svg/24x24/folder.svg"
"updf_resources/svg/24x24/maximize-2.svg"
"updf_resources/svg/24x24/minimize-2.svg"
"updf_resources/svg/24x24/minus-square.svg"
"updf_resources/svg/24x24/plus-square.svg"
"updf_resources/svg/24x24/power.svg"
"updf_resources/svg/24x24/search.svg"
"updf_resources/svg/24x24/settings.svg"
"updf_resources/svg/24x24/zoom-in.svg"
"updf_resources/svg/24x24/zoom-out.svg"
)
qt_add_resources(uPDF2 "updf_icons.qrc"
PREFIX
"/icons"
BASE
"updf_resources"
FILES
${updf_resource_files}
)
set(updf1_resource_files
"updf_resources/img/busy.gif"
)
qt_add_resources(uPDF2 "updf_agif.qrc"
PREFIX
"/agif"
BASE
"updf_resources"
FILES
${updf1_resource_files}
)
if((QT_VERSION_MAJOR GREATER 4))
target_link_libraries(uPDF2 PRIVATE
Qt::Widgets
)
endif()
install(TARGETS uPDF2
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
qt_generate_deploy_app_script(
TARGET uPDF2
FILENAME_VARIABLE deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
endif()