From 0eb0408cc3151bce31901f3d5f1ae16cd8d07e3e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 17:03:30 +0100 Subject: [PATCH] add options for grid/svg renderer --- CMakeLists.txt | 24 ++++++--- src/CMakeLists.txt | 68 +++++++++++++------------ test/CMakeLists.txt | 119 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 173 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be0195a6e..dc30e0b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,13 +14,15 @@ option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If 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) +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) option(USE_PROJ4 "adds proj4 support" ON) +option(USE_GRID_RENDERER "adds grid renderer" ON) +option(USE_SVG_RENDERER "adds grid renderer" ON) option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) @@ -164,6 +166,16 @@ if(USE_PROJ4) list(APPEND MAPNIK_OPTIONAL_LIBS proj) endif() +if(USE_GRID_RENDERER) + message(STATUS "Using grid renderer") + list(APPEND MAPNIK_COMPILE_DEFS GRID_RENDERER) +endif() + +if(USE_SVG_RENDERER) + message(STATUS "Using svg renderer") + list(APPEND MAPNIK_COMPILE_DEFS SVG_RENDERER) +endif() + add_library(headers INTERFACE) add_library(mapnik::headers ALIAS headers) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 534085ff5..e08138ee9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -180,22 +180,25 @@ set(GEOMETRY_SRC ) list(APPEND COMPILE_SRC ${GEOMETRY_SRC}) -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 -) -list(APPEND COMPILE_SRC ${GRID_SRC}) +if(USE_GRID_RENDERER) + message(STATUS "adding grid renderer to compilation") + 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 + ) + list(APPEND COMPILE_SRC ${GRID_SRC}) +endif() set(GROUP_SRC group/group_layout_manager.cpp @@ -213,22 +216,25 @@ set(RENDERER_COMMON_SRC ) list(APPEND COMPILE_SRC ${RENDERER_COMMON_SRC}) -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 +if(USE_SVG_RENDERER) + message(STATUS "adding svg renderer to compilation") + 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 -) -list(APPEND COMPILE_SRC ${SVG_SRC}) + 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 + ) + list(APPEND COMPILE_SRC ${SVG_SRC}) +endif() set(TEXT_SRC text/color_font_renderer.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fc1191739..35bba6998 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,6 +16,85 @@ target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) add_executable(mapnik-test-unit unit/run.cpp unit/color/css_color.cpp + unit/core/box2d_test.cpp + unit/core/comparison_test.cpp + unit/core/conversions_test.cpp + unit/core/copy_move_test.cpp + unit/core/exceptions_test.cpp + unit/core/expressions_test.cpp + unit/core/params_test.cpp + unit/core/transform_expressions_test.cpp + unit/core/value_test.cpp + unit/datasource/csv.cpp + unit/datasource/gdal.cpp + unit/datasource/geobuf.cpp + unit/datasource/geojson.cpp + unit/datasource/memory.cpp + unit/datasource/ogr.cpp + unit/datasource/postgis.cpp + unit/datasource/shapeindex.cpp + unit/datasource/spatial_index.cpp + unit/datasource/topojson.cpp + unit/font/fontset_runtime_test.cpp + unit/geometry/centroid.cpp + unit/geometry/closest_point.cpp + unit/geometry/geometry.cpp + unit/geometry/geometry_envelope_test.cpp + unit/geometry/geometry_hit_test.cpp + unit/geometry/geometry_is_simple.cpp + unit/geometry/geometry_is_valid.cpp + unit/geometry/geometry_reprojection.cpp + unit/geometry/geometry_strategy_test.cpp + unit/geometry/geometry_test_helper.cpp + unit/geometry/grid_vertex_converter.cpp + unit/geometry/interior.cpp + unit/geometry/is_clockwise.cpp + unit/geometry/is_empty.cpp + unit/geometry/polygon_vertex_processor.cpp + unit/geometry/polylabel.cpp + unit/geometry/remove_empty.cpp + unit/imaging/image.cpp + unit/imaging/image_apply_opacity.cpp + unit/imaging/image_filter.cpp + unit/imaging/image_io_test.cpp + unit/imaging/image_is_solid.cpp + unit/imaging/image_painted_test.cpp + unit/imaging/image_premultiply.cpp + unit/imaging/image_set_pixel.cpp + unit/imaging/image_view.cpp + unit/imaging/tiff_io.cpp + unit/imaging/webp_io.cpp + unit/map/background.cpp + unit/numerics/enumeration.cpp + unit/numerics/safe_cast.cpp + unit/pixel/agg_blend_src_over_test.cpp + unit/pixel/palette.cpp + unit/projection/proj_transform.cpp + unit/renderer/buffer_size_scale_factor.cpp + unit/renderer/cairo_io.cpp + unit/renderer/feature_style_processor.cpp + unit/serialization/wkb_formats_test.cpp + unit/serialization/wkb_test.cpp + unit/serialization/xml_parser_trim.cpp + unit/sql/sql_parse.cpp + unit/svg/svg_parser_test.cpp + unit/svg/svg_path_parser_test.cpp + unit/svg/svg_renderer_test.cpp + unit/symbolizer/marker_placement_vertex_last.cpp + unit/symbolizer/markers_point_placement.cpp + unit/symbolizer/symbolizer_test.cpp + unit/text/script_runs.cpp + unit/text/shaping.cpp + unit/text/text_placements_list.cpp + unit/text/text_placements_simple.cpp + unit/util/char_array_buffer.cpp + unit/vertex_adapter/clipping_test.cpp + unit/vertex_adapter/extend_converter.cpp + unit/vertex_adapter/line_offset_test.cpp + unit/vertex_adapter/offset_converter.cpp + unit/vertex_adapter/simplify_converters_test.cpp + unit/vertex_adapter/transform_path_adapter.cpp + unit/vertex_adapter/vertex_adapter.cpp ) target_link_libraries(mapnik-test-unit PUBLIC Catch @@ -24,8 +103,46 @@ target_link_libraries(mapnik-test-unit PUBLIC mapnik::mapnik ) +add_executable(agg_rasterizer_integer_overflow_test standalone/agg_rasterizer_integer_overflow_test.cpp) +target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC + Catch + +) + +add_executable(datasource_registration_test standalone/datasource_registration_test.cpp) +target_link_libraries(datasource_registration_test PUBLIC + Catch +) + +add_executable(font_registration_test standalone/font_registration_test.cpp) +target_link_libraries(font_registration_test PUBLIC + Catch +) + +add_executable(map_xml_test standalone/map_xml_test.cpp) +target_link_libraries(map_xml_test PUBLIC + Catch +) + +add_executable(mapnik-test-visual + visual/parse_map_sizes.cpp + visual/report.cpp + visual/runner.cpp + visual/run.cpp +) +target_link_libraries( + mapnik-test-visual PRIVATE + Boost::program_options + mapnik::headers + mapnik::mapnik +) + include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) -ParseAndAddCatchTests(mapnik-test-unit) \ No newline at end of file +ParseAndAddCatchTests(mapnik-test-unit) +catch_discover_tests(agg_rasterizer_integer_overflow_test) +catch_discover_tests(datasource_registration_test) +catch_discover_tests(font_registration_test) +catch_discover_tests(map_xml_test) \ No newline at end of file