1
cmake_minimum_required(VERSION 2.6)
2
3
find_package(Qt4 4.4.0 COMPONENTS QtCore QtGui QtNetwork QtXml QtXmlPatterns REQUIRED QtDBus)
4
5
SET (QT_USE_QTNETWORK TRUE)
6
SET (QT_USE_QTXMLPATTERNS TRUE)
7
SET (QT_USE_QTXML TRUE)
8
9
if(NOT DEFINED VERSION)
10
	find_program (GIT_CMD git)
11
	execute_process (COMMAND "${GIT_CMD}" describe
12
		OUTPUT_VARIABLE VERSION
13
		OUTPUT_STRIP_TRAILING_WHITESPACE
14
		)
15
	if(NOT VERSION)
16
		set(VERSION 1.1.2)
17
	endif()
18
	message (STATUS "Current version: ${VERSION}")
19
endif()
20
21
set(NAMEVER "QMPDClient ${VERSION}")
22
23
set(QMPDClient_srcs
24
	src/aafilter.cpp
25
	src/aboutdialog.cpp
26
	src/abstractmodel.cpp
27
	src/abstractview.cpp
28
	src/albumview.cpp
29
	src/artistview.cpp
30
	src/clickablelabel.cpp
31
	src/config.cpp
32
	src/controlpanel.cpp
33
	src/coverartdialog.cpp
34
	src/directorymodel.cpp
35
	src/directorypanel.cpp
36
	src/directoryview.cpp
37
	src/dynamicplaylist.cpp
38
	src/fileview.cpp
39
	src/headerview.cpp
40
	src/iconmanager.cpp
41
	src/idealbar.cpp
42
	src/idealsplitter.cpp
43
	src/jumptosongdialog.cpp
44
	src/lastfmsubmitter.cpp
45
	src/libmpdclient.c
46
	src/librarypanel.cpp
47
	src/lineedit.cpp
48
	src/lyricsdialog.cpp
49
	src/mainwindow.cpp
50
	src/metainfodialog.cpp
51
	src/mpdcache.cpp
52
	src/mpdconnection.cpp
53
	src/mpd.cpp
54
	src/mpddirectory.cpp
55
	src/mpdentities.cpp
56
	src/mpdoutput.cpp
57
	src/mpdsong.cpp
58
	src/mpdsonglist.cpp
59
	src/mpdsongmodel.cpp
60
	src/mpdsongview.cpp
61
	src/mpdstats.cpp
62
	src/mpdstatus.cpp
63
	src/notifications.cpp
64
	src/passivepopup.cpp
65
	src/pausabletimer.cpp
66
	src/playlistitemdelegate.cpp
67
	src/playlistmodel.cpp
68
	src/playlistpanel.cpp
69
	src/playlistspanel.cpp
70
	src/playlistsview.cpp
71
	src/playlistview.cpp
72
	src/plconview.cpp
73
	src/plsfile.cpp
74
	src/preferencesdialog.cpp
75
	src/qmpdclient.cpp
76
	src/radiopanel.cpp
77
	src/radioview.cpp
78
	src/reconnect.cpp
79
	src/serverinfo.cpp
80
	src/servermodel.cpp
81
	src/shortcutmodel.cpp
82
	src/shortcuts.cpp
83
	src/shoutcastmodel.cpp
84
	src/shoutcastpanel.cpp
85
	src/shoutcastview.cpp
86
	src/shoutcastfetcher.cpp
87
	src/shoutcaststation.cpp
88
	src/songview.cpp
89
	src/stringlistmodel.cpp
90
	src/stringlistview.cpp
91
	src/tagguesser.cpp
92
	src/tagmodel.cpp
93
	src/timelabel.cpp
94
	src/timeslider.cpp
95
	src/trayicon.cpp
96
	src/traysonginfo.cpp
97
	src/verticalbutton.cpp)
98
99
# 	src/qmpdclient_mac.cpp
100
# 	src/qmpdclient_win.cpp
101
# 	src/qmpdclient_x11.cpp
102
# 	src/notifications_dbus.cpp
103
# 	src/notifications_nodbus.cpp
104
105
set(QMPDClient_hdrs
106
	src/aafilter.h
107
	src/aboutdialog.h
108
	src/abstractmodel.h
109
	src/abstractview_defn.h
110
	src/abstractview.h
111
	src/abstractview_impl.h
112
	src/albumview.h
113
	src/artistview.h
114
	src/clickablelabel.h
115
	src/config.h
116
	src/controlpanel.h
117
	src/coverartdialog.h
118
	src/debug.h
119
	src/directorymodel.h
120
	src/directorypanel.h
121
	src/directoryview.h
122
	src/dynamicplaylist.h
123
	src/fileview.h
124
	src/headerview.h
125
	src/iconmanager.h
126
	src/idealbar.h
127
	src/idealsplitter.h
128
	src/jumptosongdialog.h
129
	src/lastfmsubmitter.h
130
	src/libmpdclient.h
131
	src/librarypanel.h
132
	src/lineedit.h
133
	src/lyricsdialog.h
134
	src/macroexpander.h
135
	src/mainwindow.h
136
	src/metainfodialog.h
137
	src/mpdcache.h
138
	src/mpdcache_p.h
139
	src/mpdconnection.h
140
	src/mpddirectory.h
141
	src/mpdentities.h
142
	src/mpd.h
143
	src/mpdoutput.h
144
	src/mpd_p.h
145
	src/mpdsong.h
146
	src/mpdsonglist.h
147
	src/mpdsongmodel.h
148
	src/mpdsongview.h
149
	src/mpdstats.h
150
	src/mpdstatus.h
151
	src/notifications.h
152
	src/passivepopup.h
153
	src/pausabletimer.h
154
	src/playlistitemdelegate.h
155
	src/playlistmodel.h
156
	src/playlistpanel.h
157
	src/playlistspanel.h
158
	src/playlistsview.h
159
	src/playlistview.h
160
	src/plconview.h
161
	src/plsfile.h
162
	src/preferencesdialog.h
163
	src/qmpdclient.h
164
	src/radiopanel.h
165
	src/radioview.h
166
	src/reconnect.h
167
	src/richtext.h
168
	src/serverinfo.h
169
	src/servermodel.h
170
	src/shortcutmodel.h
171
	src/shortcuts.h
172
	src/shoutcastpanel.h
173
	src/shoutcastview.h
174
	src/shoutcastmodel.h
175
	src/shoutcastfetcher.h
176
	src/shoutcaststation.h
177
	src/songview.h
178
	src/stringlistmodel.h
179
	src/stringlistview.h
180
	src/tagguesser.h
181
	src/tagmodel.h
182
	src/timelabel.h
183
	src/timeslider.h
184
	src/trayicon.h
185
	src/traysonginfo.h
186
	src/verticalbutton.h)
187
188
SET(QMPDClient_uis
189
	ui/aboutdialog.ui
190
	ui/addradiodialog.ui
191
	ui/controlpanel.ui
192
	ui/coverartdialog.ui
193
	ui/directorypanel.ui
194
	ui/jumptosongdialog.ui
195
	ui/librarypanel.ui
196
	ui/lyricsdialog.ui
197
	ui/mainwindow.ui
198
	ui/metainfodialog.ui
199
	ui/playlistpanel.ui
200
	ui/playlistspanel.ui
201
	ui/preferencesdialog.ui
202
	ui/radiopanel.ui
203
	ui/shoutcastpanel.ui)
204
205
if(UNIX)
206
	if(NOT MAC)
207
		if(QT_QTDBUS_FOUND)
208
			message(STATUS "QtDBus found")
209
			SET (QT_USE_QTDBUS TRUE)
210
			list(APPEND QMPDClient_srcs src/notifications_dbus.cpp)
211
			list(APPEND QMPDClient_srcs src/qdbus_adaptor.cpp)
212
			list(APPEND QMPDClient_hdrs src/qdbus_adaptor.h)
213
			add_definitions("-DWITH_DBUS")
214
		else()
215
			message(STATUS "QtDBus not found")
216
			list(APPEND QMPDClient_srcs src/notifications_nodbus.cpp)
217
		endif()
218
		list(APPEND QMPDClient_srcs src/qmpdclient_x11.cpp)
219
	else()
220
		list(APPEND QMPDClient_srcs src/notifications_nodbus.cpp
221
			src/qmpdclient_mac.cpp)
222
	endif()
223
endif()
224
225
if(WIN32)
226
	list(APPEND QMPDClient_srcs src/notifications_nodbus.cpp
227
			src/qmpdclient_win.cpp)
228
endif()
229
230
include(${QT_USE_FILE})
231
qt4_wrap_cpp(QMPDClient_ppd_hdrs ${QMPDClient_hdrs})
232
qt4_add_resources(QMPDClient_ppd_res qmpdclient.qrc)
233
qt4_wrap_ui(QMPDClient_ppd_uis ${QMPDClient_uis})
234
include_directories (${CMAKE_CURRENT_BINARY_DIR}
235
	src)
236
237
SET (TRANSLATIONS
238
	lang/cs_CZ.ts
239
	lang/de_DE.ts
240
	lang/fr_FR.ts
241
	lang/it_IT.ts
242
	lang/nl_NL.ts
243
	lang/nn_NO.ts
244
	lang/no_NO.ts
245
	lang/pt_BR.ts
246
	lang/ru_RU.ts
247
	lang/sv_SE.ts
248
	lang/tr_TR.ts
249
	lang/uk_UA.ts
250
	lang/zh_CN.ts
251
	lang/zh_TW.ts)
252
253
SET (COMPILED_TRANSLATIONS
254
	lang/cs_CZ.qm
255
	lang/de_DE.qm
256
	lang/fr_FR.qm
257
	lang/it_IT.qm
258
	lang/nl_NL.qm
259
	lang/nn_NO.qm
260
	lang/no_NO.qm
261
	lang/pt_BR.qm
262
	lang/ru_RU.qm
263
	lang/sv_SE.qm
264
	lang/tr_TR.qm
265
	lang/uk_UA.qm
266
	lang/zh_CN.qm
267
	lang/zh_TW.qm)
268
269
270
ADD_CUSTOM_COMMAND (OUTPUT
271
	${COMPILED_TRANSLATIONS}
272
	COMMAND "${QT_LRELEASE_EXECUTABLE}" ${TRANSLATIONS}
273
	DEPENDS ${TRANSLATIONS}
274
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
275
	)
276
277
add_definitions(-DNAMEVER="${NAMEVER}" -DPREFIX="${CMAKE_INSTALL_PREFIX}" -DVERSION="${VERSION}")
278
279
add_executable(qmpdclient ${QMPDClient_srcs} ${QMPDClient_ppd_hdrs} ${QMPDClient_ppd_uis} ${QMPDClient_ppd_res} ${COMPILED_TRANSLATIONS})
280
281
target_link_libraries(qmpdclient ${QT_LIBRARIES})
282
283
install(TARGETS qmpdclient DESTINATION bin)
284
if(UNIX)
285
	install(FILES qmpdclient.desktop DESTINATION share/applications)
286
	install(FILES icons/qmpdclient64.png DESTINATION share/icons)
287
	install(FILES ${COMPILED_TRANSLATIONS} DESTINATION share/QMPDClient/translations)
288
endif()
289
if(WIN32)
290
	install(FILES ${COMPILED_TRANSLATIONS} DESTINATION translations)
291
endif()