forked from openstreetmap/mod_tile
/
CMakeLists.txt
188 lines (158 loc) · 4.95 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
#-----------------------------------------------------------------------------
#
# CMake Config
#
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#-----------------------------------------------------------------------------
#
# Project version
#
#-----------------------------------------------------------------------------
project(mod_tile VERSION 0.6.1)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(ENABLE_MAN ON CACHE BOOL "Build man pages")
set(ENABLE_TESTS OFF CACHE BOOL "Build test suite")
#-----------------------------------------------------------------------------
#
# Find external dependencies
#
#-----------------------------------------------------------------------------
include(GNUInstallDirs)
# Packages
find_package(CURL)
find_package(ICU REQUIRED uc)
find_package(Threads REQUIRED)
find_package(APR REQUIRED)
find_package(Cairo REQUIRED)
find_package(GLib REQUIRED)
find_package(HTTPD REQUIRED)
find_package(IniParser REQUIRED)
find_package(LibMapnik REQUIRED)
find_package(LibMemcached)
find_package(LibRados)
if(LibMapnik_VERSION STRGREATER_EQUAL "4")
set(CMAKE_CXX_STANDARD 14)
endif()
# Programs
find_program(APXS_EXECUTABLE apxs REQUIRED)
# Functions
include(CheckFunctionExists)
# check_function_exists(bzero HAVE_BZERO)
check_function_exists(daemon HAVE_DAEMON)
# check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
check_function_exists(getloadavg HAVE_GETLOADAVG)
# check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
# check_function_exists(inet_ntoa HAVE_INET_NTOA)
# check_function_exists(memset HAVE_MEMSET)
# check_function_exists(mkdir HAVE_MKDIR)
# check_function_exists(pow HAVE_POW)
# check_function_exists(select HAVE_SELECT)
# check_function_exists(socket HAVE_SOCKET)
# check_function_exists(strchr HAVE_STRCHR)
# check_function_exists(strdup HAVE_STRDUP)
# check_function_exists(strerror HAVE_STRERROR)
# check_function_exists(strrchr HAVE_STRRCHR)
# check_function_exists(strstr HAVE_STRSTR)
# check_function_exists(strtol HAVE_STRTOL)
# check_function_exists(strtoul HAVE_STRTOUL)
# check_function_exists(utime HAVE_UTIME)
# Include files
include(CheckIncludeFile)
# check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
# check_include_file(fcntl.h HAVE_FCNTL_H)
# check_include_file(limits.h HAVE_LIMITS_H)
# check_include_file(netdb.h HAVE_NETDB_H)
# check_include_file(netinet/in.h HAVE_NETINET_IN_H)
check_include_file(paths.h HAVE_PATHS_H)
# check_include_file(stdint.h HAVE_STDINT_H)
# check_include_file(stdlib.h HAVE_STDLIB_H)
# check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/cdefs.h HAVE_SYS_CDEFS_H)
check_include_file(sys/loadavg.h HAVE_SYS_LOADAVG_H)
# check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
# check_include_file(sys/time.h HAVE_SYS_TIME_H)
# check_include_file(syslog.h HAVE_SYSLOG_H)
# check_include_file(unistd.h HAVE_UNISTD_H)
# check_include_file(utime.h HAVE_UTIME_H)
#-----------------------------------------------------------------------------
#
# Set variables
#
#-----------------------------------------------------------------------------
execute_process(COMMAND ${APXS_EXECUTABLE} -q exp_libexecdir
OUTPUT_VARIABLE HTTPD_MODULES_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(Cairo_FOUND)
set(HAVE_CAIRO 1)
endif()
if(CURL_FOUND)
set(HAVE_LIBCURL 1)
endif()
if(LibMemcached_FOUND)
set(HAVE_LIBMEMCACHED 1)
endif()
if(LibRados_FOUND)
set(HAVE_LIBRADOS 1)
endif()
if(CMAKE_HAVE_PTHREAD_H)
set(HAVE_PTHREAD 1)
endif()
set(VERSION ${PROJECT_VERSION})
#-----------------------------------------------------------------------------
#
# config.h
#
#-----------------------------------------------------------------------------
configure_file(
${PROJECT_SOURCE_DIR}/includes/config.h.in
${PROJECT_SOURCE_DIR}/includes/config.h
)
#-----------------------------------------------------------------------------
#
# Build
#
#-----------------------------------------------------------------------------
add_subdirectory(src)
#-----------------------------------------------------------------------------
#
# Install
#
#-----------------------------------------------------------------------------
install(
TARGETS
mod_tile
render_expired
render_list
render_old
render_speedtest
renderd
LIBRARY DESTINATION ${HTTPD_MODULES_DIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if (ENABLE_MAN)
install(
FILES
docs/man/render_expired.1
docs/man/render_list.1
docs/man/render_old.1
docs/man/render_speedtest.1
docs/man/renderd.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
)
endif()
#-----------------------------------------------------------------------------
#
# Test
#
#-----------------------------------------------------------------------------
if (ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
endif()