more cmake

This commit is contained in:
Mathis Logemann 2020-11-20 20:20:28 +01:00
parent 5420ccd6af
commit e6f6d0f133
9 changed files with 451 additions and 4 deletions

View file

@ -4,4 +4,84 @@ project(mapnik
HOMEPAGE_URL "https://mapnik.org/"
DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications"
LANGUAGES CXX
)
)
option(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)
set(CXX_STANDARD 17)
find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options)
find_package(ICU REQUIRED COMPONENTS uc)
if(USE_EXTERNAL_MAPBOX_GEOMETRY)
find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp")
else()
set(MAPBOX_GEOMETRY_INCLUDE_DIRS deps/mapbox/geometry/include)
endif()
if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS)
message(FATAL_ERROR "Set MAPBOX_GEOMETRY_INCLUDE_DIRS to the mapbox/geometry.hpp include dir")
endif()
if(USE_EXTERNAL_MAPBOX_POLYLABEL)
find_path(MAPBOX_POLYLABEL_INCLUDE_DIRS "mapbox/polylabel.hpp")
else()
set(MAPBOX_POLYLABEL_INCLUDE_DIRS deps/mapbox/polylabel/include)
endif()
if(NOT MAPBOX_POLYLABEL_INCLUDE_DIRS)
message(FATAL_ERROR "Set MAPBOX_POLYLABEL_INCLUDE_DIRS to the mapbox/geometry include dir")
endif()
if(USE_EXTERNAL_MAPBOX_PROTOZERO)
find_path(MAPBOX_PROTOZERO_INCLUDE_DIRS "protozero/pbf_message.hpp")
else()
set(MAPBOX_PROTOZERO_INCLUDE_DIRS deps/mapbox/protozero/include)
endif()
if(NOT MAPBOX_PROTOZERO_INCLUDE_DIRS)
message(FATAL_ERROR "Set MAPBOX_PROTOZERO_INCLUDE_DIRS to the mapbox/protozero include dir")
endif()
if(USE_EXTERNAL_MAPBOX_VARIANT)
find_path(MAPBOX_VARIANT_INCLUDE_DIRS "mapbox/variant.hpp")
else()
set(MAPBOX_VARIANT_INCLUDE_DIRS deps/mapbox/variant/include)
endif()
if(NOT MAPBOX_VARIANT_INCLUDE_DIRS)
message(FATAL_ERROR "Set MAPBOX_VARIANT_INCLUDE_DIRS to the mapbox/variant include dir")
endif()
add_library(mapnik-headers INTERFACE)
add_library(mapnik::headers ALIAS mapnik-headers)
target_include_directories(mapnik-headers INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
${MAPBOX_VARIANT_INCLUDE_DIRS}
${MAPBOX_PROTOZERO_INCLUDE_DIRS}
deps
)
target_link_libraries(mapnik-headers INTERFACE
Boost::boost
ICU::uc
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(mapnik-headers INTERFACE MAPNIK_EXPORTS)
endif()
install(TARGETS mapnik-headers
EXPORT MapnikTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include/
PUBLIC_HEADER DESTINATION include/
)
add_subdirectory(deps)
add_subdirectory(src)
#add_subdirectory(utils)
#add_subdirectory(plugins)

2
deps/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,2 @@
cmake_minimum_required(VERSION 3.15.0)
add_subdirectory(agg)

20
deps/agg/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.15.0)
project(agg)
add_library(agg INTERFACE)
add_library(mapnik::agg ALIAS agg)
target_include_directories(agg INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(agg INTERFACE mapnik::headers)
install(TARGETS agg
EXPORT MapnikTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include
)
# todo install headers

View file

@ -1,2 +1,2 @@
cmake_minimum_required(VERSION 3.15.0)
add_subdirectory(input)
add_subdirectory(input)

View file

@ -9,4 +9,4 @@ add_subdirectory(postgis)
add_subdirectory(raster)
add_subdirectory(shape)
add_subdirectory(sqlite)
add_subdirectory(topojson)
add_subdirectory(topojson)

284
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,284 @@
cmake_minimum_required(VERSION 3.15.0)
add_subdirectory(json)
add_subdirectory(wkt)
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()
set(MAPNIK_SOURCES
cairo_io.cpp
color_factory.cpp
color.cpp
config_error.cpp
conversions_numeric.cpp
conversions_string.cpp
dasharray_parser.cpp
datasource_cache_static.cpp
datasource_cache.cpp
debug.cpp
expression_grammar_x3.cpp
expression_node.cpp
expression_string.cpp
expression.cpp
feature_kv_iterator.cpp
feature_style_processor.cpp
feature_type_style.cpp
font_engine_freetype.cpp
font_set.cpp
fs.cpp
function_call.cpp
generate_image_filters.cpp
gradient.cpp
image_any.cpp
image_compositing.cpp
image_copy.cpp
image_filter_grammar_x3.cpp
image_options.cpp
image_reader.cpp
image_scaling.cpp
image_util_jpeg.cpp
image_util_png.cpp
image_util_tiff.cpp
image_util_webp.cpp
image_util.cpp
image_view_any.cpp
image_view.cpp
image.cpp
jpeg_reader.cpp
layer.cpp
libxml2_loader.cpp
load_map.cpp
map.cpp
mapped_memory_cache.cpp
marker_cache.cpp
marker_helpers.cpp
memory_datasource.cpp
palette.cpp
params.cpp
parse_image_filters.cpp
parse_path.cpp
parse_transform.cpp
path_expression_grammar_x3.cpp
plugin.cpp
png_reader.cpp
proj_transform.cpp
projection.cpp
rapidxml_loader.cpp
raster_colorizer.cpp
renderer_common.cpp
request.cpp
rule.cpp
save_map.cpp
scale_denominator.cpp
simplify.cpp
symbolizer_enumerations.cpp
symbolizer_keys.cpp
symbolizer.cpp
tiff_reader.cpp
transform_expression_grammar_x3.cpp
transform_expression.cpp
twkb.cpp
unicode.cpp
value.cpp
vertex_adapters.cpp
vertex_cache.cpp
warp.cpp
well_known_srs.cpp
wkb.cpp
xml_tree.cpp
)
set(AGG_COMPILE_SRC
../deps/agg/src/agg_arc.cpp
../deps/agg/src/agg_arrowhead.cpp
../deps/agg/src/agg_bezier_arc.cpp
../deps/agg/src/agg_bspline.cpp
../deps/agg/src/agg_curves.cpp
../deps/agg/src/agg_embedded_raster_fonts.cpp
../deps/agg/src/agg_gsv_text.cpp
../deps/agg/src/agg_image_filters.cpp
../deps/agg/src/agg_line_aa_basics.cpp
../deps/agg/src/agg_line_profile_aa.cpp
../deps/agg/src/agg_pixfmt_rgba.cpp
../deps/agg/src/agg_rounded_rect.cpp
../deps/agg/src/agg_sqrt_tables.cpp
../deps/agg/src/agg_trans_affine.cpp
../deps/agg/src/agg_trans_double_path.cpp
../deps/agg/src/agg_trans_single_path.cpp
../deps/agg/src/agg_trans_warp_magnifier.cpp
../deps/agg/src/agg_vcgen_bspline.cpp
../deps/agg/src/agg_vcgen_contour.cpp
../deps/agg/src/agg_vcgen_dash.cpp
../deps/agg/src/agg_vcgen_markers_term.cpp
../deps/agg/src/agg_vcgen_stroke.cpp
../deps/agg/src/agg_vpgen_clip_polygon.cpp
../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
agg/process_debug_symbolizer.cpp
agg/process_dot_symbolizer.cpp
agg/process_group_symbolizer.cpp
agg/process_line_pattern_symbolizer.cpp
agg/process_line_symbolizer.cpp
agg/process_markers_symbolizer.cpp
agg/process_point_symbolizer.cpp
agg/process_polygon_pattern_symbolizer.cpp
agg/process_polygon_symbolizer.cpp
agg/process_raster_symbolizer.cpp
agg/process_shield_symbolizer.cpp
agg/process_text_symbolizer.cpp
${AGG_COMPILE_SRC}
)
set(CAIRO_SRC
cairo/cairo_context.cpp
cairo/cairo_render_vector.cpp
cairo/cairo_renderer.cpp
cairo/process_building_symbolizer.cpp
cairo/process_debug_symbolizer.cpp
cairo/process_group_symbolizer.cpp
cairo/process_line_pattern_symbolizer.cpp
cairo/process_line_symbolizer.cpp
cairo/process_markers_symbolizer.cpp
cairo/process_point_symbolizer.cpp
cairo/process_polygon_pattern_symbolizer.cpp
cairo/process_polygon_symbolizer.cpp
cairo/process_raster_symbolizer.cpp
cairo/process_text_symbolizer.cpp
)
set(CSS_SRC
css/css_color_grammar_x3.cpp
css/css_grammar_x3.cpp
)
set(GEOMETRY_SRC
geometry/box2d.cpp
geometry/closest_point.cpp
geometry/envelope.cpp
geometry/interior.cpp
geometry/polylabel.cpp
geometry/reprojection.cpp
)
set(GRID_SRC
grid/grid_renderer.cpp
grid/grid.cpp
grid/process_building_symbolizer.cpp
grid/process_group_symbolizer.cpp
grid/process_line_pattern_symbolizer.cpp
grid/process_line_symbolizer.cpp
grid/process_markers_symbolizer.cpp
grid/process_point_symbolizer.cpp
grid/process_polygon_pattern_symbolizer.cpp
grid/process_polygon_symbolizer.cpp
grid/process_raster_symbolizer.cpp
grid/process_shield_symbolizer.cpp
grid/process_text_symbolizer.cpp
)
set(GROUP_SRC
group/group_layout_manager.cpp
group/group_rule.cpp
group/group_symbolizer_helper.cpp
)
set(RENDERER_COMMON_SRC
renderer_common/pattern_alignment.cpp
renderer_common/render_group_symbolizer.cpp
renderer_common/render_markers_symbolizer.cpp
renderer_common/render_pattern.cpp
renderer_common/render_thunk_extractor.cpp
)
set(SVG_SRC
svg/svg_parser.cpp
svg/svg_path_grammar_x3.cpp
svg/svg_path_parser.cpp
svg/svg_points_parser.cpp
svg/svg_transform_parser.cpp
svg/output/process_line_symbolizer.cpp
svg/output/process_polygon_symbolizer.cpp
svg/output/process_symbolizers.cpp
svg/output/svg_generator.cpp
svg/output/svg_output_attributes.cpp
svg/output/svg_output_grammars.cpp
svg/output/svg_renderer.cpp
)
set(TEXT_SRC
text/color_font_renderer.cpp
text/face.cpp
text/font_feature_settings.cpp
text/font_library.cpp
text/glyph_positions.cpp
text/itemizer.cpp
text/placement_finder.cpp
text/properties_util.cpp
text/renderer.cpp
text/scrptrun.cpp
text/symbolizer_helpers.cpp
text/text_layout.cpp
text/text_line.cpp
text/text_properties.cpp
text/formatting/base.cpp
text/formatting/format.cpp
text/formatting/layout.cpp
text/formatting/list.cpp
text/formatting/registry.cpp
text/formatting/text.cpp
text/placements/base.cpp
text/placements/dummy.cpp
text/placements/list.cpp
text/placements/registry.cpp
text/placements/simple.cpp
)
set(UTIL_SRC
util/math.cpp
util/utf_conv_win.cpp
)
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}
)
target_compile_definitions(mapnik PRIVATE MAPNIK_EXPORTS)
target_link_libraries(mapnik PRIVATE
mapnik::headers
mapnik::agg
)
install(TARGETS mapnik
EXPORT MapnikTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include/
PUBLIC_HEADER DESTINATION include/
)

34
src/json/CMakeLists.txt Normal file
View file

@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.15.0)
add_library(json STATIC
extract_bounding_boxes_x3.cpp
feature_from_geojson.cpp
feature_grammar_x3.cpp
generic_json_grammar_x3.cpp
geojson_grammar_x3.cpp
geometry_from_geojson.cpp
mapnik_feature_to_geojson.cpp
mapnik_geometry_to_geojson.cpp
mapnik_json_generator_grammar.cpp
parse_feature.cpp
positions_grammar_x3.cpp
topojson_grammar_x3.cpp
unicode_string_grammar_x3.cpp
)
add_library(mapnik::json ALIAS json)
target_include_directories(json PRIVATE
${JPEG_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
${MAPBOX_VARIANT_INCLUDE_DIRS}
)
target_link_libraries(json PRIVATE mapnik::headers ${ICUU_LIB})
install(TARGETS json
EXPORT MapnikTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

27
src/wkt/CMakeLists.txt Normal file
View file

@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.15.0)
add_library(wkt STATIC
geometry_to_wkt.cpp
mapnik_wkt_generator_grammar.cpp
wkt_factory.cpp
wkt_grammar_x3.cpp
)
add_library(mapnik::wkt ALIAS wkt)
target_include_directories(wkt PRIVATE
${MAPNIK_INCLUDE_PATH}
${JPEG_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${MAPBOX_POLYLABEL_INCLUDE_DIRS}
${MAPBOX_GEOMETRY_INCLUDE_DIRS}
${MAPBOX_VARIANT_INCLUDE_DIRS}
)
target_link_libraries(wkt PRIVATE mapnik::headers)
install(TARGETS wkt
EXPORT MapnikTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

View file

@ -5,4 +5,4 @@ add_subdirectory(mapnik-render)
add_subdirectory(ogrindex)
add_subdirectory(pgsql2sqlite)
add_subdirectory(shapeindex)
add_subdirectory(svg2png)
add_subdirectory(svg2png)