Fix another error
[debian/pino.git] / CMakeLists.txt
1 # Copyright (C) 2010 Cristian Greco <cristian@regolo.cc>
2 # Distributed under the same license terms of the program itself (see COPYING).
3
4 cmake_minimum_required(VERSION 2.6)
5
6 project("pino" C)
7
8 set(VERSION "0.2.9")
9
10 set(APPNAME "pino3")
11 set(PACKAGE "${APPNAME}")
12 set(PACKAGE_NAME "${APPNAME}")
13 set(PACKAGE_STRING "${APPNAME}-${VERSION}")
14 set(PACKAGE_VERSION "${APPNAME}-${VERSION}")
15 set(APP_VERSION "${VERSION}")
16 set(GETTEXT_PACKAGE "${APPNAME}")
17 string(REGEX REPLACE "([0-9])\\.([0-9]).*" "\\1.\\2" VERSION_MAJOR_MINOR ${VERSION})
18 file(READ AUTHORS _AUTHORS)
19 string(REPLACE "\n" "\\n" AUTHORS ${_AUTHORS})
20
21 configure_file(
22   "${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
23   "${CMAKE_CURRENT_BINARY_DIR}/config.h"
24 )
25 add_definitions(-include config.h)
26
27
28 configure_file(
29   "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
30   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
31   IMMEDIATE @ONLY
32 )
33 add_custom_target(uninstall "${CMAKE_COMMAND}" -P
34   "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
35
36
37 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
38 include(ValaVersion)
39 include(ValaPrecompile)
40 find_package(Vala REQUIRED)
41 ensure_vala_version("0.7.9" MINIMUM)
42
43
44 option(ENABLE_DEBUG "Enable debug messages" OFF)
45 option(UBUNTU_ICONS "Install icons for Ubuntu mono themes" OFF)
46 set(pino_VALA_OPTIONS)
47
48 #execute_process(COMMAND ${VALA_EXECUTABLE} "--version")
49
50 find_package(PkgConfig)
51 pkg_check_modules(GLIB REQUIRED "glib-2.0 >= 2.14.0")
52 pkg_check_modules(GOBJECT REQUIRED "gobject-2.0 >= 2.14.0")
53 pkg_check_modules(GTK+ REQUIRED "gtk+-2.0 >= 2.10.0")
54 pkg_check_modules(GEE REQUIRED "gee-1.0 >= 0.5.0")
55 pkg_check_modules(GIO REQUIRED "gio-2.0 >= 2.0")
56 pkg_check_modules(LIBNOTIFY REQUIRED "libnotify")
57 pkg_check_modules(LIBSOUP REQUIRED "libsoup-2.4 >= 2.4")
58 pkg_check_modules(LIBXML REQUIRED "libxml-2.0 >= 2.0")
59 pkg_check_modules(WEBKIT REQUIRED "webkit-1.0 >= 1.0")
60 pkg_check_modules(LIBUNIQUE REQUIRED "unique-1.0 >= 1.0")
61 pkg_check_modules(GTKSPELL REQUIRED "gtkspell-2.0 >= 2.0")
62 pkg_check_modules(REST REQUIRED "rest-0.7 >= 0.7.10")
63 #pkg_check_modules(RESTEXTRAS REQUIRED "rest-extras-0.7 >= 0.7.10")
64 #pkg_check_modules(LIBINDICATE "indicate >= 0.3")
65
66 if(${LIBINDICATE_FOUND})
67   message(STATUS "libindicate found, support enabled...")
68   set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} -D LIBINDICATE)
69 else()
70   message(STATUS "libindicate not found, support disabled...")
71 endif()
72
73
74 if(ENABLE_DEBUG)
75   set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} -D HAS_DEBUG)
76 endif()
77 if(UBUNTU_ICONS)
78   set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} -D HAS_UBUNTUICONS)
79 endif()
80
81 file(GLOB pino_VALA_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.vala")
82 #list(REMOVE_ITEM pino_VALA_SOURCES "src/oauth-client.vala")
83
84
85 vala_precompile(
86 pino_C_SOURCES
87   ${pino_VALA_SOURCES}
88 PACKAGES
89   glib-2.0
90   gobject-2.0
91   gtk+-2.0
92   gee-1.0
93   gio-2.0
94   libnotify
95   libsoup-2.4
96   libxml-2.0
97   webkit-1.0
98   rest-0.6
99   unique-1.0
100   
101   #rest-extras-0.6
102 OPTIONS
103   --thread
104   -g
105   --save-temps
106   ${pino_VALA_OPTIONS}
107 CUSTOM_VAPIS
108   ${CMAKE_CURRENT_SOURCE_DIR}/src/vapi/config.vapi
109 )
110
111
112 add_definitions(
113   ${GLIB_CFLAGS}
114   ${GOBJECT_CFLAGS}
115   ${GTK+_CFLAGS}
116   ${GEE_CFLAGS}
117   ${GIO_CFLAGS}
118   ${LIBNOTIFY_CFLAGS}
119   ${LIBSOUP_CFLAGS}
120   ${LIBXML_CFLAGS}
121   ${WEBKIT_CFLAGS}
122   ${LIBUNIQUE_CFLAGS}
123   ${GTKSPELL_CFLAGS}
124   ${LIBINDICATE_CFLAGS}
125   ${REST_CFLAGS}
126   #${RESTEXTRAS_CFLAGS}
127 )
128
129 link_libraries(
130   ${GLIB_LIBRARIES}
131   ${GOBJECT_LIBRARIES}
132   ${GTK+_LIBRARIES}
133   ${GEE_LIBRARIES}
134   ${GIO_LIBRARIES}
135   ${LIBNOTIFY_LIBRARIES}
136   ${LIBSOUP_LIBRARIES}
137   ${LIBXML_LIBRARIES}
138   ${WEBKIT_LIBRARIES}
139   ${LIBUNIQUE_LIBRARIES}
140   ${GTKSPELL_LIBRARIES}
141   ${LIBINDICATE_LIBRARIES}
142   ${REST_LIBRARIES}
143   #${RESTEXTRAS_LIBRARIES}
144 )
145
146 include_directories(src/vapi/)
147 add_definitions(-std=c99)
148
149 add_executable(pino
150   ${pino_C_SOURCES}
151   #src/vapi/sha1.c
152   src/vapi/time_parser.c
153   src/vapi/img_cache_saver.c
154 )
155
156 install(TARGETS pino DESTINATION bin)
157
158
159 find_program(MSGFMT_EXECUTABLE msgfmt)
160 file(GLOB PO_FILES "po/*.po")
161 set(MO_FILES)
162 foreach(PO_FILE ${PO_FILES})
163   get_filename_component(PO_FILE_BASE ${PO_FILE} NAME_WE)
164   set(MO_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/po)
165   set(MO_FILE ${MO_FILE_PATH}/${PO_FILE_BASE}.mo)
166
167   file(MAKE_DIRECTORY "${MO_FILE_PATH}")
168   add_custom_command(
169     OUTPUT ${MO_FILE}
170     COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_FILE} ${PO_FILE})
171
172   install(FILES ${MO_FILE}
173     DESTINATION share/locale/${PO_FILE_BASE}/LC_MESSAGES
174     RENAME ${GETTEXT_PACKAGE}.mo)
175   set(MO_FILES ${MO_FILES} ${MO_FILE})
176 endforeach()
177 add_custom_target(locales ALL DEPENDS ${MO_FILES})
178
179
180 set(pino_IMAGES
181   img/delete_status.png
182   img/direct_fresh.svg
183   img/direct_reply.png
184   img/direct.svg
185   #img/favorite_no.png
186   #img/favorite.png
187   img/service-twitter.png
188   img/service-identica.png
189   img/mentions_fresh.svg
190   img/mentions.svg
191   img/group.svg
192   img/reply.png
193   img/timeline_fresh.svg
194   img/timeline.svg
195   img/public.svg
196   img/userpic.svg
197   img/updating.png
198   img/retweet.svg
199   img/rt.png
200   img/conversation.png
201 )
202 install(FILES ${pino_IMAGES} DESTINATION share/pino/icons)
203
204
205 set(pino_ICONS
206   img/pino_fresh.svg
207   img/pino.svg
208 )
209 install(FILES ${pino_ICONS} DESTINATION share/icons/hicolor/scalable/apps)
210
211
212 set(pino_UBUNTU_ICONS_DARK
213  img/ubuntu-mono-dark/pino-tray-icon.svg
214  img/ubuntu-mono-dark/pino-tray-icon-fresh.svg
215 )
216 set(pino_UBUNTU_ICONS_LIGHT
217   img/ubuntu-mono-light/pino-tray-icon.svg
218   img/ubuntu-mono-light/pino-tray-icon-fresh.svg
219 )
220 if(UBUNTU_ICONS)
221   install(FILES ${pino_UBUNTU_ICONS_DARK} DESTINATION share/icons/ubuntu-mono-dark/apps/22)
222   install(FILES ${pino_UBUNTU_ICONS_LIGHT} DESTINATION share/icons/ubuntu-mono-light/apps/22)
223 endif()
224
225
226 set(pino_DOCS
227   COPYING
228   README
229   AUTHORS
230   INSTALL
231 )
232 install(FILES ${pino_DOCS} DESTINATION share/doc/pino)
233
234
235 set(pino_TEMPLATES
236   templates/main.tpl
237   templates/status.tpl
238   templates/status_direct.tpl
239   templates/status_me.tpl
240 )
241 install(FILES ${pino_TEMPLATES} DESTINATION share/pino/templates)
242
243
244 install(FILES pino.desktop DESTINATION share/applications)
245 install(FILES indicator/pino DESTINATION share/indicators/messages/applications)