Add shlibs.local file
[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.6 >= 0.6")
63 pkg_check_modules(RESTEXTRAS REQUIRED "rest-extras-0.6 >= 0.6")
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   unique-1.0
99   rest-0.6
100   rest-extras-0.6
101 OPTIONS
102   --thread
103   -g
104   --save-temps
105   ${pino_VALA_OPTIONS}
106 CUSTOM_VAPIS
107   ${CMAKE_CURRENT_SOURCE_DIR}/src/vapi/config.vapi
108 )
109
110
111 add_definitions(
112   ${GLIB_CFLAGS}
113   ${GOBJECT_CFLAGS}
114   ${GTK+_CFLAGS}
115   ${GEE_CFLAGS}
116   ${GIO_CFLAGS}
117   ${LIBNOTIFY_CFLAGS}
118   ${LIBSOUP_CFLAGS}
119   ${LIBXML_CFLAGS}
120   ${WEBKIT_CFLAGS}
121   ${LIBUNIQUE_CFLAGS}
122   ${GTKSPELL_CFLAGS}
123   ${LIBINDICATE_CFLAGS}
124   ${REST_CFLAGS}
125   ${RESTEXTRAS_CFLAGS}
126 )
127
128 link_libraries(
129   ${GLIB_LIBRARIES}
130   ${GOBJECT_LIBRARIES}
131   ${GTK+_LIBRARIES}
132   ${GEE_LIBRARIES}
133   ${GIO_LIBRARIES}
134   ${LIBNOTIFY_LIBRARIES}
135   ${LIBSOUP_LIBRARIES}
136   ${LIBXML_LIBRARIES}
137   ${WEBKIT_LIBRARIES}
138   ${LIBUNIQUE_LIBRARIES}
139   ${GTKSPELL_LIBRARIES}
140   ${LIBINDICATE_LIBRARIES}
141   ${REST_LIBRARIES}
142   ${RESTEXTRAS_LIBRARIES}
143 )
144
145 include_directories(src/vapi/)
146 add_definitions(-std=c99)
147
148 add_executable(pino
149   ${pino_C_SOURCES}
150   #src/vapi/sha1.c
151   src/vapi/time_parser.c
152   src/vapi/img_cache_saver.c
153 )
154
155 install(TARGETS pino DESTINATION bin)
156
157
158 find_program(MSGFMT_EXECUTABLE msgfmt)
159 file(GLOB PO_FILES "po/*.po")
160 set(MO_FILES)
161 foreach(PO_FILE ${PO_FILES})
162   get_filename_component(PO_FILE_BASE ${PO_FILE} NAME_WE)
163   set(MO_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/po)
164   set(MO_FILE ${MO_FILE_PATH}/${PO_FILE_BASE}.mo)
165
166   file(MAKE_DIRECTORY "${MO_FILE_PATH}")
167   add_custom_command(
168     OUTPUT ${MO_FILE}
169     COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_FILE} ${PO_FILE})
170
171   install(FILES ${MO_FILE}
172     DESTINATION share/locale/${PO_FILE_BASE}/LC_MESSAGES
173     RENAME ${GETTEXT_PACKAGE}.mo)
174   set(MO_FILES ${MO_FILES} ${MO_FILE})
175 endforeach()
176 add_custom_target(locales ALL DEPENDS ${MO_FILES})
177
178
179 set(pino_IMAGES
180   img/delete_status.png
181   img/direct_fresh.svg
182   img/direct_reply.png
183   img/direct.svg
184   #img/favorite_no.png
185   #img/favorite.png
186   img/service-twitter.png
187   img/service-identica.png
188   img/mentions_fresh.svg
189   img/mentions.svg
190   img/reply.png
191   img/timeline_fresh.svg
192   img/timeline.svg
193   img/public.svg
194   img/userpic.svg
195   img/updating.png
196   img/retweet.svg
197   img/rt.png
198   img/conversation.png
199 )
200 install(FILES ${pino_IMAGES} DESTINATION share/pino/icons)
201
202
203 set(pino_ICONS
204   img/pino_fresh.svg
205   img/pino.svg
206 )
207 install(FILES ${pino_ICONS} DESTINATION share/icons/hicolor/scalable/apps)
208
209
210 set(pino_UBUNTU_ICONS_DARK
211  img/ubuntu-mono-dark/pino-tray-icon.svg
212  img/ubuntu-mono-dark/pino-tray-icon-fresh.svg
213 )
214 set(pino_UBUNTU_ICONS_LIGHT
215   img/ubuntu-mono-light/pino-tray-icon.svg
216   img/ubuntu-mono-light/pino-tray-icon-fresh.svg
217 )
218 if(UBUNTU_ICONS)
219   install(FILES ${pino_UBUNTU_ICONS_DARK} DESTINATION share/icons/ubuntu-mono-dark/apps/22)
220   install(FILES ${pino_UBUNTU_ICONS_LIGHT} DESTINATION share/icons/ubuntu-mono-light/apps/22)
221 endif()
222
223
224 set(pino_DOCS
225   COPYING
226   README
227   AUTHORS
228   INSTALL
229 )
230 install(FILES ${pino_DOCS} DESTINATION share/doc/pino)
231
232
233 set(pino_TEMPLATES
234   templates/main.tpl
235   templates/status.tpl
236   templates/status_direct.tpl
237   templates/status_me.tpl
238 )
239 install(FILES ${pino_TEMPLATES} DESTINATION share/pino/templates)
240
241
242 install(FILES pino.desktop DESTINATION share/applications)
243 install(FILES indicator/pino DESTINATION share/indicators/messages/applications)