Fix copyright file as per DEP-5 1.0 format
[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.11")
9
10 set(APPNAME "pino")
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
49 find_package(PkgConfig)
50 pkg_check_modules(GLIB REQUIRED "glib-2.0 >= 2.14.0")
51 pkg_check_modules(GOBJECT REQUIRED "gobject-2.0 >= 2.14.0")
52 pkg_check_modules(GTK+ REQUIRED "gtk+-2.0 >= 2.10.0")
53 pkg_check_modules(GEE REQUIRED "gee-1.0 >= 0.5.0")
54 pkg_check_modules(GIO REQUIRED "gio-2.0 >= 2.0")
55 pkg_check_modules(LIBNOTIFY REQUIRED "libnotify")
56 pkg_check_modules(LIBSOUP REQUIRED "libsoup-2.4 >= 2.4")
57 pkg_check_modules(LIBXML REQUIRED "libxml-2.0 >= 2.0")
58 pkg_check_modules(WEBKIT REQUIRED "webkit-1.0 >= 1.0")
59 pkg_check_modules(LIBUNIQUE REQUIRED "unique-1.0 >= 1.0")
60 pkg_check_modules(GTKSPELL REQUIRED "gtkspell-2.0 >= 2.0")
61 pkg_check_modules(LIBINDICATE "indicate >= 0.3")
62
63 set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} --thread)
64
65 if(${LIBINDICATE_FOUND})
66   message(STATUS "libindicate found, support enabled...")
67   set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} -D LIBINDICATE)
68 else()
69   message(STATUS "libindicate not found, support disabled...")
70 endif()
71
72
73 if(ENABLE_DEBUG)
74   set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} -D HAS_DEBUG)
75 endif()
76 if(UBUNTU_ICONS)
77   set(pino_VALA_OPTIONS ${pino_VALA_OPTIONS} -D HAS_UBUNTUICONS)
78 endif()
79
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 OPTIONS
100   ${pino_VALA_OPTIONS}
101 CUSTOM_VAPIS
102   ${CMAKE_CURRENT_SOURCE_DIR}/src/vapi/config.vapi
103 )
104
105
106 add_definitions(
107   ${GLIB_CFLAGS}
108   ${GOBJECT_CFLAGS}
109   ${GTK+_CFLAGS}
110   ${GEE_CFLAGS}
111   ${GIO_CFLAGS}
112   ${LIBNOTIFY_CFLAGS}
113   ${LIBSOUP_CFLAGS}
114   ${LIBXML_CFLAGS}
115   ${WEBKIT_CFLAGS}
116   ${LIBUNIQUE_CFLAGS}
117   ${GTKSPELL_CFLAGS}
118   ${LIBINDICATE_CFLAGS}
119 )
120
121 link_libraries(
122   ${GLIB_LIBRARIES}
123   ${GOBJECT_LIBRARIES}
124   ${GTK+_LIBRARIES}
125   ${GEE_LIBRARIES}
126   ${GIO_LIBRARIES}
127   ${LIBNOTIFY_LIBRARIES}
128   ${LIBSOUP_LIBRARIES}
129   ${LIBXML_LIBRARIES}
130   ${WEBKIT_LIBRARIES}
131   ${LIBUNIQUE_LIBRARIES}
132   ${GTKSPELL_LIBRARIES}
133   ${LIBINDICATE_LIBRARIES}
134 )
135
136 include_directories(src/vapi/)
137 add_definitions(-std=c99)
138
139 add_executable(pino
140   ${pino_C_SOURCES}
141   #src/vapi/sha1.c
142   src/vapi/time_parser.c
143 )
144
145 install(TARGETS pino DESTINATION bin)
146
147
148 find_program(MSGFMT_EXECUTABLE msgfmt)
149 file(GLOB PO_FILES "po/*.po")
150 set(MO_FILES)
151 foreach(PO_FILE ${PO_FILES})
152   get_filename_component(PO_FILE_BASE ${PO_FILE} NAME_WE)
153   set(MO_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/po)
154   set(MO_FILE ${MO_FILE_PATH}/${PO_FILE_BASE}.mo)
155
156   file(MAKE_DIRECTORY "${MO_FILE_PATH}")
157   add_custom_command(
158     OUTPUT ${MO_FILE}
159     COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_FILE} ${PO_FILE})
160
161   install(FILES ${MO_FILE}
162     DESTINATION share/locale/${PO_FILE_BASE}/LC_MESSAGES
163     RENAME ${GETTEXT_PACKAGE}.mo)
164   set(MO_FILES ${MO_FILES} ${MO_FILE})
165 endforeach()
166 add_custom_target(locales ALL DEPENDS ${MO_FILES})
167
168
169 set(pino_IMAGES
170   img/delete_status.png
171   img/direct_fresh.svg
172   img/direct_reply.png
173   img/direct.svg
174   img/favorite_no.png
175   img/favorite.png
176   img/mentions_fresh.svg
177   img/mentions.svg
178   img/progress.gif
179   img/reply.png
180   img/re_tweet.png
181   img/timeline_fresh.svg
182   img/timeline.svg
183   img/userpic.svg
184 )
185 install(FILES ${pino_IMAGES} DESTINATION share/pino/icons)
186
187
188 set(pino_ICONS
189   img/pino_fresh.svg
190   img/pino.svg
191 )
192 install(FILES ${pino_ICONS} DESTINATION share/icons/hicolor/scalable/apps)
193
194
195 set(pino_UBUNTU_ICONS_DARK
196  img/ubuntu-mono-dark/pino-tray-icon.svg
197  img/ubuntu-mono-dark/pino-tray-icon-fresh.svg
198 )
199 set(pino_UBUNTU_ICONS_LIGHT
200   img/ubuntu-mono-light/pino-tray-icon.svg
201   img/ubuntu-mono-light/pino-tray-icon-fresh.svg
202 )
203 if(UBUNTU_ICONS)
204   install(FILES ${pino_UBUNTU_ICONS_DARK} DESTINATION share/icons/ubuntu-mono-dark/apps/22)
205   install(FILES ${pino_UBUNTU_ICONS_LIGHT} DESTINATION share/icons/ubuntu-mono-light/apps/22)
206 endif()
207
208
209 set(pino_DOCS
210   COPYING
211   README
212   AUTHORS
213   INSTALL
214 )
215 install(FILES ${pino_DOCS} DESTINATION share/doc/pino)
216
217
218 set(pino_TEMPLATES
219   templates/main.tpl
220   templates/status.tpl
221   templates/status_direct.tpl
222   templates/status_me.tpl
223 )
224 install(FILES ${pino_TEMPLATES} DESTINATION share/pino/templates)
225
226
227 install(FILES pino.desktop DESTINATION share/applications)
228 install(FILES indicator/pino DESTINATION share/indicators/messages/applications)