-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
214 lines (185 loc) · 6.24 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
# Geary build script
# Copyright 2016 Software Freedom Conservancy Inc.
#
# Check http://webdev.elementaryos.org/docs/developer-guide/cmake for documentation
cmake_minimum_required(VERSION 2.8)
cmake_policy(VERSION 2.6)
project(geary C)
list(APPEND
CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/cmake/GCR_CMake/macros
)
#
# Base bits
#
set(GETTEXT_PACKAGE "geary")
set(RELEASE_NAME "Lightweight email client for GNOME.")
set(VERSION "0.11.2-dev")
set(VERSION_INFO "Release")
set(LANGUAGE_SUPPORT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/locale)
if (NOT ISO_CODE_639_XML)
find_path(ISOCODES_DIRECTORY NAMES iso_639.xml PATHS ${CMAKE_INSTALL_PREFIX} /usr/share/xml/iso-codes)
if (ISOCODES_DIRECTORY)
set(ISO_CODE_639_XML ${ISOCODES_DIRECTORY}/iso_639.xml)
else ()
message(WARNING "File iso_639.xml not found. Please specify it manually using cmake -DISO_CODE_639_XML=/path/to/iso_639.xml")
endif ()
else ()
if (NOT EXISTS ${ISO_CODE_639_XML})
message(WARNING "The path to iso_639.xml specified in ISO_CODE_639_XML is not valid.")
endif ()
endif ()
if (NOT ISO_CODE_3166_XML)
find_path(ISOCODES_DIRECTORY NAMES iso_3166.xml PATHS ${CMAKE_INSTALL_PREFIX} /usr/share/xml/iso-codes)
if (ISOCODES_DIRECTORY)
set(ISO_CODE_3166_XML ${ISOCODES_DIRECTORY}/iso_3166.xml)
else ()
message(WARNING "File iso_3166.xml not found. Please specify it manually using cmake -DISO_CODE_3166_XML=/path/to/iso_3166.xml")
endif ()
else ()
if (NOT EXISTS ${ISO_CODE_3166_XML})
message(WARNING "The path to iso_3166.xml specified in ISO_CODE_3166_XML is not valid.")
endif ()
endif ()
# Packaging filenamesnames.
set(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
set(ARCHIVE_FULL_NAME ${ARCHIVE_BASE_NAME}.tar.xz)
set(ARCHIVE_DEBUILD_FULL_NAME ${CMAKE_PROJECT_NAME}_${VERSION}.orig.tar.xz)
option(DEBUG "Build for debugging." OFF)
option(ICON_UPDATE "Run gtk-update-icon-cache after the install." ON)
option(DESKTOP_UPDATE "Run update-desktop-database after the install." ON)
option(DESKTOP_VALIDATE "Check generated desktop file for errors during build." ON)
option(TRANSLATE_HELP "Generate and install translated help documentation." ON)
if (DEBUG)
message(STATUS "Debug build")
endif ()
if (ICON_UPDATE)
message(STATUS "Icon cache will be updated")
endif ()
if (DESKTOP_UPDATE)
message(STATUS "Desktop database will be updated")
endif ()
if (DESKTOP_VALIDATE)
message(STATUS "Generated desktop file will be checked for errors")
endif ()
if (TRANSLATE_HELP)
message(STATUS "Help translations will be generated and installed")
endif ()
find_package(PkgConfig)
pkg_check_modules(LIBUNITY QUIET unity>=5.12.0)
pkg_check_modules(LIBMESSAGINGMENU QUIET messaging-menu>=12.10.2)
pkg_check_modules(ENCHANT QUIET enchant)
pkg_check_modules(SQLITE3 sqlite3)
if (NOT ${SQLITE3_VERSION} VERSION_LESS 3.12)
include(CheckSymbolExists)
check_symbol_exists(SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER sqlite3.h HAVE_FTS3_TOKENIZER)
if (NOT HAVE_FTS3_TOKENIZER)
message(FATAL_ERROR "SQLite3 is missing FTS3 tokenizer support. Please compile it with -DSQLITE_ENABLE_FTS3."
" See https://bugzilla.gnome.org/show_bug.cgi?id=763203 for details.")
endif()
else()
# detect that the current sqlite3 library has FTS3 support (at run time)
include(CMakePushCheckState)
include(CheckCSourceRuns)
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_LIBRARIES sqlite3)
check_c_source_runs("
#include <sqlite3.h>
#include <stdlib.h>
int main() {
sqlite3 *db;
char tmpfile[] = \"sqliteXXXXXX\";
mkstemp(tmpfile);
if (sqlite3_open(tmpfile, &db) == SQLITE_OK) {
return sqlite3_exec(db, \"CREATE VIRTUAL TABLE mail USING fts3(subject, body);\", 0, 0, 0);
}
return -1;
}
" HAVE_FTS3)
cmake_pop_check_state()
if (NOT HAVE_FTS3)
if (${SQLITE3_VERSION} VERSION_LESS 3.11)
message(FATAL_ERROR "SQLite3 is missing FTS3 support. Please compile it with -DSQLITE_ENABLE_FTS3.")
else()
message(FATAL_ERROR "SQLite3 is missing FTS3 tokenizer support. Please compile it with -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_TOKENIZER.")
endif()
endif()
endif()
find_package(Git QUIET)
# intl
include(Gettext)
if (XGETTEXT_FOUND)
message(STATUS "xgettext found")
else ()
message(STATUS "xgettext not found")
endif ()
# GResources
include(GlibCompileResourcesSupport)
#
# Uninstall target
#
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(
uninstall-base
COMMAND
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
COMMAND
${glib_schema_compiler} ${GSETTINGS_DIR}
)
add_custom_target(
uninstall
)
# We add this dependency using add_dependencies (which makes it run first) rather than
# a depends clause in add_custom_target (which would make it run last).
add_dependencies(uninstall uninstall-base)
# This gets fired in the root-level Makefile to ensure an post-uninstall cleanup happens after
# everything has has been removed
add_custom_target(
post-uninstall
)
# Dist
# This generates the dist tarballs
if (GIT_FOUND)
add_custom_target(
dist
COMMAND
${GIT_EXECUTABLE} archive --prefix=${ARCHIVE_BASE_NAME}/ HEAD
| xz -z > ${CMAKE_BINARY_DIR}/${ARCHIVE_FULL_NAME}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif()
# Ubuntu
# Builds the source Debian package used for the Launchpad PPA
add_custom_target(
ubuntu_pre
DEPENDS
dist
COMMAND
${CMAKE_COMMAND} -E copy ${ARCHIVE_FULL_NAME} ${ARCHIVE_DEBUILD_FULL_NAME}
COMMAND
tar xvfx ${ARCHIVE_FULL_NAME}
)
add_custom_target(
ubuntu
DEPENDS
ubuntu_pre
COMMAND
${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/debian"
"${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_BASE_NAME}/debian"
COMMAND
debuild -S -k$ENV{GPGKEY}
COMMAND
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_BASE_NAME}"
)
add_subdirectory(desktop)
add_subdirectory(help)
add_subdirectory(icons)
add_subdirectory(po)
add_subdirectory(sql)
add_subdirectory(ui)
add_subdirectory(src)