forked from mapnik/mapnik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
298 lines (242 loc) · 8.97 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
cmake_minimum_required(VERSION 3.13.4)
project(mapnik)
set(CMAKE_CXX_STANDARD 14)
include(CMakeDependentOption)
option(MAPNIK_STATIC_LIB "Build a static library" OFF)
option(WITH_DEMO "Build demo" ON)
option(WITH_VIEWER "Build viewer" ON)
option(WITH_INPUTS "Build input plugins" ON)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_CSV "Build the csv input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_GDAL "Build the gdal input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_GEOBUF "Build the geobuf input plugin" OFF "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_GEOJSON "Build the geojson input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_OGR "Build the ogr input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_PGRASTER "Build the pgraster input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_POSTGIS "Build the postgis input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_RASTER "Build the raster input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_SHAPE "Build the shape input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_SQLITE "Build the sqlite input plugin" ON "WITH_INPUTS" OFF)
CMAKE_DEPENDENT_OPTION(WITH_INPUT_TOPOJSON "Build the topojson input plugin" ON "WITH_INPUTS" OFF)
option(WITH_UTILS "Build the utilities" ON )
option(WITH_GRID "Use the grid renderer" OFF)
option(WITH_CAIRO "Use cairo" ON)
option(WITH_PROJ4 "Use proj4" ON)
if(MSVC)
# Force to always compile with W4
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W1" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd\"4068\" /wd\"4661\" /wd\"4503\" ")
add_compile_options(/MP)
endif()
find_package(Boost REQUIRED
COMPONENTS filesystem system regex program_options)
find_package(FreeType REQUIRED)
find_library(HARFBUZZ_LIB harfbuzz.lib)
find_package(ICU REQUIRED COMPONENTS uc)
find_package(PNG REQUIRED)
find_package(jpeg REQUIRED)
find_package(tiff REQUIRED)
find_package(WebP REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(ZLIB REQUIRED)
set (MAPNIK_DEFS
-DHAVE_PNG
-DHAVE_JPEG
-DHAVE_TIFF
-DHAVE_WEBP)
set(thirdparty_include_paths ${thirdparty_include_paths}
${JPEG_INCLUDE_DIR} ${WEBP_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR})
set(thirdparty_libraries ${thirdparty_libraries}
${JPEG_LIBRARIES} ${WEBP_LIBRARIES} ${LIBXML2_LIBRARIES} ${HARFBUZZ_LIB})
# AGG
include(files.cmake)
if (WITH_CAIRO)
find_library(CAIRO_LIB_DEBUG cairod)
find_library(CAIRO_LIB_RELEASE cairo)
find_library(CAIRO_GOBJECT_LIB_DEBUG cairo-gobjectd)
find_library(CAIRO_GOBJECT_LIB_RELEASE cairo-gobject)
find_path(CAIRO_INCLUDE_DIR cairo/cairo.h)
set(thirdparty_include_paths ${thirdparty_include_paths} ${CAIRO_INCLUDE_DIR})
set(thirdparty_libraries ${thirdparty_libraries} $<$<CONFIG:Debug>:${CAIRO_LIB_DEBUG}> $<$<CONFIG:Release>:${CAIRO_LIB_RELEASE}>)
set(MAPNIK_SOURCES ${MAPNIK_SOURCES}
src/cairo/process_markers_symbolizer.cpp
src/cairo/process_group_symbolizer.cpp
src/cairo/cairo_context.cpp
src/cairo/cairo_render_vector.cpp
src/cairo/cairo_renderer.cpp
src/cairo/process_building_symbolizer.cpp
src/cairo/process_debug_symbolizer.cpp
src/cairo/process_line_pattern_symbolizer.cpp
src/cairo/process_line_symbolizer.cpp
src/cairo/process_point_symbolizer.cpp
src/cairo/process_polygon_pattern_symbolizer.cpp
src/cairo/process_polygon_symbolizer.cpp
src/cairo/process_raster_symbolizer.cpp
src/cairo/process_text_symbolizer.cpp)
set(MAPNIK_DEFS ${MAPNIK_DEFS} -DHAVE_CAIRO)
endif()
message(STATUS "Cairo renderer " ${WITH_CAIRO})
if (WITH_PROJ4)
find_package(PROJ4 REQUIRED)
set(thirdparty_include_paths ${thirdparty_include_paths} ${PROJ4_INCLUDE_DIRS})
set(thirdparty_libraries ${thirdparty_libraries} ${PROJ4_LIBRARIES})
set(MAPNIK_DEFS ${MAPNIK_DEFS} -DMAPNIK_USE_PROJ4)
endif()
if (WITH_GRID)
set(MAPNIK_SOURCES ${MAPNIK_SOURCES}
src/grid/grid.cpp
src/grid/grid_renderer.cpp
src/grid/process_building_symbolizer.cpp
src/grid/process_line_pattern_symbolizer.cpp
src/grid/process_line_symbolizer.cpp
src/grid/process_point_symbolizer.cpp
src/grid/process_polygon_pattern_symbolizer.cpp
src/grid/process_polygon_symbolizer.cpp
src/grid/process_raster_symbolizer.cpp
src/grid/process_shield_symbolizer.cpp
src/grid/process_text_symbolizer.cpp)
set(MAPNIK_DEFS ${MAPNIK_DEFS} -DGRID_RENDERER)
ENDIF()
message(STATUS "Grid renderer: " ${WITH_GRID})
set(MAPNIK_SOURCES ${MAPNIK_SOURCES}
src/svg/output/svg_output_grammars.cpp
src/svg/output/svg_renderer.cpp
src/svg/output/svg_generator.cpp
src/svg/output/svg_output_attributes.cpp
src/svg/output/process_symbolizers.cpp
src/svg/output/process_line_symbolizer.cpp
src/svg/output/process_polygon_symbolizer.cpp)
set(MAPNIK_DEFS ${MAPNIK_DEFS} -DSVG_RENDERER)
set(MAPNIK_SOURCES ${MAPNIK_SOURCES}
src/jpeg_reader.cpp
src/libxml2_loader.cpp
src/png_reader.cpp
src/tiff_reader.cpp
src/webp_reader.cpp
)
#set(MAPNIK_SOURCES ${MAPNIK_SOURCES} src/rapidxml_loader.cpp)
set(MAPNIK_DEFS ${MAPNIK_DEFS} -DHAVE_LIBXML2 -DBOOST_REGEX_HAS_ICU)
set(mapnik_include_paths
include
deps
deps/agg/include
deps/mapbox/geometry/include
deps/mapbox/polylabel/include
deps/mapbox/variant/include)
include_directories(${mapnik_include_paths} ${thirdparty_include_paths})
if (MAPNIK_STATIC_LIB)
message(STATUS "Building static library")
add_library(mapnik STATIC ${MAPNIK_SOURCES} ${MAPNIK_AGG_SOURCES} ${AGG_SOURCES})
target_compile_definitions(mapnik PUBLIC -DMAPNIK_STATICLIB)
set(MAPNIK_LIB_DEFINITION -DMAPNIK_STATICLIB)
else ()
message(STATUS "Building shared library")
add_library(mapnik SHARED ${MAPNIK_SOURCES} ${MAPNIK_AGG_SOURCES} ${AGG_SOURCES})
target_compile_definitions(mapnik PRIVATE -DMAPNIK_EXPORTS)
set(MAPNIK_LIB_DEFINITION )
endif ()
target_compile_definitions(mapnik PUBLIC ${MAPNIK_DEFS})
target_include_directories(mapnik INTERFACE ${mapnik_include_paths} ${thirdparty_include_paths})
target_link_libraries(mapnik PUBLIC
${thirdparty_libraries}
Boost::boost Boost::filesystem Boost::system Boost::regex Boost::program_options
Freetype::Freetype
ICU::uc
PNG::PNG TIFF::TIFF
ZLIB::ZLIB)
install(TARGETS mapnik
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
add_subdirectory(src/json)
add_subdirectory(src/wkt)
# ideally we should also generate mapnik-config
if (WITH_INPUT_CSV)
add_subdirectory(plugins/input/csv)
endif()
if (WITH_INPUT_GDAL)
find_package(GDAL REQUIRED)
add_subdirectory(plugins/input/gdal)
endif()
if (WITH_INPUT_GEOBUF)
# TODO insert protozero here
add_subdirectory(plugins/input/geobuf)
endif()
if (WITH_INPUT_GEOJSON)
add_subdirectory(plugins/input/geojson)
endif()
if (WITH_INPUT_OGR)
add_subdirectory(plugins/input/ogr)
endif()
if (WITH_INPUT_PGRASTER)
find_package(PostgreSQL REQUIRED)
add_subdirectory(plugins/input/pgraster)
endif()
if (WITH_INPUT_POSTGIS)
find_package(PostgreSQL REQUIRED)
add_subdirectory(plugins/input/postgis)
endif()
if (WITH_INPUT_RASTER)
add_subdirectory(plugins/input/raster)
endif()
if (WITH_INPUT_SHAPE)
add_subdirectory(plugins/input/shape)
endif()
if (WITH_INPUT_SQLITE)
find_package(sqlite3 REQUIRED)
add_subdirectory(plugins/input/sqlite)
endif()
if (WITH_INPUT_TOPOJSON)
add_subdirectory(plugins/input/topojson)
endif()
if (WITH_INPUTS)
message(STATUS "Input plugins:")
if(WITH_INPUT_CSV )
message(STATUS " - csv ")
endif()
if(WITH_INPUT_GDAL )
message(STATUS " - gdal ")
endif()
if(WITH_INPUT_GEOBUF )
message(STATUS " - geobuf ")
endif()
if(WITH_INPUT_GEOJSON )
message(STATUS " - geojson ")
endif()
if(WITH_INPUT_OGR )
message(STATUS " - ogr ")
endif()
if(WITH_INPUT_PGRASTER )
message(STATUS " - pgraster")
endif()
if(WITH_INPUT_POSTGIS )
message(STATUS " - postgis ")
endif()
if(WITH_INPUT_RASTER )
message(STATUS " - raster ")
endif()
if(WITH_INPUT_SHAPE )
message(STATUS " - shape ")
endif()
if(WITH_INPUT_SQLITE )
message(STATUS " - sqlite ")
endif()
if(WITH_INPUT_TOPOJSON )
message(STATUS " - topojson")
endif()
else()
message(STATUS "Input plugins OFF")
endif()
if(WITH_DEMO)
add_subdirectory(demo/c++)
endif()
if(WITH_VIEWER)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
add_subdirectory(demo/viewer)
endif()
if(WITH_UTILS)
add_subdirectory(utils/mapnik-render)
add_subdirectory(utils/shapeindex)
endif()