more options

This commit is contained in:
Mathis Logemann 2020-11-21 10:09:29 +01:00
parent 895d89a125
commit 7d46eda60d
2 changed files with 46 additions and 44 deletions

View file

@ -9,10 +9,16 @@ project(mapnik
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(BUILD_SHARED_LIBS ON)
option(USE_EXTERNAL_MAPBOX_GEOMETRY OFF)
option(USE_EXTERNAL_MAPBOX_POLYLABEL OFF)
option(USE_EXTERNAL_MAPBOX_PROTOZERO OFF)
option(USE_EXTERNAL_MAPBOX_VARIANT OFF)
option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF)
option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF)
option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF)
option(USE_EXTERNAL_MAPBOX_VARIANT "Use a external mapnik/variant. If off, use the submodule" OFF)
option(USE_JPEG "Adds jpeg support" ON)
option(USE_PNG "Adds png support" ON)
option(USE_TIFF "Adds tiff support" ON)
option(USE_WEBP "Adds webp support" ON)
option(USE_LIBXML2 "Adds libxml2 support" ON)
option(USE_CAIRO "Adds the cairo renderer" ON)
set(CXX_STANDARD 17)
@ -20,12 +26,6 @@ find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_opti
find_package(ICU REQUIRED COMPONENTS uc)
find_package(Freetype REQUIRED)
find_package(harfbuzz CONFIG REQUIRED)
find_package(PNG)
find_package(JPEG)
find_package(TIFF)
find_package(WebP CONFIG)
find_package(LibXml2)
find_package(Cairo)
if(USE_EXTERNAL_MAPBOX_GEOMETRY)
find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp")
@ -66,40 +66,45 @@ endif()
set(MAPNIK_COMPILE_DEFS "")
set(MAPNIK_OPTIONAL_LIBS "")
if(LibXml2_FOUND)
if(USE_LIBXML2)
message(STATUS "Using LibXml2")
find_package(LibXml2 REQUIRED)
set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_LIBXML2)
set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} LibXml2::LibXml2)
message(STATUS "Using LibXml2")
endif()
if(PNG_FOUND)
if(USE_PNG)
message(STATUS "Using PNG")
find_package(PNG REQUIRED)
set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_PNG)
set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} PNG::PNG)
message(STATUS "Using PNG")
endif()
if(JPEG_FOUND)
if(USE_JPEG)
message(STATUS "Using JPEG")
find_package(JPEG REQUIRED)
set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_JPEG)
set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} JPEG::JPEG)
message(STATUS "Using JPEG")
endif()
if(TIFF_FOUND)
if(USE_TIFF)
find_package(TIFF REQUIRED)
message(STATUS "Using TIFF")
set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_TIFF)
set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} TIFF::TIFF)
message(STATUS "Using TIFF")
endif()
if(WebP_FOUND)
if(USE_WEBP)
message(STATUS "Using WEBP")
find_package(WebP CONFIG REQUIRED)
set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_WEBP)
set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} WebP::webp)
message(STATUS "Using WEBP")
endif()
if(Cairo_FOUND)
if(USE_CAIRO)
message(STATUS "Using Cairo renderer")
find_package(Cairo REQUIRED)
set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_CAIRO)
set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} Cairo::Cairo)
message(STATUS "Using Cairo")
endif()
add_library(mapnik-headers INTERFACE)

View file

@ -88,6 +88,7 @@ set(MAPNIK_SOURCES
wkb.cpp
xml_tree.cpp
)
set(COMPILE_SRC ${MAPNIK_SOURCES})
set(AGG_COMPILE_SRC
../deps/agg/src/agg_arc.cpp
@ -116,7 +117,6 @@ set(AGG_COMPILE_SRC
../deps/agg/src/agg_vpgen_clip_polyline.cpp
../deps/agg/src/agg_vpgen_segmentator.cpp
)
set(AGG_SRC
agg/agg_renderer.cpp
agg/process_building_symbolizer.cpp
@ -134,8 +134,10 @@ set(AGG_SRC
agg/process_text_symbolizer.cpp
${AGG_COMPILE_SRC}
)
list(APPEND COMPILE_SRC ${AGG_SRC})
if(Cairo_FOUND)
if(USE_CAIRO)
message(STATUS "adding cairo renderer to compilation")
set(CAIRO_SRC
cairo/cairo_context.cpp
cairo/cairo_render_vector.cpp
@ -152,12 +154,14 @@ if(Cairo_FOUND)
cairo/process_raster_symbolizer.cpp
cairo/process_text_symbolizer.cpp
)
list(APPEND COMPILE_SRC ${CAIRO_SRC})
endif()
set(CSS_SRC
css/css_color_grammar_x3.cpp
css/css_grammar_x3.cpp
)
list(APPEND COMPILE_SRC ${CSS_SRC})
set(GEOMETRY_SRC
geometry/box2d.cpp
@ -167,6 +171,7 @@ set(GEOMETRY_SRC
geometry/polylabel.cpp
geometry/reprojection.cpp
)
list(APPEND COMPILE_SRC ${GEOMETRY_SRC})
set(GRID_SRC
grid/grid_renderer.cpp
@ -183,12 +188,14 @@ set(GRID_SRC
grid/process_shield_symbolizer.cpp
grid/process_text_symbolizer.cpp
)
list(APPEND COMPILE_SRC ${GRID_SRC})
set(GROUP_SRC
group/group_layout_manager.cpp
group/group_rule.cpp
group/group_symbolizer_helper.cpp
)
list(APPEND COMPILE_SRC ${GROUP_SRC})
set(RENDERER_COMMON_SRC
renderer_common/pattern_alignment.cpp
@ -197,6 +204,7 @@ set(RENDERER_COMMON_SRC
renderer_common/render_pattern.cpp
renderer_common/render_thunk_extractor.cpp
)
list(APPEND COMPILE_SRC ${RENDERER_COMMON_SRC})
set(SVG_SRC
svg/svg_parser.cpp
@ -213,6 +221,7 @@ set(SVG_SRC
svg/output/svg_output_grammars.cpp
svg/output/svg_renderer.cpp
)
list(APPEND COMPILE_SRC ${SVG_SRC})
set(TEXT_SRC
text/color_font_renderer.cpp
@ -243,34 +252,22 @@ set(TEXT_SRC
text/placements/registry.cpp
text/placements/simple.cpp
)
list(APPEND COMPILE_SRC ${TEXT_SRC})
set(UTIL_SRC
util/math.cpp
util/utf_conv_win.cpp
)
list(APPEND COMPILE_SRC ${UTIL_SRC})
if(LibXml2_FOUND)
set(COMPILE_SRC ${COMPILE_SRC} libxml2_loader.cpp)
if(USE_LIBXML2)
message(STATUS "adding libxml2_loader to compilation")
list(APPEND COMPILE_SRC libxml2_loader.cpp)
else()
set(COMPILE_SRC ${COMPILE_SRC} rapidxml_loader.cpp)
message(STATUS "adding rapidxml_loader to compilation")
list(APPEND COMPILE_SRC rapidxml_loader.cpp)
endif()
set(COMPILE_SRC
${MAPNIK_SOURCES}
${AGG_SRC}
${CAIRO_SRC}
${CSS_SRC}
${GEOMETRY_SRC}
${GRID_SRC}
${GROUP_SRC}
${RENDERER_COMMON_SRC}
${SVG_SRC}
${TEXT_SRC}
${UTIL_SRC}
)
add_library(mapnik ${COMPILE_SRC})
add_library(mapnik::mapnik ALIAS mapnik)