forked from rodlie/qtfm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
264 lines (247 loc) · 6.51 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
cmake_minimum_required(VERSION 3.0)
include(GNUInstallDirs)
project(qtfm VERSION 6.3.0)
#set(PROJECT_VERSION_EXTRA _alpha)
add_definitions(-DAPP="${PROJECT_NAME}")
add_definitions(-DAPP_NAME="QtFM")
add_definitions(-DAPP_VERSION="${PROJECT_VERSION}${PROJECT_VERSION_EXTRA}")
#set(CMAKE_CXX_STANDARD 11)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
include_directories(${CMAKE_BINARY_DIR})
if(CMAKE_BUILD_TYPE MATCHES "^(release|Release|RELEASE)$")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
else()
message("-- DEBUG BUILD")
endif()
add_compile_options(-Wall -Wextra)
# configure
set(ENABLE_MAGICK true CACHE BOOL "Enable support for ImageMagick")
set(ENABLE_FFMPEG true CACHE BOOL "Enable support for FFmpeg v3")
set(ENABLE_DBUS true CACHE BOOL "Enable support for D-Bus")
set(ENABLE_UDISKS true CACHE BOOL "Enable support for udisks")
set(ENABLE_TRAY true CACHE BOOL "Enable support for qtfm-tray")
# magick
if(ENABLE_MAGICK)
add_definitions(-DWITH_MAGICK)
find_package(PkgConfig REQUIRED)
pkg_check_modules(MAGICK REQUIRED Magick++)
# ffmpeg
if(ENABLE_FFMPEG)
pkg_check_modules(AVDEVICE REQUIRED libavdevice)
pkg_check_modules(SWSCALE REQUIRED libswscale)
pkg_check_modules(AVFORMAT REQUIRED libavformat)
pkg_check_modules(AVCODEC REQUIRED libavcodec)
pkg_check_modules(AVUTIL REQUIRED libavutil)
add_definitions(-DWITH_FFMPEG)
endif()
endif()
# dbus
if(NOT ENABLE_DBUS)
add_definitions(-DNO_DBUS -DNO_UDISKS)
endif()
if(NOT ENABLE_UDISKS AND ENABLE_DBUS)
add_definitions(-DNO_UDISKS)
endif()
# qt
find_package(Qt5Core REQUIRED)
if(ENABLE_DBUS)
find_package(Qt5DBus REQUIRED)
endif()
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Concurrent REQUIRED)
# inotify
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules(NOTIFY REQUIRED libinotify)
endif()
# libfm
if(ENABLE_DBUS)
add_library(
QtFMBus
STATIC
libfm/disks.cpp
libfm/service.h
libfm/udisks2.cpp
)
target_link_libraries(QtFMBus Qt5::DBus)
target_include_directories(QtFMBus PRIVATE libfm)
endif()
add_library(
QtFM
SHARED
libfm/applicationdialog.cpp
libfm/bookmarkmodel.cpp
libfm/common.cpp
libfm/completer.cpp
libfm/customactionsmanager.cpp
libfm/desktopfile.cpp
libfm/fileutils.cpp
libfm/fm.cpp
libfm/icondlg.cpp
libfm/iconlist.cpp
libfm/iconview.cpp
libfm/mimeutils.cpp
libfm/mymodel.cpp
libfm/mymodelitem.cpp
libfm/processdialog.cpp
libfm/properties.cpp
libfm/propertiesdlg.cpp
libfm/sortmodel.cpp
libfm/dfmqtreeview.cpp
libfm/dfmqstyleditemdelegate.cpp
libfm/qtcopydialog/qtcopydialog.cpp
libfm/qtcopydialog/qtfilecopier.cpp
libfm/qtcopydialog/qtcopydialog.ui
libfm/qtcopydialog/qtotherdialog.ui
libfm/qtcopydialog/qtoverwritedialog.ui
)
set_target_properties(
QtFM
PROPERTIES
VERSION
${PROJECT_VERSION}
)
set_target_properties(
QtFM
PROPERTIES
SOVERSION
${PROJECT_VERSION_MAJOR}
)
if(ENABLE_MAGICK)
string(REGEX MATCH "\\-DMAGICKCORE_HDRI_ENABLE=[^ $]" MAGICK_HDRI ${MAGICK_CFLAGS})
add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16)
add_definitions(${MAGICK_HDRI})
target_include_directories(QtFM PRIVATE ${MAGICK_INCLUDE_DIRS})
target_link_libraries(QtFM ${MAGICK_LIBRARIES})
if(ENABLE_FFMPEG)
target_include_directories(QtFM PRIVATE ${AVUTIL_INCLUDEDIR})
target_link_libraries(QtFM
${AVDEVICE_LIBRARIES}
${SWSCALE_LIBRARIES}
${AVFORMAT_LIBRARIES}
${AVCODEC_LIBRARIES}
${AVUTIL_LIBRARIES})
endif()
endif()
target_include_directories(QtFM PRIVATE libfm libfm/qtcopydialog ${NOTIFY_INCLUDEDIR})
target_link_libraries(
QtFM
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Concurrent
)
if(ENABLE_DBUS)
target_link_libraries(QtFM Qt5::DBus QtFMBus)
endif()
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
target_link_libraries(QtFM ${NOTIFY_LIBRARIES})
endif()
if(APPLE)
target_link_libraries(QtFM -framework CoreFoundation -framework CoreServices)
endif()
# qtfm
add_executable(
${PROJECT_NAME}
fm/src/main.cpp
fm/src/mainwindow.cpp
fm/src/bookmarks.cpp
fm/src/tabbar.cpp
fm/src/settingsdialog.cpp
fm/src/actiondefs.cpp
fm/src/actiontriggers.cpp
share/${PROJECT_NAME}.qrc
)
target_link_libraries(
${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Concurrent
QtFM
)
target_include_directories(${PROJECT_NAME} PRIVATE fm/src libfm libfm/qtcopydialog)
if(ENABLE_DBUS)
target_link_libraries(${PROJECT_NAME} Qt5::DBus)
endif()
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
target_link_libraries(${PROJECT_NAME} ${NOTIFY_LIBRARIES})
endif()
if(APPLE)
target_link_libraries(${PROJECT_NAME} -framework CoreFoundation -framework CoreServices)
endif()
# qtfm-tray
if(ENABLE_DBUS AND ENABLE_TRAY)
add_executable(${PROJECT_NAME}-tray tray/main.cpp tray/systray.cpp tray/tray.qrc)
target_include_directories(${PROJECT_NAME}-tray PRIVATE tray libfm)
target_link_libraries(${PROJECT_NAME}-tray Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus QtFM)
endif()
# docs
install(
FILES
LICENSE
AUTHORS
ChangeLog
README.md
DESTINATION
${CMAKE_INSTALL_DOCDIR}/${PROJECT_NAME}-${PROJECT_VERSION}${PROJECT_VERSION_EXTRA}
)
# etc
set(DEFAULT_SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(DEFAULT_SYSCONFDIR "/etc")
endif()
# libdir
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
else()
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR})
endif()
# install
install(
TARGETS
QtFM
DESTINATION
${LIB_INSTALL_DIR}
)
install(
TARGETS
${PROJECT_NAME}
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
install(
FILES
fm/${PROJECT_NAME}.1
DESTINATION
${CMAKE_INSTALL_MANDIR}/man1
)
install(
FILES
fm/${PROJECT_NAME}.desktop
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/applications
)
install(
DIRECTORY
share/hicolor
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/icons
)
if(ENABLE_DBUS AND ENABLE_TRAY)
install(
TARGETS
${PROJECT_NAME}-tray
DESTINATION
${CMAKE_INSTALL_BINDIR}
)
install(
FILES
tray/${PROJECT_NAME}-tray.1
DESTINATION
${CMAKE_INSTALL_MANDIR}/man1
)
endif()