From 945e57286b399a2b8aa61af1c067b5ed4147c2ef Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 18:20:43 +0100 Subject: [PATCH 001/141] initial cmake scripts --- .gitignore | 3 +++ CMakeLists.txt | 7 +++++++ plugins/CMakeLists.txt | 2 ++ plugins/input/CMakeLists.txt | 12 ++++++++++++ utils/CMakeLists.txt | 8 ++++++++ 5 files changed, 32 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 plugins/CMakeLists.txt create mode 100644 plugins/input/CMakeLists.txt create mode 100644 utils/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 2ecdd4b32..922bdcf21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.vscode *.gcov *.gcda *.gcno @@ -56,3 +57,5 @@ demo/viewer/ui_layer_info.h test/standalone/*-bin test/unit/run test/visual/run +# cmake +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..ecad3a171 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15.0) +project(mapnik + VERSION 3.0.24 + HOMEPAGE_URL "https://mapnik.org/" + DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" + LANGUAGES CXX +) \ No newline at end of file diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt new file mode 100644 index 000000000..17e4ecbd7 --- /dev/null +++ b/plugins/CMakeLists.txt @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.15.0) +add_subdirectory(input) \ No newline at end of file diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt new file mode 100644 index 000000000..edbb7c5e3 --- /dev/null +++ b/plugins/input/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15.0) +add_subdirectory(csv) +add_subdirectory(gdal) +add_subdirectory(geobuf) +add_subdirectory(geojson) +add_subdirectory(ogr) +add_subdirectory(pgraster) +add_subdirectory(postgis) +add_subdirectory(raster) +add_subdirectory(shape) +add_subdirectory(sqlite) +add_subdirectory(topojson) \ No newline at end of file diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt new file mode 100644 index 000000000..e2f28bb11 --- /dev/null +++ b/utils/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15.0) +add_subdirectory(geometry_to_wkb) +add_subdirectory(mapnik-index) +add_subdirectory(mapnik-render) +add_subdirectory(ogrindex) +add_subdirectory(pgsql2sqlite) +add_subdirectory(shapeindex) +add_subdirectory(svg2png) \ No newline at end of file From f6b7bc086739d9ae6c8f44c394c54229c4dc5379 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 19:04:30 +0100 Subject: [PATCH 002/141] add string to box2d which is required by msvc --- include/mapnik/geometry/box2d.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/mapnik/geometry/box2d.hpp b/include/mapnik/geometry/box2d.hpp index dc5fd4666..b858a9aa9 100644 --- a/include/mapnik/geometry/box2d.hpp +++ b/include/mapnik/geometry/box2d.hpp @@ -33,6 +33,9 @@ MAPNIK_DISABLE_WARNING_PUSH #include MAPNIK_DISABLE_WARNING_POP +// stl +#include + // agg // forward declare so that apps using mapnik do not need agg headers namespace agg { From fe3160ca996922e122f2aa629280f51ad9445ae3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 20:02:40 +0100 Subject: [PATCH 003/141] fix mscv compiler errors --- include/mapnik/config.hpp | 11 +++++++++++ include/mapnik/geometry.hpp | 3 ++- include/mapnik/json/geojson_grammar_x3.hpp | 3 ++- include/mapnik/json/json_value.hpp | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index ac48546f2..65b370784 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -50,6 +50,17 @@ # endif #endif +#if defined(__clang__) +#if __has_feature(cxx_inheriting_constructors) +#define MAPNIK_USE_INHERITING_CONSTRUCTORS 1 +#endif +#elif (defined(__GNUC__) && \ + (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \ + (__cpp_inheriting_constructors >= 200802) || \ + (defined(_MSC_VER) && _MSC_VER >= 1910) +#define MAPNIK_USE_INHERITING_CONSTRUCTORS 1 +#endif + #define PROJ_ENVELOPE_POINTS 20 #endif // MAPNIK_CONFIG_HPP diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index f6e795de9..dccd25371 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -24,6 +24,7 @@ #define MAPNIK_GEOMETRY_HPP // mapnik +#include #include #include #include @@ -59,7 +60,7 @@ struct geometry : geometry_base { using coordinate_type = T; -#if __cpp_inheriting_constructors >= 200802 +#if MAPNIK_USE_INHERITING_CONSTRUCTORS using geometry_base::geometry_base; diff --git a/include/mapnik/json/geojson_grammar_x3.hpp b/include/mapnik/json/geojson_grammar_x3.hpp index 3f44d1066..e840c3436 100644 --- a/include/mapnik/json/geojson_grammar_x3.hpp +++ b/include/mapnik/json/geojson_grammar_x3.hpp @@ -23,6 +23,7 @@ #ifndef MAPNIK_JSON_GEOJSON_GRAMMAR_X3_HPP #define MAPNIK_JSON_GEOJSON_GRAMMAR_X3_HPP +#include #include #include #include @@ -54,7 +55,7 @@ using geojson_value_base = mapnik::util::variant; struct geojson_value : geojson_value_base { -#if __cpp_inheriting_constructors >= 200802 +#if MAPNIK_USE_INHERITING_CONSTRUCTORS using geojson_value_base::geojson_value_base; diff --git a/include/mapnik/json/json_value.hpp b/include/mapnik/json/json_value.hpp index c5ed03604..2157ce595 100644 --- a/include/mapnik/json/json_value.hpp +++ b/include/mapnik/json/json_value.hpp @@ -24,6 +24,7 @@ #define MAPNIK_JSON_JSON_VALUE_HPP // mapnik +#include #include #include // stl @@ -46,7 +47,7 @@ using json_value_base = mapnik::util::variant; struct json_value : json_value_base { -#if __cpp_inheriting_constructors >= 200802 +#if MAPNIK_USE_INHERITING_CONSTRUCTORS using json_value_base::json_value_base; From 621ab999614a9c4c8f02294053542b09ae530e10 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 20:11:42 +0100 Subject: [PATCH 004/141] Revert "fix mscv compiler errors" This reverts commit fe3160ca996922e122f2aa629280f51ad9445ae3. --- include/mapnik/config.hpp | 11 ----------- include/mapnik/geometry.hpp | 3 +-- include/mapnik/json/geojson_grammar_x3.hpp | 3 +-- include/mapnik/json/json_value.hpp | 3 +-- 4 files changed, 3 insertions(+), 17 deletions(-) diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index 65b370784..ac48546f2 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -50,17 +50,6 @@ # endif #endif -#if defined(__clang__) -#if __has_feature(cxx_inheriting_constructors) -#define MAPNIK_USE_INHERITING_CONSTRUCTORS 1 -#endif -#elif (defined(__GNUC__) && \ - (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \ - (__cpp_inheriting_constructors >= 200802) || \ - (defined(_MSC_VER) && _MSC_VER >= 1910) -#define MAPNIK_USE_INHERITING_CONSTRUCTORS 1 -#endif - #define PROJ_ENVELOPE_POINTS 20 #endif // MAPNIK_CONFIG_HPP diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index dccd25371..f6e795de9 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -24,7 +24,6 @@ #define MAPNIK_GEOMETRY_HPP // mapnik -#include #include #include #include @@ -60,7 +59,7 @@ struct geometry : geometry_base { using coordinate_type = T; -#if MAPNIK_USE_INHERITING_CONSTRUCTORS +#if __cpp_inheriting_constructors >= 200802 using geometry_base::geometry_base; diff --git a/include/mapnik/json/geojson_grammar_x3.hpp b/include/mapnik/json/geojson_grammar_x3.hpp index e840c3436..3f44d1066 100644 --- a/include/mapnik/json/geojson_grammar_x3.hpp +++ b/include/mapnik/json/geojson_grammar_x3.hpp @@ -23,7 +23,6 @@ #ifndef MAPNIK_JSON_GEOJSON_GRAMMAR_X3_HPP #define MAPNIK_JSON_GEOJSON_GRAMMAR_X3_HPP -#include #include #include #include @@ -55,7 +54,7 @@ using geojson_value_base = mapnik::util::variant; struct geojson_value : geojson_value_base { -#if MAPNIK_USE_INHERITING_CONSTRUCTORS +#if __cpp_inheriting_constructors >= 200802 using geojson_value_base::geojson_value_base; diff --git a/include/mapnik/json/json_value.hpp b/include/mapnik/json/json_value.hpp index 2157ce595..c5ed03604 100644 --- a/include/mapnik/json/json_value.hpp +++ b/include/mapnik/json/json_value.hpp @@ -24,7 +24,6 @@ #define MAPNIK_JSON_JSON_VALUE_HPP // mapnik -#include #include #include // stl @@ -47,7 +46,7 @@ using json_value_base = mapnik::util::variant; struct json_value : json_value_base { -#if MAPNIK_USE_INHERITING_CONSTRUCTORS +#if __cpp_inheriting_constructors >= 200802 using json_value_base::json_value_base; From 5420ccd6af19a2df999197d4d8043467fd79c5de Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 20:16:27 +0100 Subject: [PATCH 005/141] now fix msvc compiler error. Why does msvc complain? --- include/mapnik/geometry.hpp | 2 +- include/mapnik/json/geojson_grammar_x3.hpp | 2 +- include/mapnik/json/json_value.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mapnik/geometry.hpp b/include/mapnik/geometry.hpp index f6e795de9..44b9931b4 100644 --- a/include/mapnik/geometry.hpp +++ b/include/mapnik/geometry.hpp @@ -59,7 +59,7 @@ struct geometry : geometry_base { using coordinate_type = T; -#if __cpp_inheriting_constructors >= 200802 +#if __cpp_inheriting_constructors >= 200802 && !defined (_MSC_VER) using geometry_base::geometry_base; diff --git a/include/mapnik/json/geojson_grammar_x3.hpp b/include/mapnik/json/geojson_grammar_x3.hpp index 3f44d1066..a4f713637 100644 --- a/include/mapnik/json/geojson_grammar_x3.hpp +++ b/include/mapnik/json/geojson_grammar_x3.hpp @@ -54,7 +54,7 @@ using geojson_value_base = mapnik::util::variant; struct geojson_value : geojson_value_base { -#if __cpp_inheriting_constructors >= 200802 +#if __cpp_inheriting_constructors >= 200802 && !defined (_MSC_VER) using geojson_value_base::geojson_value_base; diff --git a/include/mapnik/json/json_value.hpp b/include/mapnik/json/json_value.hpp index c5ed03604..150a80f21 100644 --- a/include/mapnik/json/json_value.hpp +++ b/include/mapnik/json/json_value.hpp @@ -46,7 +46,7 @@ using json_value_base = mapnik::util::variant; struct json_value : json_value_base { -#if __cpp_inheriting_constructors >= 200802 +#if __cpp_inheriting_constructors >= 200802 && !defined (_MSC_VER) using json_value_base::json_value_base; From e6f6d0f1336b93f595e6132bb767ff350e25f48e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 20:20:28 +0100 Subject: [PATCH 006/141] more cmake --- CMakeLists.txt | 82 +++++++++- deps/CMakeLists.txt | 2 + deps/agg/CMakeLists.txt | 20 +++ plugins/CMakeLists.txt | 2 +- plugins/input/CMakeLists.txt | 2 +- src/CMakeLists.txt | 284 +++++++++++++++++++++++++++++++++++ src/json/CMakeLists.txt | 34 +++++ src/wkt/CMakeLists.txt | 27 ++++ utils/CMakeLists.txt | 2 +- 9 files changed, 451 insertions(+), 4 deletions(-) create mode 100644 deps/CMakeLists.txt create mode 100644 deps/agg/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/json/CMakeLists.txt create mode 100644 src/wkt/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index ecad3a171..f36951287 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,4 +4,84 @@ project(mapnik HOMEPAGE_URL "https://mapnik.org/" DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" LANGUAGES CXX -) \ No newline at end of file +) + +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 + $ + $ + ${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) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt new file mode 100644 index 000000000..69527cdfe --- /dev/null +++ b/deps/CMakeLists.txt @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.15.0) +add_subdirectory(agg) \ No newline at end of file diff --git a/deps/agg/CMakeLists.txt b/deps/agg/CMakeLists.txt new file mode 100644 index 000000000..ef505cdfa --- /dev/null +++ b/deps/agg/CMakeLists.txt @@ -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 + $ + $ +) +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 diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 17e4ecbd7..f53de93d3 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,2 +1,2 @@ cmake_minimum_required(VERSION 3.15.0) -add_subdirectory(input) \ No newline at end of file +add_subdirectory(input) diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index edbb7c5e3..8ad1e3986 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -9,4 +9,4 @@ add_subdirectory(postgis) add_subdirectory(raster) add_subdirectory(shape) add_subdirectory(sqlite) -add_subdirectory(topojson) \ No newline at end of file +add_subdirectory(topojson) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..3c8e738e2 --- /dev/null +++ b/src/CMakeLists.txt @@ -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/ +) \ No newline at end of file diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt new file mode 100644 index 000000000..f5cea0f77 --- /dev/null +++ b/src/json/CMakeLists.txt @@ -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 +) \ No newline at end of file diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt new file mode 100644 index 000000000..3725724f8 --- /dev/null +++ b/src/wkt/CMakeLists.txt @@ -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 +) \ No newline at end of file diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index e2f28bb11..8ad98aeb5 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -5,4 +5,4 @@ add_subdirectory(mapnik-render) add_subdirectory(ogrindex) add_subdirectory(pgsql2sqlite) add_subdirectory(shapeindex) -add_subdirectory(svg2png) \ No newline at end of file +add_subdirectory(svg2png) From d86a90a10ac0427551a835c662c987cf06abd3bd Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 20 Nov 2020 21:15:27 +0100 Subject: [PATCH 007/141] more cmake --- CMakeLists.txt | 55 +++++++++++++- cmake/FindCairo.cmake | 109 +++++++++++++++++++++++++++ src/CMakeLists.txt | 55 ++++++++------ src/json/CMakeLists.txt | 2 +- src/wkt/CMakeLists.txt | 2 +- utils/geometry_to_wkb/CMakeLists.txt | 8 ++ utils/mapnik-index/CMakeLists.txt | 10 +++ utils/mapnik-render/CMakeLists.txt | 7 ++ utils/ogrindex/CMakeLists.txt | 7 ++ utils/pgsql2sqlite/CMakeLists.txt | 10 +++ utils/shapeindex/CMakeLists.txt | 9 +++ utils/svg2png/CMakeLists.txt | 9 +++ 12 files changed, 256 insertions(+), 27 deletions(-) create mode 100644 cmake/FindCairo.cmake create mode 100644 utils/geometry_to_wkb/CMakeLists.txt create mode 100644 utils/mapnik-index/CMakeLists.txt create mode 100644 utils/mapnik-render/CMakeLists.txt create mode 100644 utils/ogrindex/CMakeLists.txt create mode 100644 utils/pgsql2sqlite/CMakeLists.txt create mode 100644 utils/shapeindex/CMakeLists.txt create mode 100644 utils/svg2png/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index f36951287..afb787b2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,9 @@ project(mapnik LANGUAGES CXX ) -option(BUILD_SHARED_LIBS ON) +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) @@ -16,6 +18,13 @@ set(CXX_STANDARD 17) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) find_package(ICU REQUIRED COMPONENTS uc) +find_package(Freetype REQUIRED) +find_package(PNG REQUIRED) +find_package(JPEG REQUIRED) +find_package(TIFF REQUIRED) +find_package(WebP CONFIG REQUIRED) +find_package(LibXml2 REQUIRED) +find_package(Cairo) if(USE_EXTERNAL_MAPBOX_GEOMETRY) find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp") @@ -53,6 +62,41 @@ if(NOT MAPBOX_VARIANT_INCLUDE_DIRS) message(FATAL_ERROR "Set MAPBOX_VARIANT_INCLUDE_DIRS to the mapbox/variant include dir") endif() +set(MAPNIK_COMPILE_DEFS "") +set(MAPNIK_OPTIONAL_LIBS "") + +if(LibXml2_FOUND) + 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) + set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_PNG) + message(STATUS "Using PNG") +endif() + +if(JPEG_FOUND) + set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_JPEG) + message(STATUS "Using JPEG") +endif() + +if(TIFF_FOUND) + set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_TIFF) + message(STATUS "Using TIFF") +endif() + +if(WebP_FOUND) + set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_WEBP) + message(STATUS "Using WEBP") +endif() + +if(Cairo_FOUND) + 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) add_library(mapnik::headers ALIAS mapnik-headers) @@ -67,7 +111,14 @@ target_include_directories(mapnik-headers INTERFACE ) target_link_libraries(mapnik-headers INTERFACE Boost::boost + Boost::regex + Boost::filesystem ICU::uc + Freetype::Freetype + PNG::PNG + TIFF::TIFF + JPEG::JPEG + ${MAPNIK_OPTIONAL_LIBS} ) if(BUILD_SHARED_LIBS) target_compile_definitions(mapnik-headers INTERFACE MAPNIK_EXPORTS) @@ -81,7 +132,9 @@ install(TARGETS mapnik-headers INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ ) + add_subdirectory(deps) add_subdirectory(src) +add_subdirectory(utils) #add_subdirectory(utils) #add_subdirectory(plugins) diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake new file mode 100644 index 000000000..5bf2d339d --- /dev/null +++ b/cmake/FindCairo.cmake @@ -0,0 +1,109 @@ +# Copyright (C) 2020 Sony Interactive Entertainment Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#[=======================================================================[.rst: +FindCairo +-------------- + +Find Cairo headers and libraries. + +Imported Targets +^^^^^^^^^^^^^^^^ + +``Cairo::Cairo`` + The Cairo library, if found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables in your project: + +``Cairo_FOUND`` + true if (the requested version of) Cairo is available. +``Cairo_VERSION`` + the version of Cairo. +``Cairo_LIBRARIES`` + the libraries to link against to use Cairo. +``Cairo_INCLUDE_DIRS`` + where to find the Cairo headers. +``Cairo_COMPILE_OPTIONS`` + this should be passed to target_compile_options(), if the + target is not used for linking + +#]=======================================================================] + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_CAIRO QUIET cairo) +set(Cairo_COMPILE_OPTIONS ${PC_CAIRO_CFLAGS_OTHER}) +set(Cairo_VERSION ${PC_CAIRO_VERSION}) + +find_path(Cairo_INCLUDE_DIR + NAMES cairo.h + HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR} + PATH_SUFFIXES cairo +) + +find_library(Cairo_LIBRARY + NAMES ${Cairo_NAMES} cairo + HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS} +) + +if (Cairo_INCLUDE_DIR AND NOT Cairo_VERSION) + if (EXISTS "${Cairo_INCLUDE_DIR}/cairo-version.h") + file(READ "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_CONTENT) + + string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}") + set(Cairo_VERSION_MAJOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}") + set(Cairo_VERSION_MINOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}") + set(Cairo_VERSION_PATCH "${CMAKE_MATCH_1}") + + set(Cairo_VERSION "${Cairo_VERSION_MAJOR}.${Cairo_VERSION_MINOR}.${Cairo_VERSION_PATCH}") + endif () +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cairo + FOUND_VAR Cairo_FOUND + REQUIRED_VARS Cairo_LIBRARY Cairo_INCLUDE_DIR + VERSION_VAR Cairo_VERSION +) + +if (Cairo_LIBRARY AND NOT TARGET Cairo::Cairo) + add_library(Cairo::Cairo UNKNOWN IMPORTED GLOBAL) + set_target_properties(Cairo::Cairo PROPERTIES + IMPORTED_LOCATION "${Cairo_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Cairo_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Cairo_INCLUDE_DIR}" + ) +endif () + +mark_as_advanced(Cairo_INCLUDE_DIR Cairo_LIBRARIES) + +if (Cairo_FOUND) + set(Cairo_LIBRARIES ${Cairo_LIBRARY}) + set(Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR}) +endif () \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c8e738e2..991887359 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,7 +49,6 @@ set(MAPNIK_SOURCES image.cpp jpeg_reader.cpp layer.cpp - libxml2_loader.cpp load_map.cpp map.cpp mapped_memory_cache.cpp @@ -66,7 +65,6 @@ set(MAPNIK_SOURCES png_reader.cpp proj_transform.cpp projection.cpp - rapidxml_loader.cpp raster_colorizer.cpp renderer_common.cpp request.cpp @@ -137,23 +135,24 @@ set(AGG_SRC ${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 -) +if(Cairo_FOUND) + 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 + ) +endif() set(CSS_SRC css/css_color_grammar_x3.cpp @@ -250,6 +249,14 @@ set(UTIL_SRC util/utf_conv_win.cpp ) +if(LibXml2_FOUND) + set(COMPILE_SRC ${COMPILE_SRC} libxml2_loader.cpp) +else() + set(COMPILE_SRC ${COMPILE_SRC} rapidxml_loader.cpp) +endif() + + + set(COMPILE_SRC ${MAPNIK_SOURCES} ${AGG_SRC} @@ -264,11 +271,11 @@ set(COMPILE_SRC ${UTIL_SRC} ) -add_library(mapnik - ${COMPILE_SRC} -) +add_library(mapnik ${COMPILE_SRC}) +add_library(mapnik::mapnik ALIAS mapnik) -target_compile_definitions(mapnik PRIVATE MAPNIK_EXPORTS) + +target_compile_definitions(mapnik PRIVATE ${MAPNIK_EXPORTS} ${MAPNIK_COMPILE_DEFS}) target_link_libraries(mapnik PRIVATE mapnik::headers mapnik::agg @@ -281,4 +288,4 @@ install(TARGETS mapnik RUNTIME DESTINATION bin INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ -) \ No newline at end of file +) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index f5cea0f77..c3b818387 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -31,4 +31,4 @@ install(TARGETS json LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin -) \ No newline at end of file +) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 3725724f8..82de6f9cf 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -24,4 +24,4 @@ install(TARGETS wkt LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin -) \ No newline at end of file +) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt new file mode 100644 index 000000000..b721708bf --- /dev/null +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(geometry_to_wkb main.cpp) + +target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) + +install(TARGETS geometry_to_wkb + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt new file mode 100644 index 000000000..1fe9717f5 --- /dev/null +++ b/utils/mapnik-index/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(mapnik-index + mapnik-index.cpp + process_csv_file.cpp + process_geojson_file_x3.cpp +) +target_link_libraries(mapnik-index PRIVATE mapnik::mapnik) +install(TARGETS mapnik-index + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt new file mode 100644 index 000000000..74f09aa1d --- /dev/null +++ b/utils/mapnik-render/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(mapnik-render mapnik-render.cpp) + +target_link_libraries(mapnik-render PRIVATE mapnik::mapnik) +install(TARGETS mapnik-render + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt new file mode 100644 index 000000000..86edc72a7 --- /dev/null +++ b/utils/ogrindex/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable(ogrindex ogrindex.cpp) + +target_link_libraries(ogrindex PRIVATE mapnik::mapnik) +install(TARGETS ogrindex + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt new file mode 100644 index 000000000..90db76f4f --- /dev/null +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(pgsql2sqlite + main.cpp + sqlite.cpp +) + +target_link_libraries(pgsql2sqlite PRIVATE mapnik::mapnik) +install(TARGETS pgsql2sqlite + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt new file mode 100644 index 000000000..5a2f72ad7 --- /dev/null +++ b/utils/shapeindex/CMakeLists.txt @@ -0,0 +1,9 @@ +add_executable(shapeindex + shapeindex.cpp +) + +target_link_libraries(shapeindex PRIVATE mapnik::mapnik) +install(TARGETS shapeindex + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt new file mode 100644 index 000000000..abf3de3ba --- /dev/null +++ b/utils/svg2png/CMakeLists.txt @@ -0,0 +1,9 @@ +add_executable(svg2png + svg2png.cpp +) + +target_link_libraries(svg2png PRIVATE mapnik::mapnik) +install(TARGETS svg2png + EXPORT MapnikTargets + RUNTIME DESTINATION bin +) \ No newline at end of file From 895d89a125dcca3aec6bd5fd14425f0dcf10e291 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 09:46:54 +0100 Subject: [PATCH 008/141] optional libraries --- CMakeLists.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afb787b2d..fe01dcafc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,11 +19,12 @@ set(CXX_STANDARD 17) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) find_package(ICU REQUIRED COMPONENTS uc) find_package(Freetype REQUIRED) -find_package(PNG REQUIRED) -find_package(JPEG REQUIRED) -find_package(TIFF REQUIRED) -find_package(WebP CONFIG REQUIRED) -find_package(LibXml2 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) @@ -73,21 +74,25 @@ endif() if(PNG_FOUND) 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) 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) 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) set(MAPNIK_COMPILE_DEFS ${MAPNIK_COMPILE_DEFS} HAVE_WEBP) + set(MAPNIK_OPTIONAL_LIBS ${MAPNIK_OPTIONAL_LIBS} WebP::webp) message(STATUS "Using WEBP") endif() @@ -115,9 +120,7 @@ target_link_libraries(mapnik-headers INTERFACE Boost::filesystem ICU::uc Freetype::Freetype - PNG::PNG - TIFF::TIFF - JPEG::JPEG + harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} ) if(BUILD_SHARED_LIBS) From 7d46eda60dcf6b12382143a91ef267b0e704e67d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 10:09:29 +0100 Subject: [PATCH 009/141] more options --- CMakeLists.txt | 51 +++++++++++++++++++++++++--------------------- src/CMakeLists.txt | 39 ++++++++++++++++------------------- 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe01dcafc..1a51415e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 991887359..a947f0cd5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) From 6254f7c09e55b2ac3209156d56c4da0d6cb57948 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 11:34:45 +0100 Subject: [PATCH 010/141] more cmake --- CMakeLists.txt | 114 ++++++++++++++++++++------ cmake/MapnikConfig.cmake.in | 5 ++ plugins/input/CMakeLists.txt | 55 ++++++++++--- plugins/input/csv/CMakeLists.txt | 31 +++++++ plugins/input/gdal/CMakeLists.txt | 29 +++++++ plugins/input/geobuf/CMakeLists.txt | 25 ++++++ plugins/input/geojson/CMakeLists.txt | 29 +++++++ plugins/input/ogr/CMakeLists.txt | 31 +++++++ plugins/input/pgraster/CMakeLists.txt | 30 +++++++ plugins/input/postgis/CMakeLists.txt | 29 +++++++ plugins/input/raster/CMakeLists.txt | 27 ++++++ plugins/input/shape/CMakeLists.txt | 30 +++++++ plugins/input/sqlite/CMakeLists.txt | 29 +++++++ plugins/input/topojson/CMakeLists.txt | 27 ++++++ src/CMakeLists.txt | 2 +- utils/geometry_to_wkb/CMakeLists.txt | 2 +- utils/mapnik-index/CMakeLists.txt | 9 +- utils/mapnik-render/CMakeLists.txt | 6 +- utils/ogrindex/CMakeLists.txt | 2 +- utils/pgsql2sqlite/CMakeLists.txt | 2 +- utils/shapeindex/CMakeLists.txt | 2 +- utils/svg2png/CMakeLists.txt | 2 +- 22 files changed, 473 insertions(+), 45 deletions(-) create mode 100644 cmake/MapnikConfig.cmake.in create mode 100644 plugins/input/csv/CMakeLists.txt create mode 100644 plugins/input/gdal/CMakeLists.txt create mode 100644 plugins/input/geobuf/CMakeLists.txt create mode 100644 plugins/input/geojson/CMakeLists.txt create mode 100644 plugins/input/ogr/CMakeLists.txt create mode 100644 plugins/input/pgraster/CMakeLists.txt create mode 100644 plugins/input/postgis/CMakeLists.txt create mode 100644 plugins/input/raster/CMakeLists.txt create mode 100644 plugins/input/shape/CMakeLists.txt create mode 100644 plugins/input/sqlite/CMakeLists.txt create mode 100644 plugins/input/topojson/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a51415e7..e275491b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,18 @@ option(USE_WEBP "Adds webp support" ON) option(USE_LIBXML2 "Adds libxml2 support" ON) option(USE_CAIRO "Adds the cairo renderer" ON) +option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) +option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) +option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON) +option(USE_PLUGIN_INPUT_GEOJSON "adds plugin input geojson" ON) +option(USE_PLUGIN_INPUT_OGR "adds plugin input ogr" ON) +option(USE_PLUGIN_INPUT_PGRASTER "adds plugin input pgraster" ON) +option(USE_PLUGIN_INPUT_POSTGIS "adds plugin input postgis" ON) +option(USE_PLUGIN_INPUT_RASTER "adds plugin input raster" ON) +option(USE_PLUGIN_INPUT_SHAPE "adds plugin input shape" ON) +option(USE_PLUGIN_INPUT_SQLITE "adds plugin input sqlite" ON) +option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON) + set(CXX_STANDARD 17) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) @@ -28,36 +40,61 @@ find_package(Freetype REQUIRED) find_package(harfbuzz CONFIG REQUIRED) if(USE_EXTERNAL_MAPBOX_GEOMETRY) - find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp") + # provide a way to specify the include dirs with the CACHE VARIABLES + if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS) + message(STATUS "Searching for the include dir of mapbox/geometry.hpp") + find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp" REQUIRED) + endif() else() - set(MAPBOX_GEOMETRY_INCLUDE_DIRS deps/mapbox/geometry/include) + set(MAPBOX_GEOMETRY_INCLUDE_DIRS + $ + $ + ) endif() if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS) - message(FATAL_ERROR "Set MAPBOX_GEOMETRY_INCLUDE_DIRS to the mapbox/geometry.hpp include dir") + message(FATAL_ERROR "Set -DMAPBOX_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") + if(NOT MAPBOX_POLYLABEL_INCLUDE_DIRS) + message(STATUS "Searching for the include dir of mapbox/polylabel") + find_path(MAPBOX_POLYLABEL_INCLUDE_DIRS "mapbox/polylabel.hpp") + endif() else() - set(MAPBOX_POLYLABEL_INCLUDE_DIRS deps/mapbox/polylabel/include) + set(MAPBOX_POLYLABEL_INCLUDE_DIRS + $ + $ + ) 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") + if(NOT MAPBOX_PROTOZERO_INCLUDE_DIRS) + message(STATUS "Searching for the include dir of mapbox/protozero") + find_path(MAPBOX_PROTOZERO_INCLUDE_DIRS "protozero/pbf_message.hpp") + endif() else() - set(MAPBOX_PROTOZERO_INCLUDE_DIRS deps/mapbox/protozero/include) + set(MAPBOX_PROTOZERO_INCLUDE_DIRS + $ + $ + ) 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") + if(NOT MAPBOX_VARIANT_INCLUDE_DIRS) + message(STATUS "Searching for the include dir of mapbox/variant") + find_path(MAPBOX_VARIANT_INCLUDE_DIRS "mapbox/variant.hpp") + endif() else() - set(MAPBOX_VARIANT_INCLUDE_DIRS deps/mapbox/variant/include) + set(MAPBOX_VARIANT_INCLUDE_DIRS + $ + $ + ) endif() if(NOT MAPBOX_VARIANT_INCLUDE_DIRS) message(FATAL_ERROR "Set MAPBOX_VARIANT_INCLUDE_DIRS to the mapbox/variant include dir") @@ -69,47 +106,48 @@ set(MAPNIK_OPTIONAL_LIBS "") 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) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) + list(APPEND MAPNIK_OPTIONAL_LIBS LibXml2::LibXml2) endif() 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) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_PNG) + list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() 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) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) + list(APPEND MAPNIK_OPTIONAL_LIBS JPEG::JPEG) endif() 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) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_TIFF) + list(APPEND MAPNIK_OPTIONAL_LIBS TIFF::TIFF) endif() 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) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP) + list(APPEND MAPNIK_OPTIONAL_LIBS WebP::webp) endif() 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) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO) + list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) endif() add_library(mapnik-headers INTERFACE) add_library(mapnik::headers ALIAS mapnik-headers) +# todo: mapbox includes need to included private. target_include_directories(mapnik-headers INTERFACE $ $ @@ -117,7 +155,8 @@ target_include_directories(mapnik-headers INTERFACE ${MAPBOX_POLYLABEL_INCLUDE_DIRS} ${MAPBOX_VARIANT_INCLUDE_DIRS} ${MAPBOX_PROTOZERO_INCLUDE_DIRS} - deps + $ + $ ) target_link_libraries(mapnik-headers INTERFACE Boost::boost @@ -128,9 +167,7 @@ target_link_libraries(mapnik-headers INTERFACE harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} ) -if(BUILD_SHARED_LIBS) - target_compile_definitions(mapnik-headers INTERFACE MAPNIK_EXPORTS) -endif() +target_compile_definitions(mapnik-headers INTERFACE ${MAPNIK_COMPILE_DEFS}) install(TARGETS mapnik-headers EXPORT MapnikTargets @@ -143,6 +180,31 @@ install(TARGETS mapnik-headers add_subdirectory(deps) add_subdirectory(src) -add_subdirectory(utils) +add_subdirectory(plugins) +#add_subdirectory(utils) #add_subdirectory(utils) #add_subdirectory(plugins) + + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion +) + +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MapnikConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" + INSTALL_DESTINATION lib/cmake/mapnik +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" + DESTINATION lib/cmake/mapnik +) +install(EXPORT MapnikTargets + FILE MapnikTargets.cmake + NAMESPACE mapnik:: + DESTINATION lib/cmake/mapnik +) diff --git a/cmake/MapnikConfig.cmake.in b/cmake/MapnikConfig.cmake.in new file mode 100644 index 000000000..db991109b --- /dev/null +++ b/cmake/MapnikConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") + +check_required_components(mapnik) \ No newline at end of file diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 8ad1e3986..78250545b 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -1,12 +1,45 @@ cmake_minimum_required(VERSION 3.15.0) -add_subdirectory(csv) -add_subdirectory(gdal) -add_subdirectory(geobuf) -add_subdirectory(geojson) -add_subdirectory(ogr) -add_subdirectory(pgraster) -add_subdirectory(postgis) -add_subdirectory(raster) -add_subdirectory(shape) -add_subdirectory(sqlite) -add_subdirectory(topojson) +if(USE_PLUGIN_INPUT_CSV) + message(STATUS "using input plugin csv") + add_subdirectory(csv) +endif() +if(USE_PLUGIN_INPUT_GDAL) + message(STATUS "using input plugin gdal") + add_subdirectory(gdal) +endif() +if(USE_PLUGIN_INPUT_GEOBUF) + message(STATUS "using input plugin geobuf") + add_subdirectory(geobuf) +endif() +if(USE_PLUGIN_INPUT_GEOJSON) + message(STATUS "using input plugin geojson") + add_subdirectory(geojson) +endif() +if(USE_PLUGIN_INPUT_OGR) + message(STATUS "using input plugin ogr") + add_subdirectory(ogr) +endif() +if(USE_PLUGIN_INPUT_PGRASTER) + message(STATUS "using input plugin pgraster") + add_subdirectory(pgraster) +endif() +if(USE_PLUGIN_INPUT_POSTGIS) + message(STATUS "using input plugin postgis") + add_subdirectory(postgis) +endif() +if(USE_PLUGIN_INPUT_RASTER) + message(STATUS "using input plugin raster") + add_subdirectory(raster) +endif() +if(USE_PLUGIN_INPUT_SHAPE) + message(STATUS "using input plugin shape") + add_subdirectory(shape) +endif() +if(USE_PLUGIN_INPUT_SQLITE) + message(STATUS "using input plugin sqlite") + add_subdirectory(sqlite) +endif() +if(USE_PLUGIN_INPUT_TOPOJSON) + message(STATUS "using input plugin topojson") + add_subdirectory(topojson) +endif() diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt new file mode 100644 index 000000000..6d3ffe272 --- /dev/null +++ b/plugins/input/csv/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-csv) + +add_library(input-csv SHARED + csv_datasource.cpp + csv_featureset.cpp + csv_index_featureset.cpp + csv_inline_featureset.cpp + csv_utils.cpp +) +add_library(mapnik::plugin::input::csv ALIAS input-csv) + +target_link_libraries(input-csv PRIVATE + mapnik::headers + mapnik::mapnik + mapnik::wkt + mapnik::json +) +set_target_properties(input-csv PROPERTIES PREFIX "") +set_target_properties(input-csv PROPERTIES OUTPUT_NAME "csv") +set_target_properties(input-csv PROPERTIES SUFFIX ".input") +#install(TARGETS input-csv DESTINATION bin/plugins/input) + +install(TARGETS input-csv + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) \ No newline at end of file diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt new file mode 100644 index 000000000..90758ec4e --- /dev/null +++ b/plugins/input/gdal/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-gdal) + +find_package(GDAL REQUIRED) + +add_library(input-gdal SHARED + gdal_datasource.cpp + gdal_featureset.cpp +) +add_library(mapnik::plugin::input::gdal ALIAS input-gdal) + +target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIR}) +target_link_libraries(input-gdal PRIVATE + mapnik::headers + mapnik::mapnik + ${GDAL_LIBRARY} +) +set_target_properties(input-gdal PROPERTIES PREFIX "") +set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") +set_target_properties(input-gdal PROPERTIES SUFFIX ".input") + +install(TARGETS input-gdal + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt new file mode 100644 index 000000000..c325e6109 --- /dev/null +++ b/plugins/input/geobuf/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-geobuf) + +add_library(input-geobuf SHARED + geobuf_datasource.cpp + geobuf_featureset.cpp +) +add_library(mapnik::plugin::input::geobuf ALIAS input-geobuf) + +target_link_libraries(input-geobuf PRIVATE + mapnik::headers + mapnik::mapnik +) +set_target_properties(input-geobuf PROPERTIES PREFIX "") +set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf") +set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") + +install(TARGETS input-geobuf + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt new file mode 100644 index 000000000..7243eb723 --- /dev/null +++ b/plugins/input/geojson/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-geojson) + +add_library(input-geojson SHARED + geojson_datasource.cpp + geojson_featureset.cpp + geojson_index_featureset.cpp + geojson_memory_index_featureset.cpp +) +add_library(mapnik::plugin::input::geojson ALIAS input-geojson) + +target_link_libraries(input-geojson PRIVATE + mapnik::headers + mapnik::mapnik + mapnik::json +) + +set_target_properties(input-geojson PROPERTIES PREFIX "") +set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson") +set_target_properties(input-geojson PROPERTIES SUFFIX ".input") + +install(TARGETS input-geojson + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt new file mode 100644 index 000000000..8311175fa --- /dev/null +++ b/plugins/input/ogr/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-ogr) + +find_package(GDAL REQUIRED) + +add_library(input-ogr SHARED + ogr_converter.cpp + ogr_datasource.cpp + ogr_featureset.cpp + ogr_index_featureset.cpp +) +add_library(mapnik::plugin::input::ogr ALIAS input-ogr) + +target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIR}) +target_link_libraries(input-ogr PRIVATE + mapnik::headers + mapnik::mapnik + ${GDAL_LIBRARY} +) +set_target_properties(input-ogr PROPERTIES PREFIX "") +set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") +set_target_properties(input-ogr PROPERTIES SUFFIX ".input") + +install(TARGETS input-ogr + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt new file mode 100644 index 000000000..40b35fd6f --- /dev/null +++ b/plugins/input/pgraster/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-pgraster) + +find_package(PostgreSQL REQUIRED) + +add_library(input-pgraster SHARED + pgraster_datasource.cpp + pgraster_featureset.cpp + pgraster_wkb_reader.cpp +) +add_library(mapnik::plugin::input::pgraster ALIAS input-pgraster) + + +target_link_libraries(input-pgraster PRIVATE + mapnik::headers + mapnik::mapnik + PostgreSQL::PostgreSQL +) +set_target_properties(input-pgraster PROPERTIES PREFIX "") +set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster") +set_target_properties(input-pgraster PROPERTIES SUFFIX ".input") + +install(TARGETS input-pgraster + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt new file mode 100644 index 000000000..2c4cc37d7 --- /dev/null +++ b/plugins/input/postgis/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-postgis) + +find_package(PostgreSQL REQUIRED) + +add_library(input-postgis SHARED + postgis_datasource.cpp + postgis_featureset.cpp +) +add_library(mapnik::plugin::input::postgis ALIAS input-postgis) + +target_link_libraries(input-postgis PRIVATE + mapnik::headers + mapnik::mapnik + PostgreSQL::PostgreSQL +) + +set_target_properties(input-postgis PROPERTIES PREFIX "") +set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis") +set_target_properties(input-postgis PROPERTIES SUFFIX ".input") + +install(TARGETS input-postgis + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt new file mode 100644 index 000000000..22c5d203d --- /dev/null +++ b/plugins/input/raster/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-raster) + +add_library(input-raster SHARED + raster_datasource.cpp + raster_featureset.cpp + raster_info.cpp +) +add_library(mapnik::plugin::input::raster ALIAS input-raster) + +target_link_libraries(input-raster PRIVATE + mapnik::headers + mapnik::mapnik +) + +set_target_properties(input-raster PROPERTIES PREFIX "") +set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster") +set_target_properties(input-raster PROPERTIES SUFFIX ".input") + +install(TARGETS input-raster + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt new file mode 100644 index 000000000..8b73af6c8 --- /dev/null +++ b/plugins/input/shape/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-shape) + +add_library(input-shape SHARED + dbfile.cpp + dbf_test.cpp + shape_datasource.cpp + shape_featureset.cpp + shape_index_featureset.cpp + shape_io.cpp shape_utils.cpp +) +add_library(mapnik::plugin::input::shape ALIAS input-shape) + +target_link_libraries(input-shape PRIVATE + mapnik::headers + mapnik::mapnik +) + +set_target_properties(input-shape PROPERTIES PREFIX "") +set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape") +set_target_properties(input-shape PROPERTIES SUFFIX ".input") + +install(TARGETS input-shape + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt new file mode 100644 index 000000000..a4913fc7c --- /dev/null +++ b/plugins/input/sqlite/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-sqlite) + +find_package(SQLite3 REQUIRED) + +add_library(input-sqlite SHARED + sqlite_datasource.cpp + sqlite_featureset.cpp +) +add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite) + +target_link_libraries(input-sqlite PRIVATE + mapnik::headers + mapnik::mapnik + SQLite::SQLite3 +) + +set_target_properties(input-sqlite PROPERTIES PREFIX "") +set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite") +set_target_properties(input-sqlite PROPERTIES SUFFIX ".input") + +install(TARGETS input-sqlite + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt new file mode 100644 index 000000000..93dc4968e --- /dev/null +++ b/plugins/input/topojson/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.15.0) +project(input-topojson) + +add_library(input-topojson SHARED + topojson_datasource.cpp + topojson_featureset.cpp +) +add_library(mapnik::plugin::input::topojson ALIAS input-topojson) + +target_link_libraries(input-topojson PRIVATE + mapnik::headers + mapnik::mapnik + mapnik::json +) + +set_target_properties(input-topojson PROPERTIES PREFIX "") +set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson") +set_target_properties(input-topojson PROPERTIES SUFFIX ".input") + +install(TARGETS input-topojson + EXPORT MapnikTargets + LIBRARY DESTINATION lib/plugins/input + ARCHIVE DESTINATION lib/plugins/input + RUNTIME DESTINATION bin/plugins/input + INCLUDES DESTINATION . + PUBLIC_HEADER DESTINATION . +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a947f0cd5..dddba9278 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -272,7 +272,7 @@ add_library(mapnik ${COMPILE_SRC}) add_library(mapnik::mapnik ALIAS mapnik) -target_compile_definitions(mapnik PRIVATE ${MAPNIK_EXPORTS} ${MAPNIK_COMPILE_DEFS}) +target_compile_definitions(mapnik PRIVATE MAPNIK_EXPORTS) target_link_libraries(mapnik PRIVATE mapnik::headers mapnik::agg diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index b721708bf..12cc699a3 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(geometry_to_wkb main.cpp) -target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) +target_link_libraries(geometry_to_wkb PRIVATE mapnik::headers mapnik::mapnik) install(TARGETS geometry_to_wkb EXPORT MapnikTargets diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index 1fe9717f5..b06de87b2 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -2,8 +2,15 @@ add_executable(mapnik-index mapnik-index.cpp process_csv_file.cpp process_geojson_file_x3.cpp + ../../plugins/input/csv/csv_utils.cpp # this project depends on this file +) +target_link_libraries(mapnik-index PRIVATE + mapnik::headers + mapnik::mapnik + mapnik::json + mapnik::wkt + Boost::program_options ) -target_link_libraries(mapnik-index PRIVATE mapnik::mapnik) install(TARGETS mapnik-index EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 74f09aa1d..0e2e6cd10 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -1,6 +1,10 @@ add_executable(mapnik-render mapnik-render.cpp) -target_link_libraries(mapnik-render PRIVATE mapnik::mapnik) +target_link_libraries(mapnik-render PRIVATE + mapnik::headers + mapnik::mapnik + Boost::program_options +) install(TARGETS mapnik-render EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 86edc72a7..0575f26b7 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(ogrindex ogrindex.cpp) -target_link_libraries(ogrindex PRIVATE mapnik::mapnik) +target_link_libraries(ogrindex PRIVATE mapnik::headers mapnik::mapnik) install(TARGETS ogrindex EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 90db76f4f..29569a904 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -3,7 +3,7 @@ add_executable(pgsql2sqlite sqlite.cpp ) -target_link_libraries(pgsql2sqlite PRIVATE mapnik::mapnik) +target_link_libraries(pgsql2sqlite PRIVATE mapnik::headers mapnik::mapnik) install(TARGETS pgsql2sqlite EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 5a2f72ad7..15ebf477c 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -2,7 +2,7 @@ add_executable(shapeindex shapeindex.cpp ) -target_link_libraries(shapeindex PRIVATE mapnik::mapnik) +target_link_libraries(shapeindex PRIVATE mapnik::headers mapnik::mapnik) install(TARGETS shapeindex EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index abf3de3ba..feb84e80a 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -2,7 +2,7 @@ add_executable(svg2png svg2png.cpp ) -target_link_libraries(svg2png PRIVATE mapnik::mapnik) +target_link_libraries(svg2png PRIVATE mapnik::headers mapnik::mapnik) install(TARGETS svg2png EXPORT MapnikTargets RUNTIME DESTINATION bin From f390a830ae218da23e04a771daed1b4955746564 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 11:40:55 +0100 Subject: [PATCH 011/141] remove plugins from generated targets; install includes --- CMakeLists.txt | 15 +++++++++------ plugins/input/csv/CMakeLists.txt | 3 --- plugins/input/gdal/CMakeLists.txt | 3 --- plugins/input/geobuf/CMakeLists.txt | 3 --- plugins/input/geojson/CMakeLists.txt | 3 --- plugins/input/ogr/CMakeLists.txt | 3 --- plugins/input/pgraster/CMakeLists.txt | 3 --- plugins/input/postgis/CMakeLists.txt | 3 --- plugins/input/raster/CMakeLists.txt | 3 --- plugins/input/shape/CMakeLists.txt | 3 --- plugins/input/sqlite/CMakeLists.txt | 5 +---- plugins/input/topojson/CMakeLists.txt | 3 --- 12 files changed, 10 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e275491b5..16c470478 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,11 +144,11 @@ if(USE_CAIRO) list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) endif() -add_library(mapnik-headers INTERFACE) -add_library(mapnik::headers ALIAS mapnik-headers) +add_library(headers INTERFACE) +add_library(mapnik::headers ALIAS headers) # todo: mapbox includes need to included private. -target_include_directories(mapnik-headers INTERFACE +target_include_directories(headers INTERFACE $ $ ${MAPBOX_GEOMETRY_INCLUDE_DIRS} @@ -158,7 +158,7 @@ target_include_directories(mapnik-headers INTERFACE $ $ ) -target_link_libraries(mapnik-headers INTERFACE +target_link_libraries(headers INTERFACE Boost::boost Boost::regex Boost::filesystem @@ -167,9 +167,9 @@ target_link_libraries(mapnik-headers INTERFACE harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} ) -target_compile_definitions(mapnik-headers INTERFACE ${MAPNIK_COMPILE_DEFS}) +target_compile_definitions(headers INTERFACE ${MAPNIK_COMPILE_DEFS}) -install(TARGETS mapnik-headers +install(TARGETS headers EXPORT MapnikTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib @@ -208,3 +208,6 @@ install(EXPORT MapnikTargets NAMESPACE mapnik:: DESTINATION lib/cmake/mapnik ) + +install(DIRECTORY include/ DESTINATION include) +install(DIRECTORY deps/agg/include/ DESTINATION include) \ No newline at end of file diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 6d3ffe272..4597cee15 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -22,10 +22,7 @@ set_target_properties(input-csv PROPERTIES SUFFIX ".input") #install(TARGETS input-csv DESTINATION bin/plugins/input) install(TARGETS input-csv - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) \ No newline at end of file diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 90758ec4e..4c2919cc1 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -20,10 +20,7 @@ set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") set_target_properties(input-gdal PROPERTIES SUFFIX ".input") install(TARGETS input-gdal - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index c325e6109..75bd7af2a 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -16,10 +16,7 @@ set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf") set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") install(TARGETS input-geobuf - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 7243eb723..d8f945e0c 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -20,10 +20,7 @@ set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson") set_target_properties(input-geojson PROPERTIES SUFFIX ".input") install(TARGETS input-geojson - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 8311175fa..034311c7e 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -22,10 +22,7 @@ set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") set_target_properties(input-ogr PROPERTIES SUFFIX ".input") install(TARGETS input-ogr - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 40b35fd6f..20ae20760 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -21,10 +21,7 @@ set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster") set_target_properties(input-pgraster PROPERTIES SUFFIX ".input") install(TARGETS input-pgraster - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 2c4cc37d7..3085e6246 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -20,10 +20,7 @@ set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis") set_target_properties(input-postgis PROPERTIES SUFFIX ".input") install(TARGETS input-postgis - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 22c5d203d..557668536 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -18,10 +18,7 @@ set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster") set_target_properties(input-raster PROPERTIES SUFFIX ".input") install(TARGETS input-raster - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 8b73af6c8..64beadd57 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -21,10 +21,7 @@ set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape") set_target_properties(input-shape PROPERTIES SUFFIX ".input") install(TARGETS input-shape - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index a4913fc7c..8b4a57cff 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -19,11 +19,8 @@ set_target_properties(input-sqlite PROPERTIES PREFIX "") set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite") set_target_properties(input-sqlite PROPERTIES SUFFIX ".input") -install(TARGETS input-sqlite - EXPORT MapnikTargets +install(TARGETS input-sqlite LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 93dc4968e..f727a5e19 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -18,10 +18,7 @@ set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson") set_target_properties(input-topojson PROPERTIES SUFFIX ".input") install(TARGETS input-topojson - EXPORT MapnikTargets LIBRARY DESTINATION lib/plugins/input ARCHIVE DESTINATION lib/plugins/input RUNTIME DESTINATION bin/plugins/input - INCLUDES DESTINATION . - PUBLIC_HEADER DESTINATION . ) From e3789e219aa141f3a801d73111fea41f0ea09c33 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 12:24:34 +0100 Subject: [PATCH 012/141] build utilities correctly --- CMakeLists.txt | 15 ++++++--- demo/CMakeLists.txt | 11 +++++++ demo/c++/CMakeLists.txt | 11 +++++++ demo/viewer/CMakeLists.txt | 46 ++++++++++++++++++++++++++++ utils/CMakeLists.txt | 2 +- utils/geometry_to_wkb/CMakeLists.txt | 5 ++- utils/ogrindex/CMakeLists.txt | 4 ++- utils/pgsql2sqlite/CMakeLists.txt | 16 ++++++++-- utils/shapeindex/CMakeLists.txt | 7 ++++- utils/svg2png/CMakeLists.txt | 7 ++++- 10 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 demo/CMakeLists.txt create mode 100644 demo/c++/CMakeLists.txt create mode 100644 demo/viewer/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 16c470478..b2b5c971f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,11 @@ option(USE_PLUGIN_INPUT_SHAPE "adds plugin input shape" ON) option(USE_PLUGIN_INPUT_SQLITE "adds plugin input sqlite" ON) option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON) +option(BUILD_DEMO_VIEWER "builds the demo viewer" ON) +option(BUILD_DEMO_CPP "builds the demo c++ application" ON) + + + set(CXX_STANDARD 17) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) @@ -181,9 +186,8 @@ install(TARGETS headers add_subdirectory(deps) add_subdirectory(src) add_subdirectory(plugins) -#add_subdirectory(utils) -#add_subdirectory(utils) -#add_subdirectory(plugins) +add_subdirectory(utils) +add_subdirectory(demo) include(CMakePackageConfigHelpers) @@ -209,5 +213,6 @@ install(EXPORT MapnikTargets DESTINATION lib/cmake/mapnik ) -install(DIRECTORY include/ DESTINATION include) -install(DIRECTORY deps/agg/include/ DESTINATION include) \ No newline at end of file +install(DIRECTORY include/ TYPE INCLUDE) +install(DIRECTORY deps/agg/include/ TYPE INCLUDE) +install(DIRECTORY fonts/ DESTINATION bin/fonts FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt new file mode 100644 index 000000000..96556acb3 --- /dev/null +++ b/demo/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15.0) + +if(BUILD_DEMO_VIEWER) + message(STATUS "Building demo viewer") + add_subdirectory(viewer) +endif() + +if(BUILD_DEMO_CPP) + message(STATUS "Building c++ demo app") + add_subdirectory(c++) +endif() \ No newline at end of file diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt new file mode 100644 index 000000000..84627451b --- /dev/null +++ b/demo/c++/CMakeLists.txt @@ -0,0 +1,11 @@ +project(mapnik-demo) + +add_executable(mapnik-demo rundemo.cpp) + +target_link_libraries(mapnik-demo PRIVATE mapnik::headers mapnik::agg mapnik::mapnik) + +install(TARGETS mapnik-demo + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt new file mode 100644 index 000000000..bc4aa0dc3 --- /dev/null +++ b/demo/viewer/CMakeLists.txt @@ -0,0 +1,46 @@ +project(mapnik-viewer) + +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +add_executable(mapnik-viewer + about_dialog.cpp + info_dialog.cpp + layerdelegate.cpp + layerlistmodel.cpp + layerwidget.cpp + layer_info_dialog.cpp + main.cpp + mainwindow.cpp + mapwidget.cpp + styles_model.cpp + forms/about.ui + forms/info.ui + forms/layer_info.ui + mapnik_viewer.qrc +) + +set_target_properties(mapnik-viewer PROPERTIES + AUTOUIC_SEARCH_PATHS forms + AUTORCC ON + AUTOUIC ON + AUTOMOC ON +) + + +target_link_libraries(mapnik-viewer PRIVATE + Qt5::Widgets + mapnik::headers + mapnik::agg + mapnik::mapnik +) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini +"[mapnik] +plugins_dir=plugins/input +fonts/1/dir=fonts" +) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) +install(TARGETS mapnik-viewer + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 8ad98aeb5..1d60b6d18 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15.0) add_subdirectory(geometry_to_wkb) add_subdirectory(mapnik-index) add_subdirectory(mapnik-render) -add_subdirectory(ogrindex) +# add_subdirectory(ogrindex) # missing include file shapeindex/quadtree.hpp add_subdirectory(pgsql2sqlite) add_subdirectory(shapeindex) add_subdirectory(svg2png) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index 12cc699a3..b6ec671bc 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -1,6 +1,9 @@ add_executable(geometry_to_wkb main.cpp) -target_link_libraries(geometry_to_wkb PRIVATE mapnik::headers mapnik::mapnik) +target_link_libraries(geometry_to_wkb PRIVATE + mapnik::headers + mapnik::mapnik +) install(TARGETS geometry_to_wkb EXPORT MapnikTargets diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 0575f26b7..eafa23289 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -1,7 +1,9 @@ add_executable(ogrindex ogrindex.cpp) + target_link_libraries(ogrindex PRIVATE mapnik::headers mapnik::mapnik) + install(TARGETS ogrindex EXPORT MapnikTargets RUNTIME DESTINATION bin -) \ No newline at end of file +) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 29569a904..3ba2f66bc 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,10 +1,22 @@ + +find_package(SQLite3 REQUIRED) +find_package(PostgreSQL REQUIRED) + add_executable(pgsql2sqlite main.cpp sqlite.cpp ) -target_link_libraries(pgsql2sqlite PRIVATE mapnik::headers mapnik::mapnik) +target_include_directories(pgsql2sqlite PRIVATE ../../plugins/input/postgis) +target_link_libraries(pgsql2sqlite PRIVATE + SQLite::SQLite3 + PostgreSQL::PostgreSQL + Boost::program_options + mapnik::headers + mapnik::mapnik +) + install(TARGETS pgsql2sqlite EXPORT MapnikTargets RUNTIME DESTINATION bin -) \ No newline at end of file +) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 15ebf477c..92ab1594a 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -2,7 +2,12 @@ add_executable(shapeindex shapeindex.cpp ) -target_link_libraries(shapeindex PRIVATE mapnik::headers mapnik::mapnik) +target_include_directories(shapeindex PRIVATE ../../plugins/input/shape) +target_link_libraries(shapeindex PRIVATE + Boost::program_options + mapnik::headers + mapnik::mapnik +) install(TARGETS shapeindex EXPORT MapnikTargets RUNTIME DESTINATION bin diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index feb84e80a..b0819685b 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -2,7 +2,12 @@ add_executable(svg2png svg2png.cpp ) -target_link_libraries(svg2png PRIVATE mapnik::headers mapnik::mapnik) +target_link_libraries(svg2png PRIVATE + Boost::program_options + mapnik::headers + mapnik::mapnik + mapnik::agg +) install(TARGETS svg2png EXPORT MapnikTargets RUNTIME DESTINATION bin From 3990fbe1dd347e49464e89df2e1e06e4cd9c9b87 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 12:30:34 +0100 Subject: [PATCH 013/141] add options to enable/disable utilitys --- CMakeLists.txt | 8 +++++++- utils/CMakeLists.txt | 36 +++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2b5c971f..cd3262116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,13 @@ option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON) option(BUILD_DEMO_VIEWER "builds the demo viewer" ON) option(BUILD_DEMO_CPP "builds the demo c++ application" ON) - +option(BUILD_UTILITY_GEOMETRY_TO_WKB "builds the utility program geometry_to_wkb" ON) +option(BUILD_UTILITY_MAPNIK_INDEX "builds the utility program mapnik_index" ON) +option(BUILD_UTILITY_MAPNIK_RENDER "builds the utility program mapnik_render" ON) +option(BUILD_UTILITY_OGRINDEX "builds the utility program ogrindex" OFF) +option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) +option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) +option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) set(CXX_STANDARD 17) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 1d60b6d18..9a95c5713 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,8 +1,30 @@ cmake_minimum_required(VERSION 3.15.0) -add_subdirectory(geometry_to_wkb) -add_subdirectory(mapnik-index) -add_subdirectory(mapnik-render) -# add_subdirectory(ogrindex) # missing include file shapeindex/quadtree.hpp -add_subdirectory(pgsql2sqlite) -add_subdirectory(shapeindex) -add_subdirectory(svg2png) +if(BUILD_UTILITY_GEOMETRY_TO_WKB) + message(STATUS "building utility geometry_to_wkb") + add_subdirectory(geometry_to_wkb) +endif() +if(BUILD_UTILITY_MAPNIK_INDEX) + message(STATUS "building utility mapnik-index") + add_subdirectory(mapnik-index) +endif() +if(BUILD_UTILITY_MAPNIK_RENDER) + message(STATUS "building utility mapnik-render") + add_subdirectory(mapnik-render) +endif() +if(BUILD_UTILITY_OGRINDEX) + message(STATUS "building utility ogrindex") + message(WARNING "can't build ogrindex currently due to some bugs") + #add_subdirectory(ogrindex) # missing include file shapeindex/quadtree.hpp +endif() +if(BUILD_UTILITY_PGSQL2SQLITE) + message(STATUS "building utility pgsql2sqlite") + add_subdirectory(pgsql2sqlite) +endif() +if(BUILD_UTILITY_SHAPEINDEX) + message(STATUS "building utility shapeindex") + add_subdirectory(shapeindex) +endif() +if(BUILD_UTILITY_SVG2PNG) + message(STATUS "building utility svg2png") + add_subdirectory(svg2png) +endif() From 8de67bc2624974d90982e9c66c9339dcf32775f3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 12:38:29 +0100 Subject: [PATCH 014/141] add support for proj4 --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3262116..9c6dd598b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ 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_PLUGIN_INPUT_CSV "adds plugin input csv" ON) option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) @@ -155,6 +156,13 @@ if(USE_CAIRO) list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) endif() +if(USE_PROJ4) + message(STATUS "Using PROJ4") + find_package(PROJ4 CONFIG REQUIRED) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4) + list(APPEND MAPNIK_OPTIONAL_LIBS proj) +endif() + add_library(headers INTERFACE) add_library(mapnik::headers ALIAS headers) From 9a132080b5752180836bb7ac040a1ca80e7c7d2b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 12:50:11 +0100 Subject: [PATCH 015/141] add proj required define --- CMakeLists.txt | 2 +- cmake/MapnikConfig.cmake.in | 2 +- demo/CMakeLists.txt | 2 +- deps/CMakeLists.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c6dd598b..79aa279ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,7 +159,7 @@ endif() if(USE_PROJ4) message(STATUS "Using PROJ4") find_package(PROJ4 CONFIG REQUIRED) - list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4 ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1) list(APPEND MAPNIK_OPTIONAL_LIBS proj) endif() diff --git a/cmake/MapnikConfig.cmake.in b/cmake/MapnikConfig.cmake.in index db991109b..4a1773f42 100644 --- a/cmake/MapnikConfig.cmake.in +++ b/cmake/MapnikConfig.cmake.in @@ -2,4 +2,4 @@ include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") -check_required_components(mapnik) \ No newline at end of file +check_required_components(mapnik) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 96556acb3..1bc4c8ddd 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -8,4 +8,4 @@ endif() if(BUILD_DEMO_CPP) message(STATUS "Building c++ demo app") add_subdirectory(c++) -endif() \ No newline at end of file +endif() diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 69527cdfe..e96f65584 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -1,2 +1,2 @@ cmake_minimum_required(VERSION 3.15.0) -add_subdirectory(agg) \ No newline at end of file +add_subdirectory(agg) From f447cad781e7c5515f75e84721c2c363eeb10ce2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 13:20:04 +0100 Subject: [PATCH 016/141] add initial test support --- CMakeLists.txt | 7 ++++++- test/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 79aa279ea..debac47e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,8 @@ project(mapnik set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -set(BUILD_SHARED_LIBS ON) +option(BUILD_SHARED_LIBS "build mapnik dynamic" ON) +option(BUILD_TEST "builds the tests" ON) 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) @@ -202,6 +203,10 @@ add_subdirectory(src) add_subdirectory(plugins) add_subdirectory(utils) add_subdirectory(demo) +if(BUILD_TEST) + enable_testing() + add_subdirectory(test) +endif() include(CMakePackageConfigHelpers) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..fc1191739 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,31 @@ +project(mapnik-test) + +Include(FetchContent) + +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.13.1) +FetchContent_MakeAvailable(Catch2) + +# Prepare "Catch" library for other executables +set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +add_library(Catch INTERFACE) +target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) + +add_executable(mapnik-test-unit + unit/run.cpp + unit/color/css_color.cpp +) +target_link_libraries(mapnik-test-unit PUBLIC + Catch + mapnik::headers + mapnik::agg + 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 From 9213f76d491da76f9f04151ce6bc89f38d92bd6f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 14:54:26 +0100 Subject: [PATCH 017/141] do not compile features if they are not set --- src/CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dddba9278..e4955c949 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,6 @@ set(MAPNIK_SOURCES image_view_any.cpp image_view.cpp image.cpp - jpeg_reader.cpp layer.cpp load_map.cpp map.cpp @@ -62,7 +61,6 @@ set(MAPNIK_SOURCES parse_transform.cpp path_expression_grammar_x3.cpp plugin.cpp - png_reader.cpp proj_transform.cpp projection.cpp raster_colorizer.cpp @@ -74,8 +72,7 @@ set(MAPNIK_SOURCES simplify.cpp symbolizer_enumerations.cpp symbolizer_keys.cpp - symbolizer.cpp - tiff_reader.cpp + symbolizer.cpp transform_expression_grammar_x3.cpp transform_expression.cpp twkb.cpp @@ -90,6 +87,16 @@ set(MAPNIK_SOURCES ) set(COMPILE_SRC ${MAPNIK_SOURCES}) +if(NOT USE_JPEG) + list(APPEND COMPILE_SRC jpeg_reader.cpp) +endif() +if(NOT USE_PNG) + list(APPEND COMPILE_SRC png_reader.cpp) +endif() +if(NOT USE_TIFF) + list(APPEND COMPILE_SRC tiff_reader.cpp) +endif() + set(AGG_COMPILE_SRC ../deps/agg/src/agg_arc.cpp ../deps/agg/src/agg_arrowhead.cpp From 744aa2a76ad165d4652e285a80cc6ad78b9d01fd Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 15:02:07 +0100 Subject: [PATCH 018/141] do not compile features.... --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e4955c949..a4746f37c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -87,13 +87,13 @@ set(MAPNIK_SOURCES ) set(COMPILE_SRC ${MAPNIK_SOURCES}) -if(NOT USE_JPEG) +if(USE_JPEG) list(APPEND COMPILE_SRC jpeg_reader.cpp) endif() -if(NOT USE_PNG) +if(USE_PNG) list(APPEND COMPILE_SRC png_reader.cpp) endif() -if(NOT USE_TIFF) +if(USE_TIFF) list(APPEND COMPILE_SRC tiff_reader.cpp) endif() From 07546fe0987e7062fdd2daadeb48c412d8f176d9 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 15:10:20 +0100 Subject: [PATCH 019/141] enable c++17 and do not use c++ extensions --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index debac47e5..b8059acba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,9 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) -set(CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) find_package(ICU REQUIRED COMPONENTS uc) From 0084628d61ebdb6ece5460c22601e5bf5a03644d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 15:18:31 +0100 Subject: [PATCH 020/141] use only c++17 with extensions.. --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8059acba..245f8922c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,8 +46,6 @@ option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) find_package(ICU REQUIRED COMPONENTS uc) From 096befe69eed03a9038cb3387c3aed0ded21e7e3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 15:34:13 +0100 Subject: [PATCH 021/141] try with c++14 --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 245f8922c..be0195a6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 14) find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) find_package(ICU REQUIRED COMPONENTS uc) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a4746f37c..534085ff5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -278,8 +278,12 @@ endif() add_library(mapnik ${COMPILE_SRC}) add_library(mapnik::mapnik ALIAS mapnik) +set(COMPILE_DEFS "") +if(BUILD_SHARED_LIBS) + list(APPEND COMPILE_DEFS MAPNIK_EXPORTS) +endif() -target_compile_definitions(mapnik PRIVATE MAPNIK_EXPORTS) +target_compile_definitions(mapnik PRIVATE ${COMPILE_DEFS}) target_link_libraries(mapnik PRIVATE mapnik::headers mapnik::agg From 3eb00b9794d81f318c3ee945ef1e0858016c9708 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 15:41:03 +0100 Subject: [PATCH 022/141] use feature test for --- src/image_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/image_util.cpp b/src/image_util.cpp index d8811082c..3f59abf25 100644 --- a/src/image_util.cpp +++ b/src/image_util.cpp @@ -54,7 +54,7 @@ MAPNIK_DISABLE_WARNING_POP #include #include -#if __cplusplus >= 201703L +#if __cpp_lib_execution >= 201603 #include #endif From 0eb0408cc3151bce31901f3d5f1ae16cd8d07e3e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 17:03:30 +0100 Subject: [PATCH 023/141] 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 From 96a8327d06b11bd53297aefd692223a06862b234 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 17:45:44 +0100 Subject: [PATCH 024/141] add libraries to test --- test/CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 35bba6998..47259cbe5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -101,27 +101,43 @@ target_link_libraries(mapnik-test-unit PUBLIC mapnik::headers mapnik::agg mapnik::mapnik + mapnik::json + mapnik::wkt ) add_executable(agg_rasterizer_integer_overflow_test standalone/agg_rasterizer_integer_overflow_test.cpp) target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC Catch - + mapnik::headers + mapnik::mapnik + mapnik::agg + mapnik::json ) add_executable(datasource_registration_test standalone/datasource_registration_test.cpp) target_link_libraries(datasource_registration_test PUBLIC Catch + mapnik::headers + mapnik::mapnik + mapnik::agg ) add_executable(font_registration_test standalone/font_registration_test.cpp) target_link_libraries(font_registration_test PUBLIC Catch + mapnik::headers + mapnik::mapnik + mapnik::agg + mapnik::json ) add_executable(map_xml_test standalone/map_xml_test.cpp) target_link_libraries(map_xml_test PUBLIC Catch + mapnik::headers + mapnik::mapnik + mapnik::agg + mapnik::json ) add_executable(mapnik-test-visual @@ -133,8 +149,10 @@ add_executable(mapnik-test-visual target_link_libraries( mapnik-test-visual PRIVATE Boost::program_options + Boost::filesystem mapnik::headers mapnik::mapnik + mapnik::agg ) include(CTest) From 695ad02cb245b0c883957d121ca10de6912844ae Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 18:01:48 +0100 Subject: [PATCH 025/141] fix svg renderer --- src/CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e08138ee9..2c5c36135 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -216,15 +216,16 @@ 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 - + set(SVG_RENDERER_SRC) svg/output/process_line_symbolizer.cpp svg/output/process_polygon_symbolizer.cpp svg/output/process_symbolizers.cpp @@ -233,8 +234,9 @@ if(USE_SVG_RENDERER) svg/output/svg_output_grammars.cpp svg/output/svg_renderer.cpp ) - list(APPEND COMPILE_SRC ${SVG_SRC}) + list(APPEND SVG_SRC ${SVG_RENDERER_SRC}) endif() +list(APPEND COMPILE_SRC ${SVG_SRC}) set(TEXT_SRC text/color_font_renderer.cpp From 99d8c3e503fed79cde86b839ff1e6fb913845d05 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 18:04:24 +0100 Subject: [PATCH 026/141] fix cmake typo --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c5c36135..be6388656 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -225,7 +225,7 @@ set(SVG_SRC ) if(USE_SVG_RENDERER) message(STATUS "adding svg renderer to compilation") - set(SVG_RENDERER_SRC) + set(SVG_RENDERER_SRC svg/output/process_line_symbolizer.cpp svg/output/process_polygon_symbolizer.cpp svg/output/process_symbolizers.cpp From 691d385687b265851eeb6e45df4881041a178ad8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 18:17:32 +0100 Subject: [PATCH 027/141] comment not workable test out --- test/CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 47259cbe5..0e551e8b8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -131,14 +131,15 @@ target_link_libraries(font_registration_test PUBLIC mapnik::json ) -add_executable(map_xml_test standalone/map_xml_test.cpp) -target_link_libraries(map_xml_test PUBLIC - Catch - mapnik::headers - mapnik::mapnik - mapnik::agg - mapnik::json -) +# not workable since boost::filesystem native returns a wstring and the function taskes a std::string +#add_executable(map_xml_test standalone/map_xml_test.cpp) +#target_link_libraries(map_xml_test PUBLIC +# Catch +# mapnik::headers +# mapnik::mapnik +# mapnik::agg +# mapnik::json +#) add_executable(mapnik-test-visual visual/parse_map_sizes.cpp @@ -148,6 +149,7 @@ add_executable(mapnik-test-visual ) target_link_libraries( mapnik-test-visual PRIVATE + Catch Boost::program_options Boost::filesystem mapnik::headers @@ -163,4 +165,4 @@ 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 +#catch_discover_tests(map_xml_test) \ No newline at end of file From b11ef9d44b89159976e3ec5a743d59b9ca2f9b02 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 18:18:21 +0100 Subject: [PATCH 028/141] removed MAPNIK_DECL from feature_style_processor; conflicts with the feature_style_processor_impl.h --- include/mapnik/feature_style_processor.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mapnik/feature_style_processor.hpp b/include/mapnik/feature_style_processor.hpp index 7e10d758d..e92e3962d 100644 --- a/include/mapnik/feature_style_processor.hpp +++ b/include/mapnik/feature_style_processor.hpp @@ -52,7 +52,7 @@ enum eAttributeCollectionPolicy }; template -class MAPNIK_DECL feature_style_processor +class feature_style_processor { public: explicit feature_style_processor(Map const& m, From 45fd654898a02587ed6279161fa267b73cbe37eb Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 18:19:58 +0100 Subject: [PATCH 029/141] added MAPNIK_DECL to interior and polylabel explicit template --- src/geometry/interior.cpp | 2 +- src/geometry/polylabel.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/geometry/interior.cpp b/src/geometry/interior.cpp index 77ea03fba..304e949e6 100644 --- a/src/geometry/interior.cpp +++ b/src/geometry/interior.cpp @@ -232,7 +232,7 @@ bool interior(polygon const& polygon, double scale_factor, point & pt) return true; } -template +template MAPNIK_DECL bool interior(polygon const& polygon, double scale_factor, point & pt); } } diff --git a/src/geometry/polylabel.cpp b/src/geometry/polylabel.cpp index 07012fcdb..b36bb30d4 100644 --- a/src/geometry/polylabel.cpp +++ b/src/geometry/polylabel.cpp @@ -46,14 +46,14 @@ bool polylabel(polygon const& polygon, T precision, point & pt) return true; } -template -bool polylabel(polygon const& polygon, - double precision, - point & pt); +template MAPNIK_DECL +bool polylabel(polygon const& polygon, + double precision, + point & pt); -template -double polylabel_precision(polygon const& polygon, - double scale_factor); +template MAPNIK_DECL +double polylabel_precision(polygon const& polygon, +double scale_factor); } } From f68f7e88de8117a3ebadfd7330d2300c729ae0d6 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 19:03:55 +0100 Subject: [PATCH 030/141] fixed map_xml_test --- cmake/CopyDllsForDebug.cmake | 31 +++++++++++++++++++++++++++++++ test/CMakeLists.txt | 31 ++++++++++++++++++++----------- test/standalone/map_xml_test.cpp | 26 +++++++++++++------------- 3 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 cmake/CopyDllsForDebug.cmake diff --git a/cmake/CopyDllsForDebug.cmake b/cmake/CopyDllsForDebug.cmake new file mode 100644 index 000000000..f2f2b153b --- /dev/null +++ b/cmake/CopyDllsForDebug.cmake @@ -0,0 +1,31 @@ +# This is a helper script to run BundleUtilities fixup_bundle as postbuild +# for a target. The primary use case is to copy .DLLs to the build directory for +# the Windows platform. It allows generator expressions to be used to determine +# the binary location +# +# Usage : copy_dlls_for_debug TARGET LIBS DIRS +# - TARGET : A cmake target +# - See fixup_bundle for LIBS and DIRS arguments + +if(RUN_IT) +# Script ran by the add_custom_command + include(BundleUtilities) + include(InstallRequiredSystemLibraries) + fixup_bundle("${TO_FIXUP_FILE}" "${TO_FIXUP_LIBS}" "${TO_FIXUP_DIRS}") +# End of script ran by the add_custom_command +else() + +set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE}) +function(copy_dlls_for_debug _target _libs _dirs) + if(WIN32) + add_custom_command( + TARGET ${_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$ -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs} -P ${THIS_FILE} + COMMENT "Fixing up dependencies for ${_target}" + VERBATIM + ) + endif(WIN32) +endfunction() + +endif() + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0e551e8b8..400931134 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,7 @@ project(mapnik-test) -Include(FetchContent) +include(FetchContent) +include(CopyDllsForDebug) FetchContent_Declare( Catch2 @@ -13,6 +14,8 @@ set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) add_library(Catch INTERFACE) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) + + add_executable(mapnik-test-unit unit/run.cpp unit/color/css_color.cpp @@ -131,15 +134,15 @@ target_link_libraries(font_registration_test PUBLIC mapnik::json ) -# not workable since boost::filesystem native returns a wstring and the function taskes a std::string -#add_executable(map_xml_test standalone/map_xml_test.cpp) -#target_link_libraries(map_xml_test PUBLIC -# Catch -# mapnik::headers -# mapnik::mapnik -# mapnik::agg -# mapnik::json -#) +#not workable since boost::filesystem native returns a wstring and the function taskes a std::string +add_executable(map_xml_test standalone/map_xml_test.cpp) +target_link_libraries(map_xml_test PUBLIC + Catch + mapnik::headers + mapnik::mapnik + mapnik::agg + mapnik::json +) add_executable(mapnik-test-visual visual/parse_map_sizes.cpp @@ -160,9 +163,15 @@ target_link_libraries( include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) +set(APPS mapnik-test-unit mapnik-test-visual mapnik::mapnik) # paths to executables +set(DIRS ${CMAKE_BINARY_DIR}/src/RelWithDebInfo) # directories to search for prerequisites +copy_dlls_for_debug(${APPS} \"\" ${DIRS}) + +file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) +file(COPY data-visual DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) 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 +catch_discover_tests(map_xml_test) \ No newline at end of file diff --git a/test/standalone/map_xml_test.cpp b/test/standalone/map_xml_test.cpp index b33a3f718..0bd42d14c 100644 --- a/test/standalone/map_xml_test.cpp +++ b/test/standalone/map_xml_test.cpp @@ -76,17 +76,17 @@ void compare_map(bfs::path xml) { // is a normalisation step to ensure that the file is in // whatever the current version of mapnik uses as the // standard indentation, quote style, etc... - REQUIRE_NOTHROW(mapnik::load_map(m, xml.native(), false, abs_base.native())); + REQUIRE_NOTHROW(mapnik::load_map(m, xml.generic_string(), false, abs_base.generic_string())); bfs::path test_map1 = dir.path() / "mapnik-temp-map1.xml"; - REQUIRE_NOTHROW(mapnik::save_map(m, test_map1.native())); + REQUIRE_NOTHROW(mapnik::save_map(m, test_map1.generic_string())); // create a new map, load the one saved in the previous // step, and write it out again. mapnik::Map new_map(256, 256); REQUIRE(new_map.register_fonts("fonts", true)); - REQUIRE_NOTHROW(mapnik::load_map(new_map, test_map1.native(), false, abs_base.native())); + REQUIRE_NOTHROW(mapnik::load_map(new_map, test_map1.generic_string(), false, abs_base.generic_string())); bfs::path test_map2 = dir.path() / "mapnik-temp-map2.xml"; - REQUIRE_NOTHROW(mapnik::save_map(new_map, test_map2.native())); + REQUIRE_NOTHROW(mapnik::save_map(new_map, test_map2.generic_string())); // if all the information survived the load/save round-trip // then the two files ought to be identical. @@ -102,7 +102,7 @@ void add_xml_files(bfs::path dir, std::vector &xml_files) { for (auto const &entry : boost::make_iterator_range( bfs::directory_iterator(dir), bfs::directory_iterator())) { auto path = entry.path(); - if (path.extension().native() == ".xml") { + if (path.extension().generic_string() == ".xml") { xml_files.emplace_back(path); } } @@ -112,7 +112,7 @@ void load_map(mapnik::Map &m, bfs::path const &path) { try { - mapnik::load_map(m, path.native()); + mapnik::load_map(m, path.generic_string()); } catch (std::exception const &ex) { @@ -129,7 +129,7 @@ void load_map(mapnik::Map &m, bfs::path const &path) { } // anonymous namespace -const bool registered = mapnik::datasource_cache::instance().register_datasources("./plugins/input/"); +const bool registered = mapnik::datasource_cache::instance().register_datasources((bfs::path("plugins") / "input").generic_string()); TEST_CASE("map xml I/O") { // make sure plugins are loaded @@ -141,7 +141,7 @@ TEST_CASE("map xml I/O") { SECTION("good maps") { std::vector good_maps; - add_xml_files("test/data/good_maps", good_maps); + add_xml_files(bfs::path("test") / "data" / "good_maps", good_maps); for (auto const &path : good_maps) { CAPTURE(path.native()); @@ -157,7 +157,7 @@ TEST_CASE("map xml I/O") { } // END SECTION SECTION("duplicate styles only throw in strict mode") { - std::string duplicate_stylename("test/data/broken_maps/duplicate_stylename.xml"); + std::string duplicate_stylename((bfs::path("test") / "data" / "broken_maps" / "duplicate_stylename.xml").generic_string()); CAPTURE(duplicate_stylename); mapnik::Map m(256, 256); REQUIRE(m.register_fonts("fonts", true)); @@ -169,15 +169,15 @@ TEST_CASE("map xml I/O") { SECTION("broken maps") { std::vector broken_maps; - add_xml_files("test/data/broken_maps", broken_maps); - broken_maps.emplace_back("test/data/broken_maps/does_not_exist.xml"); + add_xml_files(bfs::path("test") / "data" / "broken_maps", broken_maps); + broken_maps.emplace_back(bfs::path("test") / "data" / "broken_maps" / "does_not_exist.xml"); for (auto const &path : broken_maps) { - CAPTURE(path.native()); + CAPTURE(path.generic_string()); mapnik::Map m(256, 256); REQUIRE(m.register_fonts("fonts", true)); - REQUIRE_THROWS(mapnik::load_map(m, path.native(), true)); + REQUIRE_THROWS(mapnik::load_map(m, path.generic_string(), true)); } } // END SECTION From 29cd904c5f81c3c37ae212e1fda74c1a299ed422 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 21 Nov 2020 19:16:47 +0100 Subject: [PATCH 031/141] fix one forgotton native() --- test/standalone/map_xml_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/standalone/map_xml_test.cpp b/test/standalone/map_xml_test.cpp index 0bd42d14c..5f1dba900 100644 --- a/test/standalone/map_xml_test.cpp +++ b/test/standalone/map_xml_test.cpp @@ -144,7 +144,7 @@ TEST_CASE("map xml I/O") { add_xml_files(bfs::path("test") / "data" / "good_maps", good_maps); for (auto const &path : good_maps) { - CAPTURE(path.native()); + CAPTURE(path.generic_string()); // check that it can load mapnik::Map m(256, 256); From 68528ffb282f7d0d909918f47bb438fbe9033d09 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 22 Nov 2020 22:01:33 +0100 Subject: [PATCH 032/141] cmake improvements --- CMakeLists.txt | 39 +++++++++++++++++---------- cmake/MapnikConfig.cmake.in | 4 +++ demo/viewer/CMakeLists.txt | 4 +-- plugins/input/csv/CMakeLists.txt | 4 +-- plugins/input/gdal/CMakeLists.txt | 4 +-- plugins/input/geobuf/CMakeLists.txt | 6 ++--- plugins/input/geojson/CMakeLists.txt | 4 +-- plugins/input/ogr/CMakeLists.txt | 4 +-- plugins/input/pgraster/CMakeLists.txt | 4 +-- plugins/input/postgis/CMakeLists.txt | 4 +-- plugins/input/raster/CMakeLists.txt | 4 +-- plugins/input/shape/CMakeLists.txt | 4 +-- plugins/input/sqlite/CMakeLists.txt | 4 +-- plugins/input/topojson/CMakeLists.txt | 4 +-- test/CMakeLists.txt | 4 +-- utils/geometry_to_wkb/CMakeLists.txt | 2 ++ utils/mapnik-index/CMakeLists.txt | 4 +++ utils/mapnik-render/CMakeLists.txt | 4 +++ utils/ogrindex/CMakeLists.txt | 2 ++ utils/pgsql2sqlite/CMakeLists.txt | 3 ++- utils/shapeindex/CMakeLists.txt | 4 +++ utils/svg2png/CMakeLists.txt | 4 +++ 22 files changed, 67 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc30e0b67..9de080db4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,15 +47,23 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) +set(PLUGINS_INSTALL_DIR bin/plugins/input CACHE STRING "installs the plugins in the specified directory") +get_filename_component(ABSOLUTE_PLUGINS_INSTALL_DIR ${PLUGINS_INSTALL_DIR} ABSOLUTE) +message("Installing plugins to ${ABSOLUTE_PLUGINS_INSTALL_DIR}") +set(FONTS_INSTALL_DIR bin/fonts CACHE STRING "installs the fonts in the specified directory") +get_filename_component(ABSOLUTE_FONTS_INSTALL_DIR ${FONTS_INSTALL_DIR} ABSOLUTE) +message("Installing fonts to ${FONTS_INSTALL_DIR}") + + set(CMAKE_CXX_STANDARD 14) -find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex program_options) +find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) find_package(Freetype REQUIRED) find_package(harfbuzz CONFIG REQUIRED) if(USE_EXTERNAL_MAPBOX_GEOMETRY) - # provide a way to specify the include dirs with the CACHE VARIABLES + # this is used to provide a way to specify include dirs with CACHE VARIABLES if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS) message(STATUS "Searching for the include dir of mapbox/geometry.hpp") find_path(MAPBOX_GEOMETRY_INCLUDE_DIRS "mapbox/geometry.hpp" REQUIRED) @@ -179,16 +187,14 @@ endif() add_library(headers INTERFACE) add_library(mapnik::headers ALIAS headers) -# todo: mapbox includes need to included private. target_include_directories(headers INTERFACE $ + $ + $ + $ + $ + $ $ - ${MAPBOX_GEOMETRY_INCLUDE_DIRS} - ${MAPBOX_POLYLABEL_INCLUDE_DIRS} - ${MAPBOX_VARIANT_INCLUDE_DIRS} - ${MAPBOX_PROTOZERO_INCLUDE_DIRS} - $ - $ ) target_link_libraries(headers INTERFACE Boost::boost @@ -220,8 +226,12 @@ if(BUILD_TEST) add_subdirectory(test) endif() - +# start package mapnik include(CMakePackageConfigHelpers) + +# set the cmake targets install location +set(INSTALL_CMAKE_DIR lib/cmake) +set(INCLUDE_INSTALL_DIR include/) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" VERSION ${PROJECT_VERSION} @@ -230,20 +240,21 @@ write_basic_package_version_file( configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MapnikConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" - INSTALL_DESTINATION lib/cmake/mapnik + INSTALL_DESTINATION ${INSTALL_CMAKE_DIR} + PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" - DESTINATION lib/cmake/mapnik + DESTINATION ${INSTALL_CMAKE_DIR} ) install(EXPORT MapnikTargets FILE MapnikTargets.cmake NAMESPACE mapnik:: - DESTINATION lib/cmake/mapnik + DESTINATION ${INSTALL_CMAKE_DIR} ) install(DIRECTORY include/ TYPE INCLUDE) install(DIRECTORY deps/agg/include/ TYPE INCLUDE) -install(DIRECTORY fonts/ DESTINATION bin/fonts FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") +install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") diff --git a/cmake/MapnikConfig.cmake.in b/cmake/MapnikConfig.cmake.in index 4a1773f42..3075df2d9 100644 --- a/cmake/MapnikConfig.cmake.in +++ b/cmake/MapnikConfig.cmake.in @@ -1,5 +1,9 @@ @PACKAGE_INIT@ +set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" CACHE STRING "") +set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_PLUGINS_INSTALL_DIR@" CACHE STRING "") +set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "") + include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") check_required_components(mapnik) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index bc4aa0dc3..721b76195 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -35,8 +35,8 @@ target_link_libraries(mapnik-viewer PRIVATE ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini "[mapnik] -plugins_dir=plugins/input -fonts/1/dir=fonts" +plugins_dir=${ABSOLUTE_PLUGINS_INSTALL_DIR} +fonts/1/dir=${ABSOLUTE_FONTS_INSTALL_DIR}" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) install(TARGETS mapnik-viewer diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 4597cee15..bef173f84 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -22,7 +22,5 @@ set_target_properties(input-csv PROPERTIES SUFFIX ".input") #install(TARGETS input-csv DESTINATION bin/plugins/input) install(TARGETS input-csv - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) \ No newline at end of file diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 4c2919cc1..366b3f920 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") set_target_properties(input-gdal PROPERTIES SUFFIX ".input") install(TARGETS input-gdal - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 75bd7af2a..3e36629ea 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -16,7 +16,5 @@ set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf") set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") install(TARGETS input-geobuf - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input -) + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} +) \ No newline at end of file diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index d8f945e0c..26a0821a2 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson") set_target_properties(input-geojson PROPERTIES SUFFIX ".input") install(TARGETS input-geojson - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 034311c7e..c01c6bb5f 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -22,7 +22,5 @@ set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") set_target_properties(input-ogr PROPERTIES SUFFIX ".input") install(TARGETS input-ogr - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 20ae20760..a6166128d 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -21,7 +21,5 @@ set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster") set_target_properties(input-pgraster PROPERTIES SUFFIX ".input") install(TARGETS input-pgraster - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 3085e6246..ba3192a98 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis") set_target_properties(input-postgis PROPERTIES SUFFIX ".input") install(TARGETS input-postgis - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 557668536..2aed0fdc0 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -18,7 +18,5 @@ set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster") set_target_properties(input-raster PROPERTIES SUFFIX ".input") install(TARGETS input-raster - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 64beadd57..6753eb9de 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -21,7 +21,5 @@ set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape") set_target_properties(input-shape PROPERTIES SUFFIX ".input") install(TARGETS input-shape - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 8b4a57cff..439d19dfb 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -20,7 +20,5 @@ set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite") set_target_properties(input-sqlite PROPERTIES SUFFIX ".input") install(TARGETS input-sqlite - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index f727a5e19..6b3ffb16f 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -18,7 +18,5 @@ set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson") set_target_properties(input-topojson PROPERTIES SUFFIX ".input") install(TARGETS input-topojson - LIBRARY DESTINATION lib/plugins/input - ARCHIVE DESTINATION lib/plugins/input - RUNTIME DESTINATION bin/plugins/input + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 400931134..a73a0f288 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,7 @@ project(mapnik-test) +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + include(FetchContent) include(CopyDllsForDebug) @@ -14,8 +16,6 @@ set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) add_library(Catch INTERFACE) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) - - add_executable(mapnik-test-unit unit/run.cpp unit/color/css_color.cpp diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index b6ec671bc..adb0c8409 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -1,3 +1,5 @@ +project(geometry_to_wkb) + add_executable(geometry_to_wkb main.cpp) target_link_libraries(geometry_to_wkb PRIVATE diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index b06de87b2..e2c8f2cfb 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -1,3 +1,7 @@ +project(mapnik-index) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(mapnik-index mapnik-index.cpp process_csv_file.cpp diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 0e2e6cd10..b8dde3cd6 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -1,3 +1,7 @@ +project(mapnik-render) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(mapnik-render mapnik-render.cpp) target_link_libraries(mapnik-render PRIVATE diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index eafa23289..7ecad8db9 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -1,3 +1,5 @@ +project(ogrindex) + add_executable(ogrindex ogrindex.cpp) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 3ba2f66bc..baa4ff156 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,4 +1,5 @@ - +project(pgsql2sqlite) +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) find_package(SQLite3 REQUIRED) find_package(PostgreSQL REQUIRED) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 92ab1594a..b1a555d77 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -1,3 +1,7 @@ +project(shapeindex) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(shapeindex shapeindex.cpp ) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index b0819685b..eb1021903 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -1,3 +1,7 @@ +project(svg2png) + +find_package(Boost 1.74 REQUIRED COMPONENTS program_options) + add_executable(svg2png svg2png.cpp ) From 85736c4c95589b3243e74d1fe90ace28d852994d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 22 Nov 2020 22:02:17 +0100 Subject: [PATCH 033/141] name fonts correctly --- cmake/MapnikConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/MapnikConfig.cmake.in b/cmake/MapnikConfig.cmake.in index 3075df2d9..0785d57f7 100644 --- a/cmake/MapnikConfig.cmake.in +++ b/cmake/MapnikConfig.cmake.in @@ -2,7 +2,7 @@ set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" CACHE STRING "") set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_PLUGINS_INSTALL_DIR@" CACHE STRING "") -set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "") +set_and_check(MAPNIK_FONTS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") From f6acf4c027ed7e11eb668a901481c4953fd716a3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 22 Nov 2020 22:06:15 +0100 Subject: [PATCH 034/141] do not use the install interface for mapbox deps --- CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9de080db4..a3d709443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,6 @@ if(USE_EXTERNAL_MAPBOX_GEOMETRY) else() set(MAPBOX_GEOMETRY_INCLUDE_DIRS $ - $ ) endif() if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS) @@ -86,7 +85,6 @@ if(USE_EXTERNAL_MAPBOX_POLYLABEL) else() set(MAPBOX_POLYLABEL_INCLUDE_DIRS $ - $ ) endif() if(NOT MAPBOX_POLYLABEL_INCLUDE_DIRS) @@ -101,7 +99,6 @@ if(USE_EXTERNAL_MAPBOX_PROTOZERO) else() set(MAPBOX_PROTOZERO_INCLUDE_DIRS $ - $ ) endif() if(NOT MAPBOX_PROTOZERO_INCLUDE_DIRS) @@ -116,7 +113,6 @@ if(USE_EXTERNAL_MAPBOX_VARIANT) else() set(MAPBOX_VARIANT_INCLUDE_DIRS $ - $ ) endif() if(NOT MAPBOX_VARIANT_INCLUDE_DIRS) From 983087b5c545470959de3119025385447e5855d5 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 22 Nov 2020 22:11:27 +0100 Subject: [PATCH 035/141] cache var for cxx standard --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3d709443..06eaa23d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,10 +52,10 @@ get_filename_component(ABSOLUTE_PLUGINS_INSTALL_DIR ${PLUGINS_INSTALL_DIR} ABSOL message("Installing plugins to ${ABSOLUTE_PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR bin/fonts CACHE STRING "installs the fonts in the specified directory") get_filename_component(ABSOLUTE_FONTS_INSTALL_DIR ${FONTS_INSTALL_DIR} ABSOLUTE) -message("Installing fonts to ${FONTS_INSTALL_DIR}") +message("Installing fonts to ${ABSOLUTE_FONTS_INSTALL_DIR}") - -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++11 is minimum.") +message("Using c++${CMAKE_CXX_STANDARD}") find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) From f027667daa51c93a3aeb40a6fa47219ce039b0c2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 08:23:41 +0100 Subject: [PATCH 036/141] added correct plugin default paths --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06eaa23d4..4ab9d29d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,15 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) -set(PLUGINS_INSTALL_DIR bin/plugins/input CACHE STRING "installs the plugins in the specified directory") +if(WIN32) + set(DEFAULT_PLUGINS_INSTALL_DIR bin/mapnik/input) +else() + set(DEFAULT_PLUGINS_INSTALL_DIR lib/mapnik/input) +endif() +set(PLUGINS_INSTALL_DIR ${DEFAULT_PLUGINS_INSTALL_DIR} CACHE STRING "installs the plugins in the specified directory") get_filename_component(ABSOLUTE_PLUGINS_INSTALL_DIR ${PLUGINS_INSTALL_DIR} ABSOLUTE) message("Installing plugins to ${ABSOLUTE_PLUGINS_INSTALL_DIR}") + set(FONTS_INSTALL_DIR bin/fonts CACHE STRING "installs the fonts in the specified directory") get_filename_component(ABSOLUTE_FONTS_INSTALL_DIR ${FONTS_INSTALL_DIR} ABSOLUTE) message("Installing fonts to ${ABSOLUTE_FONTS_INSTALL_DIR}") From 37dd7c17df53566a419733488153ccf7278480e4 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 10:45:20 +0100 Subject: [PATCH 037/141] update catch dep --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a73a0f288..fe7a2166b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,7 +8,7 @@ include(CopyDllsForDebug) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.13.1) + GIT_TAG v2.13.3) FetchContent_MakeAvailable(Catch2) # Prepare "Catch" library for other executables From 9ede58f2b71a053961121cc2f72420ddcb075fbf Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 10:56:49 +0100 Subject: [PATCH 038/141] create boilerplate code --- .github/workflows/cmake.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 000000000..d5217692c --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,46 @@ +name: CMake + +on: [push] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Create Build Environment + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + # Use a bash shell so we can use the same syntax for environment variable + # access regardless of the host operating system + shell: bash + working-directory: ${{runner.workspace}}/build + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config $BUILD_TYPE + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C $BUILD_TYPE From f432018bdbde308cc57b5bc9cabab4f1d436ce98 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 12:16:06 +0100 Subject: [PATCH 039/141] added cache variable for lib/bin/archive output --- CMakeLists.txt | 19 ++++++++++++++++++- demo/c++/CMakeLists.txt | 6 +++--- demo/viewer/CMakeLists.txt | 6 +++--- deps/vcpkg | 1 + src/CMakeLists.txt | 6 +++--- src/json/CMakeLists.txt | 6 +++--- src/wkt/CMakeLists.txt | 6 +++--- test/CMakeLists.txt | 4 ++++ utils/geometry_to_wkb/CMakeLists.txt | 4 +++- utils/mapnik-index/CMakeLists.txt | 4 +++- utils/mapnik-render/CMakeLists.txt | 4 +++- utils/ogrindex/CMakeLists.txt | 4 +++- utils/pgsql2sqlite/CMakeLists.txt | 4 +++- utils/shapeindex/CMakeLists.txt | 4 +++- utils/svg2png/CMakeLists.txt | 4 +++- 15 files changed, 59 insertions(+), 23 deletions(-) create mode 160000 deps/vcpkg diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ab9d29d4..a9aaaf757 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project(mapnik set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -option(BUILD_SHARED_LIBS "build mapnik dynamic" ON) +option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) option(BUILD_TEST "builds the tests" ON) 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) @@ -63,6 +63,23 @@ message("Installing fonts to ${ABSOLUTE_FONTS_INSTALL_DIR}") set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++11 is minimum.") message("Using c++${CMAKE_CXX_STANDARD}") +if(WIN32) + set(DEFAULT_BIN_DIR bin) + set(DEFAULT_LIB_DIR lib) + set(DEFAULT_ARCHIVE_DIR lib) +else() + include(GNUInstallDirs) + set(DEFAULT_BIN_DIR ${CMAKE_INSTALL_BINDIR}) + set(DEFAULT_LIB_DIR ${CMAKE_INSTALL_LIBDIR}) + set(DEFAULT_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR}) +endif() +# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#runtime-output-artifacts +set(MAPNIK_BIN_DIR ${DEFAULT_BIN_DIR} CACHE STRING "Install directory for binaries") +# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#library-output-artifacts +set(MAPNIK_LIB_DIR ${DEFAULT_LIB_DIR} CACHE STRING "Install directory for libraries") +# https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#archive-output-artifacts +set(MAPNIK_ARCHIVE_DIR ${DEFAULT_ARCHIVE_DIR} CACHE STRING "Install directory for archives") + find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) find_package(Freetype REQUIRED) diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 84627451b..48e83ce78 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -5,7 +5,7 @@ add_executable(mapnik-demo rundemo.cpp) target_link_libraries(mapnik-demo PRIVATE mapnik::headers mapnik::agg mapnik::mapnik) install(TARGETS mapnik-demo - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 721b76195..96e641498 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -40,7 +40,7 @@ fonts/1/dir=${ABSOLUTE_FONTS_INSTALL_DIR}" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) install(TARGETS mapnik-viewer - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) diff --git a/deps/vcpkg b/deps/vcpkg new file mode 160000 index 000000000..6e073f168 --- /dev/null +++ b/deps/vcpkg @@ -0,0 +1 @@ +Subproject commit 6e073f168652a551d8f29d19481ec67be3fccac8 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be6388656..2ff07f3fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -299,9 +299,9 @@ target_link_libraries(mapnik PRIVATE install(TARGETS mapnik EXPORT MapnikTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ ) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index c3b818387..8428e87e4 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -28,7 +28,7 @@ target_link_libraries(json PRIVATE mapnik::headers ${ICUU_LIB}) install(TARGETS json EXPORT MapnikTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 82de6f9cf..c787df8d5 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(wkt PRIVATE mapnik::headers) install(TARGETS wkt EXPORT MapnikTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fe7a2166b..eb5149e14 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,6 +16,10 @@ set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) add_library(Catch INTERFACE) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) +# for cmake 3.19+ https://cmake.org/cmake/help/git-stage/policy/CMP0110.html +# might not be needed if catch updates its cmakes +cmake_policy(SET CMP0110 OLD) + add_executable(mapnik-test-unit unit/run.cpp unit/color/css_color.cpp diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index adb0c8409..b9f4cb3b1 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -9,5 +9,7 @@ target_link_libraries(geometry_to_wkb PRIVATE install(TARGETS geometry_to_wkb EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) \ No newline at end of file diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index e2c8f2cfb..4926c1b0e 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -17,5 +17,7 @@ target_link_libraries(mapnik-index PRIVATE ) install(TARGETS mapnik-index EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) \ No newline at end of file diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index b8dde3cd6..3e7ef65f1 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -11,5 +11,7 @@ target_link_libraries(mapnik-render PRIVATE ) install(TARGETS mapnik-render EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) \ No newline at end of file diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 7ecad8db9..8e9eed31a 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -7,5 +7,7 @@ target_link_libraries(ogrindex PRIVATE mapnik::headers mapnik::mapnik) install(TARGETS ogrindex EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index baa4ff156..c98427ec9 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -19,5 +19,7 @@ target_link_libraries(pgsql2sqlite PRIVATE install(TARGETS pgsql2sqlite EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index b1a555d77..56eb501bd 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -14,5 +14,7 @@ target_link_libraries(shapeindex PRIVATE ) install(TARGETS shapeindex EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) \ No newline at end of file diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index eb1021903..e1c691c05 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -14,5 +14,7 @@ target_link_libraries(svg2png PRIVATE ) install(TARGETS svg2png EXPORT MapnikTargets - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) \ No newline at end of file From b3a34de3ce810e369aa0c3c1088941efc5bb3088 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 12:17:31 +0100 Subject: [PATCH 040/141] some line endings --- utils/geometry_to_wkb/CMakeLists.txt | 2 +- utils/mapnik-index/CMakeLists.txt | 2 +- utils/mapnik-render/CMakeLists.txt | 2 +- utils/shapeindex/CMakeLists.txt | 2 +- utils/svg2png/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index b9f4cb3b1..f706fd584 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -12,4 +12,4 @@ install(TARGETS geometry_to_wkb LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) \ No newline at end of file +) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index 4926c1b0e..22076f781 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -20,4 +20,4 @@ install(TARGETS mapnik-index LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) \ No newline at end of file +) diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 3e7ef65f1..eed2e90a6 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -14,4 +14,4 @@ install(TARGETS mapnik-render LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) \ No newline at end of file +) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 56eb501bd..969c86817 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -17,4 +17,4 @@ install(TARGETS shapeindex LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) \ No newline at end of file +) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index e1c691c05..015de5c3d 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -17,4 +17,4 @@ install(TARGETS svg2png LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) \ No newline at end of file +) From 410393fefabf2c9d25f6ed3f823868139cbd7467 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 13:20:07 +0100 Subject: [PATCH 041/141] do not use absolute paths for fonts/plugins --- CMakeLists.txt | 33 ++++++++++++++++----------------- demo/viewer/CMakeLists.txt | 4 ++-- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9aaaf757..172609745 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,19 +47,6 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) -if(WIN32) - set(DEFAULT_PLUGINS_INSTALL_DIR bin/mapnik/input) -else() - set(DEFAULT_PLUGINS_INSTALL_DIR lib/mapnik/input) -endif() -set(PLUGINS_INSTALL_DIR ${DEFAULT_PLUGINS_INSTALL_DIR} CACHE STRING "installs the plugins in the specified directory") -get_filename_component(ABSOLUTE_PLUGINS_INSTALL_DIR ${PLUGINS_INSTALL_DIR} ABSOLUTE) -message("Installing plugins to ${ABSOLUTE_PLUGINS_INSTALL_DIR}") - -set(FONTS_INSTALL_DIR bin/fonts CACHE STRING "installs the fonts in the specified directory") -get_filename_component(ABSOLUTE_FONTS_INSTALL_DIR ${FONTS_INSTALL_DIR} ABSOLUTE) -message("Installing fonts to ${ABSOLUTE_FONTS_INSTALL_DIR}") - set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++11 is minimum.") message("Using c++${CMAKE_CXX_STANDARD}") @@ -80,6 +67,19 @@ set(MAPNIK_LIB_DIR ${DEFAULT_LIB_DIR} CACHE STRING "Install directory for librar # https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#archive-output-artifacts set(MAPNIK_ARCHIVE_DIR ${DEFAULT_ARCHIVE_DIR} CACHE STRING "Install directory for archives") +set(INSTALL_CMAKE_DIR ${MAPNIK_LIB_DIR}/mapnik/cmake CACHE STRING "Install directory of the cmake targets") + +if(WIN32) + set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input) +else() + set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_LIB_DIR}/mapnik/input) +endif() +set(PLUGINS_INSTALL_DIR ${DEFAULT_PLUGINS_INSTALL_DIR} CACHE STRING "installs the plugins in the specified directory") +message("Installing plugins to ${PLUGINS_INSTALL_DIR}") + +set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") +message("Installing fonts to ${FONTS_INSTALL_DIR}") + find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) find_package(Freetype REQUIRED) @@ -228,9 +228,9 @@ target_compile_definitions(headers INTERFACE ${MAPNIK_COMPILE_DEFS}) install(TARGETS headers EXPORT MapnikTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ ) @@ -249,7 +249,6 @@ endif() include(CMakePackageConfigHelpers) # set the cmake targets install location -set(INSTALL_CMAKE_DIR lib/cmake) set(INCLUDE_INSTALL_DIR include/) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 96e641498..45604e28d 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -35,8 +35,8 @@ target_link_libraries(mapnik-viewer PRIVATE ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini "[mapnik] -plugins_dir=${ABSOLUTE_PLUGINS_INSTALL_DIR} -fonts/1/dir=${ABSOLUTE_FONTS_INSTALL_DIR}" +plugins_dir=${PLUGINS_INSTALL_DIR} +fonts/1/dir=${FONTS_INSTALL_DIR}" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) install(TARGETS mapnik-viewer From cbd19b6052d8254994817cdaab938e4254c02215 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Nov 2020 15:42:33 +0100 Subject: [PATCH 042/141] use status message --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 172609745..f622ed18c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++11 is minimum.") -message("Using c++${CMAKE_CXX_STANDARD}") +message(STATUS "Using c++${CMAKE_CXX_STANDARD}") if(WIN32) set(DEFAULT_BIN_DIR bin) @@ -75,10 +75,10 @@ else() set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_LIB_DIR}/mapnik/input) endif() set(PLUGINS_INSTALL_DIR ${DEFAULT_PLUGINS_INSTALL_DIR} CACHE STRING "installs the plugins in the specified directory") -message("Installing plugins to ${PLUGINS_INSTALL_DIR}") +message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") -message("Installing fonts to ${FONTS_INSTALL_DIR}") +message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) From 002c6e2a5edf6a67f33f5ef6cd8babbc92e7b100 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 17 Dec 2020 10:21:25 +0100 Subject: [PATCH 043/141] remove vcpkg folder --- deps/vcpkg | 1 - 1 file changed, 1 deletion(-) delete mode 160000 deps/vcpkg diff --git a/deps/vcpkg b/deps/vcpkg deleted file mode 160000 index 6e073f168..000000000 --- a/deps/vcpkg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6e073f168652a551d8f29d19481ec67be3fccac8 From 14f4362bb55b510d35d85cc19bec33b42c00b027 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 24 Jan 2021 19:34:51 +0100 Subject: [PATCH 044/141] better support for proj --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f622ed18c..5c2c1f4fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,7 @@ endif() set(MAPNIK_COMPILE_DEFS "") set(MAPNIK_OPTIONAL_LIBS "") +set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") if(USE_LIBXML2) message(STATUS "Using LibXml2") @@ -187,10 +188,12 @@ if(USE_CAIRO) endif() if(USE_PROJ4) + #https://proj.org/development/cmake.html message(STATUS "Using PROJ4") find_package(PROJ4 CONFIG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4 ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1) - list(APPEND MAPNIK_OPTIONAL_LIBS proj) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) @@ -214,6 +217,7 @@ target_include_directories(headers INTERFACE $ $ $ + ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) target_link_libraries(headers INTERFACE Boost::boost From 953796645f0d358f2c48f5d754597c0734ede67c Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 24 Jan 2021 19:35:21 +0100 Subject: [PATCH 045/141] enable position independent code for wkt and json --- src/json/CMakeLists.txt | 2 ++ src/wkt/CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 8428e87e4..a8430a2f7 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -17,6 +17,8 @@ add_library(json STATIC ) add_library(mapnik::json ALIAS json) +set_property(TARGET json PROPERTY POSITION_INDEPENDENT_CODE ON) + target_include_directories(json PRIVATE ${JPEG_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index c787df8d5..1741834c2 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -9,6 +9,8 @@ add_library(wkt STATIC ) add_library(mapnik::wkt ALIAS wkt) +set_property(TARGET wkt PROPERTY POSITION_INDEPENDENT_CODE ON) + target_include_directories(wkt PRIVATE ${MAPNIK_INCLUDE_PATH} ${JPEG_INCLUDE_DIR} From 247ceff7a7f709aea639026e0bf3be65f8f2b4d2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sun, 24 Jan 2021 19:36:01 +0100 Subject: [PATCH 046/141] temporarily remove find dll. only windows specific. needs better impl --- test/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eb5149e14..63a0da82c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -167,9 +167,6 @@ target_link_libraries( include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) -set(APPS mapnik-test-unit mapnik-test-visual mapnik::mapnik) # paths to executables -set(DIRS ${CMAKE_BINARY_DIR}/src/RelWithDebInfo) # directories to search for prerequisites -copy_dlls_for_debug(${APPS} \"\" ${DIRS}) file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) file(COPY data-visual DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) @@ -178,4 +175,4 @@ 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 +catch_discover_tests(map_xml_test) From a7c9f5b9411b2fe7cb3944fb04135dd0090cebff Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 27 Jan 2021 00:41:54 +0100 Subject: [PATCH 047/141] windows: copy all dlls. optional library dir if some dlls are not found. --- CMakeLists.txt | 3 ++- cmake/CopyDllsForDebug.cmake | 17 +++++++++-------- demo/viewer/CMakeLists.txt | 7 +++++++ test/CMakeLists.txt | 7 +++++++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c2c1f4fd..1c533e282 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ project(mapnik set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully" "") + option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) option(BUILD_TEST "builds the tests" ON) option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF) @@ -79,7 +81,6 @@ message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") - find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) find_package(ICU REQUIRED COMPONENTS uc) find_package(Freetype REQUIRED) diff --git a/cmake/CopyDllsForDebug.cmake b/cmake/CopyDllsForDebug.cmake index f2f2b153b..7f668868a 100644 --- a/cmake/CopyDllsForDebug.cmake +++ b/cmake/CopyDllsForDebug.cmake @@ -16,16 +16,17 @@ if(RUN_IT) else() set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE}) -function(copy_dlls_for_debug _target _libs _dirs) +function(copy_dlls_for_debug _targets _libs _dirs) if(WIN32) - add_custom_command( - TARGET ${_target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$ -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs} -P ${THIS_FILE} - COMMENT "Fixing up dependencies for ${_target}" - VERBATIM - ) + foreach(_target ${_targets}) + add_custom_command( + TARGET ${_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$ -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs} -P ${THIS_FILE} + COMMENT "Fixing up dependencies for ${_target}" + VERBATIM + ) + endforeach() endif(WIN32) endfunction() endif() - diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 45604e28d..599255d9f 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -44,3 +44,10 @@ install(TARGETS mapnik-viewer ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) + + +if(WIN32) + include(CopyDllsForDebug) + add_custom_command(TARGET mapnik-viewer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) + copy_dlls_for_debug(mapnik-viewer \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 63a0da82c..05cdfbe99 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -168,6 +168,13 @@ include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) +if(WIN32) + include(CopyDllsForDebug) + add_custom_command(TARGET mapnik-test-unit POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) + set(APPS mapnik-test-unit agg_rasterizer_integer_overflow_test datasource_registration_test font_registration_test map_xml_test mapnik-test-visual) + copy_dlls_for_debug(${APPS} \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") +endif() + file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) file(COPY data-visual DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) From d159bec46ab5e596ba649db784e3c88bd713fe86 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 27 Jan 2021 00:42:19 +0100 Subject: [PATCH 048/141] FindCairo: find debug release library --- cmake/FindCairo.cmake | 47 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index 5bf2d339d..c6a33fa1b 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -63,11 +63,16 @@ find_path(Cairo_INCLUDE_DIR PATH_SUFFIXES cairo ) -find_library(Cairo_LIBRARY +find_library(Cairo_LIBRARY_RELEASE NAMES ${Cairo_NAMES} cairo HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS} ) +find_library(Cairo_LIBRARY_DEBUG + NAMES ${Cairo_NAMES} cairod + HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS} +) + if (Cairo_INCLUDE_DIR AND NOT Cairo_VERSION) if (EXISTS "${Cairo_INCLUDE_DIR}/cairo-version.h") file(READ "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_CONTENT) @@ -86,24 +91,52 @@ if (Cairo_INCLUDE_DIR AND NOT Cairo_VERSION) endif () include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Cairo +if(Cairo_LIBRARY_RELEASE AND Cairo_LIBRARY_DEBUG) + # set the libaries varible to use the release and debug versions + find_package_handle_standard_args(Cairo FOUND_VAR Cairo_FOUND - REQUIRED_VARS Cairo_LIBRARY Cairo_INCLUDE_DIR + REQUIRED_VARS Cairo_LIBRARY_RELEASE Cairo_LIBRARY_DEBUG Cairo_INCLUDE_DIR VERSION_VAR Cairo_VERSION -) + ) + set(Cairo_LIBRARIES optimized ${Cairo_LIBRARY_RELEASE} debug ${Cairo_LIBRARY_DEBUG}) +elseif(Cairo_LIBRARY_RELEASE) + # only the release library is available + find_package_handle_standard_args(Cairo + FOUND_VAR Cairo_FOUND + REQUIRED_VARS Cairo_LIBRARY_RELEASE Cairo_INCLUDE_DIR + VERSION_VAR Cairo_VERSION + ) + set(Cairo_LIBRARIES optimized ${Cairo_LIBRARY_RELEASE}) +elseif(Cairo_LIBRARY_DEBUG) + # only the debug library is available + find_package_handle_standard_args(Cairo + FOUND_VAR Cairo_FOUND + REQUIRED_VARS Cairo_LIBRARY_DEBUG Cairo_INCLUDE_DIR + VERSION_VAR Cairo_VERSION + ) + set(Cairo_LIBRARIES debug ${Cairo_LIBRARY_DEBUG}) +else() + # neither library is available - give standard error message + find_package_handle_standard_args(Cairo + FOUND_VAR Cairo_FOUND + REQUIRED_VARS Cairo_LIBRARY_RELEASE Cairo_LIBRARY_DEBUG Cairo_INCLUDE_DIR + VERSION_VAR Cairo_VERSION + ) +endif() if (Cairo_LIBRARY AND NOT TARGET Cairo::Cairo) add_library(Cairo::Cairo UNKNOWN IMPORTED GLOBAL) set_target_properties(Cairo::Cairo PROPERTIES - IMPORTED_LOCATION "${Cairo_LIBRARY}" + IMPORTED_LOCATION "${Cairo_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG "${Cairo_LIBRARY_DEBUG}" INTERFACE_COMPILE_OPTIONS "${Cairo_COMPILE_OPTIONS}" INTERFACE_INCLUDE_DIRECTORIES "${Cairo_INCLUDE_DIR}" ) endif () -mark_as_advanced(Cairo_INCLUDE_DIR Cairo_LIBRARIES) +mark_as_advanced(Cairo_INCLUDE_DIR Cairo_LIBRARY_RELEASE Cairo_LIBRARY_DEBUG) if (Cairo_FOUND) set(Cairo_LIBRARIES ${Cairo_LIBRARY}) set(Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR}) -endif () \ No newline at end of file +endif () From e60d4368eda084cb2c813e4ecff40d4ff96e415f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 27 Jan 2021 01:17:00 +0100 Subject: [PATCH 049/141] add option to disable shared lib fixup --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c533e282..009c13f72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ project(mapnik set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully" "") +option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (currently only windows) to the executable directory" ON) option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) option(BUILD_TEST "builds the tests" ON) From 4bc99d8047e829aaa7d26fcedfb51d691d14da28 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 27 Jan 2021 01:20:32 +0100 Subject: [PATCH 050/141] should use the ADDITIONAL_LIBARIES_PATHS var... --- demo/viewer/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 599255d9f..8d12c33e9 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -46,7 +46,7 @@ install(TARGETS mapnik-viewer ) -if(WIN32) +if(ADDITIONAL_LIBARIES_PATHS AND WIN32) include(CopyDllsForDebug) add_custom_command(TARGET mapnik-viewer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) copy_dlls_for_debug(mapnik-viewer \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 05cdfbe99..37947404b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -168,7 +168,7 @@ include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) -if(WIN32) +if(ADDITIONAL_LIBARIES_PATHS AND WIN32) include(CopyDllsForDebug) add_custom_command(TARGET mapnik-test-unit POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) set(APPS mapnik-test-unit agg_rasterizer_integer_overflow_test datasource_registration_test font_registration_test map_xml_test mapnik-test-visual) From 0b76278adce93d844d9cd135074d1631cd2ef173 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 27 Jan 2021 01:22:41 +0100 Subject: [PATCH 051/141] its getting too late.. --- demo/viewer/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 8d12c33e9..c618b6fa5 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -46,7 +46,7 @@ install(TARGETS mapnik-viewer ) -if(ADDITIONAL_LIBARIES_PATHS AND WIN32) +if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) include(CopyDllsForDebug) add_custom_command(TARGET mapnik-viewer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) copy_dlls_for_debug(mapnik-viewer \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 37947404b..025a872d0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -168,7 +168,7 @@ include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) -if(ADDITIONAL_LIBARIES_PATHS AND WIN32) +if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) include(CopyDllsForDebug) add_custom_command(TARGET mapnik-test-unit POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) set(APPS mapnik-test-unit agg_rasterizer_integer_overflow_test datasource_registration_test font_registration_test map_xml_test mapnik-test-visual) From dec905651161fd7c32496746cfbac9a20fc314d8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 3 Feb 2021 19:14:08 +0100 Subject: [PATCH 052/141] remove unnecessary cmake_minimum_required from sub projects --- demo/CMakeLists.txt | 2 -- deps/CMakeLists.txt | 1 - deps/agg/CMakeLists.txt | 1 - plugins/CMakeLists.txt | 1 - plugins/input/CMakeLists.txt | 1 - plugins/input/csv/CMakeLists.txt | 3 +-- plugins/input/gdal/CMakeLists.txt | 1 - plugins/input/geobuf/CMakeLists.txt | 3 +-- plugins/input/geojson/CMakeLists.txt | 1 - plugins/input/ogr/CMakeLists.txt | 1 - plugins/input/pgraster/CMakeLists.txt | 1 - plugins/input/postgis/CMakeLists.txt | 1 - plugins/input/raster/CMakeLists.txt | 1 - plugins/input/shape/CMakeLists.txt | 1 - plugins/input/sqlite/CMakeLists.txt | 1 - plugins/input/topojson/CMakeLists.txt | 1 - src/CMakeLists.txt | 3 --- src/json/CMakeLists.txt | 2 -- src/wkt/CMakeLists.txt | 3 --- utils/CMakeLists.txt | 1 - 20 files changed, 2 insertions(+), 28 deletions(-) diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index 1bc4c8ddd..f69a8f697 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) - if(BUILD_DEMO_VIEWER) message(STATUS "Building demo viewer") add_subdirectory(viewer) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index e96f65584..603a29b69 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -1,2 +1 @@ -cmake_minimum_required(VERSION 3.15.0) add_subdirectory(agg) diff --git a/deps/agg/CMakeLists.txt b/deps/agg/CMakeLists.txt index ef505cdfa..f54669c49 100644 --- a/deps/agg/CMakeLists.txt +++ b/deps/agg/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(agg) add_library(agg INTERFACE) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index f53de93d3..76cc4ef34 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,2 +1 @@ -cmake_minimum_required(VERSION 3.15.0) add_subdirectory(input) diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 78250545b..d289c2a3e 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) if(USE_PLUGIN_INPUT_CSV) message(STATUS "using input plugin csv") add_subdirectory(csv) diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index bef173f84..1c04d128b 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-csv) add_library(input-csv SHARED @@ -23,4 +22,4 @@ set_target_properties(input-csv PROPERTIES SUFFIX ".input") install(TARGETS input-csv RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) \ No newline at end of file +) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 366b3f920..5c47cbb58 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-gdal) find_package(GDAL REQUIRED) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 3e36629ea..77c7ff743 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-geobuf) add_library(input-geobuf SHARED @@ -17,4 +16,4 @@ set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") install(TARGETS input-geobuf RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) \ No newline at end of file +) diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 26a0821a2..6d2c184f9 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-geojson) add_library(input-geojson SHARED diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index c01c6bb5f..d03ac7329 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-ogr) find_package(GDAL REQUIRED) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index a6166128d..3d837eb4f 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-pgraster) find_package(PostgreSQL REQUIRED) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index ba3192a98..f07a45458 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-postgis) find_package(PostgreSQL REQUIRED) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 2aed0fdc0..50586425c 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-raster) add_library(input-raster SHARED diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 6753eb9de..8f90aff12 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-shape) add_library(input-shape SHARED diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 439d19dfb..4bbd0fc98 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-sqlite) find_package(SQLite3 REQUIRED) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 6b3ffb16f..78799a5d1 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) project(input-topojson) add_library(input-topojson SHARED diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2ff07f3fc..e98bc2c3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) - - add_subdirectory(json) add_subdirectory(wkt) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index a8430a2f7..b00651904 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) - add_library(json STATIC extract_bounding_boxes_x3.cpp feature_from_geojson.cpp diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 1741834c2..2e3fc5fb9 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -1,6 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) - - add_library(wkt STATIC geometry_to_wkt.cpp mapnik_wkt_generator_grammar.cpp diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 9a95c5713..7aca5c8e4 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.15.0) if(BUILD_UTILITY_GEOMETRY_TO_WKB) message(STATUS "building utility geometry_to_wkb") add_subdirectory(geometry_to_wkb) From 1f73d1c77171165ee8d404be77fe0d4e566b3bd2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 3 Feb 2021 19:29:43 +0100 Subject: [PATCH 053/141] rename boost::boost to boost::headers, added missing icu components --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 009c13f72..95131765f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ 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_PROJ "adds proj support" ON) option(USE_GRID_RENDERER "adds grid renderer" ON) option(USE_SVG_RENDERER "adds grid renderer" ON) @@ -83,7 +83,7 @@ message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) -find_package(ICU REQUIRED COMPONENTS uc) +find_package(ICU REQUIRED COMPONENTS uc i18n data) find_package(Freetype REQUIRED) find_package(harfbuzz CONFIG REQUIRED) @@ -189,7 +189,7 @@ if(USE_CAIRO) list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) endif() -if(USE_PROJ4) +if(USE_PROJ) #https://proj.org/development/cmake.html message(STATUS "Using PROJ4") find_package(PROJ4 CONFIG REQUIRED) @@ -222,10 +222,12 @@ target_include_directories(headers INTERFACE ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) target_link_libraries(headers INTERFACE - Boost::boost + Boost::headers Boost::regex Boost::filesystem ICU::uc + ICU::data + ICU::i18n Freetype::Freetype harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} From 5f02b197ddaf855be2e082d16e8f959cfcd17978 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 3 Feb 2021 19:43:28 +0100 Subject: [PATCH 054/141] get mapnik version from mapnik/version.hpp --- CMakeLists.txt | 8 +++++++- cmake/GetVersion.cmake | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 cmake/GetVersion.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 95131765f..bbcd456fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,17 @@ cmake_minimum_required(VERSION 3.15.0) + +include(cmake/GetVersion.cmake) +get_mapnik_version() + project(mapnik - VERSION 3.0.24 + VERSION ${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}.${MAPNIK_PATCH_VERSION} HOMEPAGE_URL "https://mapnik.org/" DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" LANGUAGES CXX ) +message(STATUS "mapnik version: ${PROJECT_VERSION}") + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully" "") diff --git a/cmake/GetVersion.cmake b/cmake/GetVersion.cmake new file mode 100644 index 000000000..8c512645b --- /dev/null +++ b/cmake/GetVersion.cmake @@ -0,0 +1,12 @@ +macro(get_mapnik_version) + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/mapnik/version.hpp VERSION_FILE) + + string(REGEX MATCH "MAPNIK_MAJOR_VERSION ([0-9]*)" _ ${VERSION_FILE}) + set(MAPNIK_MAJOR_VERSION ${CMAKE_MATCH_1}) + + string(REGEX MATCH "MAPNIK_MINOR_VERSION ([0-9]*)" _ ${VERSION_FILE}) + set(MAPNIK_MINOR_VERSION ${CMAKE_MATCH_1}) + + string(REGEX MATCH "MAPNIK_PATCH_VERSION ([0-9]*)" _ ${VERSION_FILE}) + set(MAPNIK_PATCH_VERSION ${CMAKE_MATCH_1}) +endmacro() From 54a61f7553d21bb0cdf5195fc17d0454afc9217b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 3 Feb 2021 22:47:15 +0100 Subject: [PATCH 055/141] add dlcfn on non windows systems --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbcd456fc..c5243dc16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,12 @@ if(USE_SVG_RENDERER) list(APPEND MAPNIK_COMPILE_DEFS SVG_RENDERER) endif() +if(NOT WIN32) + message(STATUS "Compiling with -DMAPNIK_COMPILE_DEFS") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_HAS_DLCFN) + list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) +endif() + add_library(headers INTERFACE) add_library(mapnik::headers ALIAS headers) From 74b325e71a368084306ccac4eebcdfc00b018a69 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 3 Feb 2021 22:48:25 +0100 Subject: [PATCH 056/141] fix comment --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5243dc16..fafa50ae8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,7 +215,7 @@ if(USE_SVG_RENDERER) endif() if(NOT WIN32) - message(STATUS "Compiling with -DMAPNIK_COMPILE_DEFS") + message(STATUS "Compiling with -DMAPNIK_HAS_DLCFN") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_HAS_DLCFN) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) endif() From 2009598cdc56403152e3288c473d714bda7ed3f4 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 3 Feb 2021 22:53:02 +0100 Subject: [PATCH 057/141] cmake do not test cmp0110 on versions less 3.19 --- test/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 025a872d0..e4b8eeef2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,9 +16,12 @@ set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) add_library(Catch INTERFACE) target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}) -# for cmake 3.19+ https://cmake.org/cmake/help/git-stage/policy/CMP0110.html -# might not be needed if catch updates its cmakes -cmake_policy(SET CMP0110 OLD) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0") + # for cmake 3.19+ https://cmake.org/cmake/help/git-stage/policy/CMP0110.html + # might not be needed if catch updates its cmakes + cmake_policy(SET CMP0110 OLD) +endif() + add_executable(mapnik-test-unit unit/run.cpp From 3a6362f1a9f976e7a12949d5387da2a5b8a4efb2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 5 Feb 2021 19:35:35 +0100 Subject: [PATCH 058/141] added clang toolchain file --- cmake/clang.cmake | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cmake/clang.cmake diff --git a/cmake/clang.cmake b/cmake/clang.cmake new file mode 100644 index 000000000..93aa0c73f --- /dev/null +++ b/cmake/clang.cmake @@ -0,0 +1,6 @@ +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") From f9d65edf203e78bc026b32552978dfc767bad109 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Mar 2021 08:57:50 +0100 Subject: [PATCH 059/141] oops. do not push github workflow --- .github/workflows/cmake.yml | 46 ------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index d5217692c..000000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CMake - -on: [push] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Create Build Environment - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory ${{runner.workspace}}/build - - - name: Configure CMake - # Use a bash shell so we can use the same syntax for environment variable - # access regardless of the host operating system - shell: bash - working-directory: ${{runner.workspace}}/build - # Note the current convention is to use the -S and -B options here to specify source - # and build directories, but this is only available with CMake 3.13 and higher. - # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE - - - name: Build - working-directory: ${{runner.workspace}}/build - shell: bash - # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE - - - name: Test - working-directory: ${{runner.workspace}}/build - shell: bash - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C $BUILD_TYPE From c1d9bde8863c90affea4195fab176ee952262432 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 15 Mar 2021 10:03:26 +0100 Subject: [PATCH 060/141] fix find cairo --- cmake/FindCairo.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index c6a33fa1b..adf0c8e9c 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -124,7 +124,7 @@ else() ) endif() -if (Cairo_LIBRARY AND NOT TARGET Cairo::Cairo) +if (NOT TARGET Cairo::Cairo) add_library(Cairo::Cairo UNKNOWN IMPORTED GLOBAL) set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION "${Cairo_LIBRARY_RELEASE}" From a0d60f233b7e41a057478529a64ee04f74e9f4f5 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 17 Mar 2021 21:29:00 +0100 Subject: [PATCH 061/141] fixes cairo renderer debug configuration. Copied FindCairo had a lot of issues with the multiconfiguration settings. Rewrite of the whole file --- cmake/FindCairo.cmake | 200 ++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 122 deletions(-) diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index adf0c8e9c..1dc42a6a0 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -1,142 +1,98 @@ -# Copyright (C) 2020 Sony Interactive Entertainment Inc. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS -# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. #[=======================================================================[.rst: FindCairo --------------- +----------- + +Find Cairo 2D graphics library. -Find Cairo headers and libraries. Imported Targets ^^^^^^^^^^^^^^^^ +This module defines :prop_tgt:`IMPORTED` target ``Cairo::Cairo``, if +cairo has been found. -``Cairo::Cairo`` - The Cairo library, if found. - -Result Variables +Result variables ^^^^^^^^^^^^^^^^ -This will define the following variables in your project: - -``Cairo_FOUND`` - true if (the requested version of) Cairo is available. -``Cairo_VERSION`` - the version of Cairo. -``Cairo_LIBRARIES`` - the libraries to link against to use Cairo. -``Cairo_INCLUDE_DIRS`` - where to find the Cairo headers. -``Cairo_COMPILE_OPTIONS`` - this should be passed to target_compile_options(), if the - target is not used for linking +This module will set the following variables in your project: +``CAIRO_FOUND`` + True if cairo headers and library were found. +``CAIRO_INCLUDE_DIRS`` + Directory where cairo headers are located. +``CAIRO_LIBRARIES`` + cairo libraries to link against. +``CAIRO_VERSION_MAJOR`` + The major version of cairo +``CAIRO_VERSION_MINOR`` + The minor version of cairo +``CAIRO_VERSION_PATCH`` + The patch version of cairo +``CAIRO_VERSION_STRING`` + version number as a string (ex: "1.16.0") #]=======================================================================] -find_package(PkgConfig QUIET) -pkg_check_modules(PC_CAIRO QUIET cairo) -set(Cairo_COMPILE_OPTIONS ${PC_CAIRO_CFLAGS_OTHER}) -set(Cairo_VERSION ${PC_CAIRO_VERSION}) - -find_path(Cairo_INCLUDE_DIR - NAMES cairo.h - HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR} - PATH_SUFFIXES cairo -) - -find_library(Cairo_LIBRARY_RELEASE - NAMES ${Cairo_NAMES} cairo - HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS} -) - -find_library(Cairo_LIBRARY_DEBUG - NAMES ${Cairo_NAMES} cairod - HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS} -) - -if (Cairo_INCLUDE_DIR AND NOT Cairo_VERSION) - if (EXISTS "${Cairo_INCLUDE_DIR}/cairo-version.h") - file(READ "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_CONTENT) - - string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}") - set(Cairo_VERSION_MAJOR "${CMAKE_MATCH_1}") - - string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}") - set(Cairo_VERSION_MINOR "${CMAKE_MATCH_1}") - - string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}") - set(Cairo_VERSION_PATCH "${CMAKE_MATCH_1}") - - set(Cairo_VERSION "${Cairo_VERSION_MAJOR}.${Cairo_VERSION_MINOR}.${Cairo_VERSION_PATCH}") - endif () -endif () - -include(FindPackageHandleStandardArgs) -if(Cairo_LIBRARY_RELEASE AND Cairo_LIBRARY_DEBUG) - # set the libaries varible to use the release and debug versions - find_package_handle_standard_args(Cairo - FOUND_VAR Cairo_FOUND - REQUIRED_VARS Cairo_LIBRARY_RELEASE Cairo_LIBRARY_DEBUG Cairo_INCLUDE_DIR - VERSION_VAR Cairo_VERSION - ) - set(Cairo_LIBRARIES optimized ${Cairo_LIBRARY_RELEASE} debug ${Cairo_LIBRARY_DEBUG}) -elseif(Cairo_LIBRARY_RELEASE) - # only the release library is available - find_package_handle_standard_args(Cairo - FOUND_VAR Cairo_FOUND - REQUIRED_VARS Cairo_LIBRARY_RELEASE Cairo_INCLUDE_DIR - VERSION_VAR Cairo_VERSION - ) - set(Cairo_LIBRARIES optimized ${Cairo_LIBRARY_RELEASE}) -elseif(Cairo_LIBRARY_DEBUG) - # only the debug library is available - find_package_handle_standard_args(Cairo - FOUND_VAR Cairo_FOUND - REQUIRED_VARS Cairo_LIBRARY_DEBUG Cairo_INCLUDE_DIR - VERSION_VAR Cairo_VERSION - ) - set(Cairo_LIBRARIES debug ${Cairo_LIBRARY_DEBUG}) +if(NOT CAIRO_LIBRARY) + find_path(CAIRO_INCLUDE_DIR NAMES cairo.h HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR} PATH_SUFFIXES cairo) + find_library(CAIRO_LIBRARY_RELEASE NAMES ${Cairo_NAMES} cairo HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}) + find_library(CAIRO_LIBRARY_DEBUG NAMES ${Cairo_NAMES} cairod HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}) + include(SelectLibraryConfigurations) + select_library_configurations(CAIRO) else() - # neither library is available - give standard error message - find_package_handle_standard_args(Cairo - FOUND_VAR Cairo_FOUND - REQUIRED_VARS Cairo_LIBRARY_RELEASE Cairo_LIBRARY_DEBUG Cairo_INCLUDE_DIR - VERSION_VAR Cairo_VERSION - ) + file(TO_CMAKE_PATH "${CAIRO_LIBRARY}" CAIRO_LIBRARY) endif() -if (NOT TARGET Cairo::Cairo) - add_library(Cairo::Cairo UNKNOWN IMPORTED GLOBAL) +if(CAIRO_INCLUDE_DIR AND NOT CAIRO_VERSION) + if(EXISTS "${CAIRO_INCLUDE_DIR}/cairo-version.h") + file(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" CAIRO_VERSION_CONTENT) + + string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}") + + string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + set(CAIRO_VERSION_PATCH "${CMAKE_MATCH_1}") + + set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_PATCH}") + set(CAIRO_VERSION_STRING ${CAIRO_VERSION}) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cairo + REQUIRED_VARS + CAIRO_LIBRARY + CAIRO_INCLUDE_DIR + VERSION_VAR + CAIRO_VERSION_STRING +) +mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARY) + +if (CAIRO_FOUND) + set(CAIRO_LIBRARIES ${CAIRO_LIBRARY}) + set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR}) + if(NOT TARGET Cairo::Cairo) + add_library(Cairo::Cairo UNKNOWN IMPORTED) set_target_properties(Cairo::Cairo PROPERTIES - IMPORTED_LOCATION "${Cairo_LIBRARY_RELEASE}" - IMPORTED_LOCATION_DEBUG "${Cairo_LIBRARY_DEBUG}" - INTERFACE_COMPILE_OPTIONS "${Cairo_COMPILE_OPTIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${Cairo_INCLUDE_DIR}" - ) -endif () + INTERFACE_INCLUDE_DIRECTORIES ${CAIRO_INCLUDE_DIR} + IMPORTED_LINK_INTERFACE_LANGUAGES C) -mark_as_advanced(Cairo_INCLUDE_DIR Cairo_LIBRARY_RELEASE Cairo_LIBRARY_DEBUG) + if(CAIRO_LIBRARY_RELEASE) + set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_RELEASE "${CAIRO_LIBRARY_RELEASE}") + endif() -if (Cairo_FOUND) - set(Cairo_LIBRARIES ${Cairo_LIBRARY}) - set(Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR}) + if(CAIRO_LIBRARY_DEBUG) + set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_DEBUG "${CAIRO_LIBRARY_DEBUG}") + endif() + + if(NOT CAIRO_LIBRARY_RELEASE AND NOT CAIRO_LIBRARY_DEBUG) + set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION "${CAIRO_LIBRARY}") + endif() + endif() endif () From ae43a49b71e40fa57f27b1235be2822507ea8e7b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 17 Mar 2021 22:18:21 +0100 Subject: [PATCH 062/141] add dependencies to cmake config. Provieded a new macro for better maintance --- CMakeLists.txt | 31 ++++++++++++++++++------------- cmake/MapnikConfig.cmake.in | 6 ++++++ cmake/MapnikFindPackage.cmake | 6 ++++++ 3 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 cmake/MapnikFindPackage.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index fafa50ae8..30a1c5973 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ project(mapnik message(STATUS "mapnik version: ${PROJECT_VERSION}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(MapnikFindPackage) set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully" "") option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (currently only windows) to the executable directory" ON) @@ -88,10 +89,11 @@ message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") -find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) -find_package(ICU REQUIRED COMPONENTS uc i18n data) -find_package(Freetype REQUIRED) -find_package(harfbuzz CONFIG REQUIRED) + +mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) +mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) +mapnik_find_package(Freetype REQUIRED) +mapnik_find_package(harfbuzz CONFIG REQUIRED) if(USE_EXTERNAL_MAPBOX_GEOMETRY) # this is used to provide a way to specify include dirs with CACHE VARIABLES @@ -156,49 +158,49 @@ set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") if(USE_LIBXML2) message(STATUS "Using LibXml2") - find_package(LibXml2 REQUIRED) + mapnik_find_package(LibXml2 REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) list(APPEND MAPNIK_OPTIONAL_LIBS LibXml2::LibXml2) endif() if(USE_PNG) message(STATUS "Using PNG") - find_package(PNG REQUIRED) + mapnik_find_package(PNG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_PNG) list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() if(USE_JPEG) message(STATUS "Using JPEG") - find_package(JPEG REQUIRED) + mapnik_find_package(JPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) list(APPEND MAPNIK_OPTIONAL_LIBS JPEG::JPEG) endif() if(USE_TIFF) - find_package(TIFF REQUIRED) message(STATUS "Using TIFF") + mapnik_find_package(TIFF REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_TIFF) list(APPEND MAPNIK_OPTIONAL_LIBS TIFF::TIFF) endif() if(USE_WEBP) message(STATUS "Using WEBP") - find_package(WebP CONFIG REQUIRED) + mapnik_find_package(WebP CONFIG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP) list(APPEND MAPNIK_OPTIONAL_LIBS WebP::webp) endif() if(USE_CAIRO) message(STATUS "Using Cairo renderer") - find_package(Cairo REQUIRED) + mapnik_find_package(Cairo REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO) list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) endif() if(USE_PROJ) #https://proj.org/development/cmake.html - message(STATUS "Using PROJ4") - find_package(PROJ4 CONFIG REQUIRED) + message(STATUS "Using PROJ") + mapnik_find_package(PROJ4 CONFIG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4 ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1) list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) @@ -276,10 +278,11 @@ write_basic_package_version_file( COMPATIBILITY SameMajorVersion ) +list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES) configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MapnikConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" INSTALL_DESTINATION ${INSTALL_CMAKE_DIR} - PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR + PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES ) install(FILES @@ -287,6 +290,8 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" DESTINATION ${INSTALL_CMAKE_DIR} ) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake" DESTINATION ${INSTALL_CMAKE_DIR}/Modules) + install(EXPORT MapnikTargets FILE MapnikTargets.cmake NAMESPACE mapnik:: diff --git a/cmake/MapnikConfig.cmake.in b/cmake/MapnikConfig.cmake.in index 0785d57f7..74071d493 100644 --- a/cmake/MapnikConfig.cmake.in +++ b/cmake/MapnikConfig.cmake.in @@ -4,6 +4,12 @@ set_and_check(MAPNIK_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" CACHE STRING "" set_and_check(MAPNIK_PLUGINS_DIR "@PACKAGE_PLUGINS_INSTALL_DIR@" CACHE STRING "") set_and_check(MAPNIK_FONTS_DIR "@PACKAGE_FONTS_INSTALL_DIR@" CACHE STRING "") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/") + +include(CMakeFindDependencyMacro) +@MAPNIK_DEPENDENCIES@ + + include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") check_required_components(mapnik) diff --git a/cmake/MapnikFindPackage.cmake b/cmake/MapnikFindPackage.cmake new file mode 100644 index 000000000..d4e6c5acd --- /dev/null +++ b/cmake/MapnikFindPackage.cmake @@ -0,0 +1,6 @@ +macro(mapnik_find_package) + find_package(${ARGN}) + set(MAPNIK_TMP_DEP ${ARGN}) + list(JOIN MAPNIK_TMP_DEP " " MAPNIK_TMP_DEP) + list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})") +endmacro() From 4e898b2a52ffe6fa83f870cee07075c4534d5144 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 17 Mar 2021 22:37:46 +0100 Subject: [PATCH 063/141] added some basic READMEs --- INSTALL.md | 7 +++++++ docs/cmake-usage.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 docs/cmake-usage.md diff --git a/INSTALL.md b/INSTALL.md index 4ef4a2124..7ee6420c0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,6 +2,13 @@ Mapnik runs on Linux, OS X, Windows, and BSD systems. +## Package managers +### vcpkg +To install mapnik with vcpkg type `vcpkg install mapnik`. It will install a minimal version of mapnik and all the needed dependencies. +To install more features, type `vcpkg search mapnik` to see all available features. + +## Source build + First clone mapnik from github and initialize submodules ```bash diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md new file mode 100644 index 000000000..e3d4e84a7 --- /dev/null +++ b/docs/cmake-usage.md @@ -0,0 +1,34 @@ +# Usage with CMake +## Build +First clone mapnik from github and initialize submodules + +```bash +git clone https://github.com/mapnik/mapnik.git +cd mapnik +git submodule update --init +``` + +Make sure that all dependencies are installed. + +All available cmake options are listed at the top of [CMakeLists.txt](../CMakeLists.txt). +Pass your options while configuring e.g.: `cmake -DBUILD_DEMO_VIEWER=OFF ..` to disable the build of the demo viewer application. + +To quickstart open a console in the root mapnik dir and execute the following commands: (Pass all options and dependency dirs after `-DBUILD_TEST=OFF`) +``` +> cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST=OFF +> cmake --build build --target install +``` + +## Usage + +To use Mapnik in your project add the following lines to your CMakeLists.tzt. +``` +find_package(mapnik CONFIG REQUIRED) +[...] +target_link_libraries(mytarget ... mapnik::headers mapnik::mapnik) +``` + +All mapnik executables and targets are exported within `MapnikTargets.cmake`. + +The plugin dir is available in the variable `MAPNIK_PLUGINS_DIR`. +The font path is is available in the variable `MAPNIK_FONTS_DIR`. From 4604aee20243d03805d989e4e45f8683ca302674 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 17 Mar 2021 23:06:49 +0100 Subject: [PATCH 064/141] 3.15 is the minium supported target. tested. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30a1c5973..a2b3c1471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required(VERSION 3.15.0) +cmake_minimum_required(VERSION 3.15) +# 3.15 is required since the Boost::XXXX targets was first added. https://cmake.org/cmake/help/latest/module/FindBoost.html#imported-targets +# 3.14 is required since SQLite3 Module was first added. https://cmake.org/cmake/help/latest/module/FindSQLite3.html#findsqlite3 include(cmake/GetVersion.cmake) get_mapnik_version() From 36be4fe594cd768b911d137f73b15c823eb9898c Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 18 Mar 2021 15:35:55 +0100 Subject: [PATCH 065/141] renamed target mapnik::headers to mapnik::core --- CMakeLists.txt | 12 ++++++------ demo/c++/CMakeLists.txt | 2 +- demo/viewer/CMakeLists.txt | 2 +- deps/agg/CMakeLists.txt | 2 +- docs/cmake-usage.md | 2 +- plugins/input/csv/CMakeLists.txt | 2 +- plugins/input/gdal/CMakeLists.txt | 2 +- plugins/input/geobuf/CMakeLists.txt | 2 +- plugins/input/geojson/CMakeLists.txt | 2 +- plugins/input/ogr/CMakeLists.txt | 2 +- plugins/input/pgraster/CMakeLists.txt | 2 +- plugins/input/postgis/CMakeLists.txt | 2 +- plugins/input/raster/CMakeLists.txt | 2 +- plugins/input/shape/CMakeLists.txt | 2 +- plugins/input/sqlite/CMakeLists.txt | 2 +- plugins/input/topojson/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- src/json/CMakeLists.txt | 2 +- src/wkt/CMakeLists.txt | 2 +- test/CMakeLists.txt | 12 ++++++------ utils/geometry_to_wkb/CMakeLists.txt | 2 +- utils/mapnik-index/CMakeLists.txt | 2 +- utils/mapnik-render/CMakeLists.txt | 2 +- utils/ogrindex/CMakeLists.txt | 2 +- utils/pgsql2sqlite/CMakeLists.txt | 2 +- utils/shapeindex/CMakeLists.txt | 2 +- utils/svg2png/CMakeLists.txt | 2 +- 27 files changed, 37 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2b3c1471..6f4e3fd84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,10 +224,10 @@ if(NOT WIN32) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) endif() -add_library(headers INTERFACE) -add_library(mapnik::headers ALIAS headers) +add_library(mapnik-core INTERFACE) +add_library(mapnik::core ALIAS mapnik-core) -target_include_directories(headers INTERFACE +target_include_directories(mapnik-core INTERFACE $ $ $ @@ -237,7 +237,7 @@ target_include_directories(headers INTERFACE $ ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) -target_link_libraries(headers INTERFACE +target_link_libraries(mapnik-core INTERFACE Boost::headers Boost::regex Boost::filesystem @@ -248,9 +248,9 @@ target_link_libraries(headers INTERFACE harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} ) -target_compile_definitions(headers INTERFACE ${MAPNIK_COMPILE_DEFS}) +target_compile_definitions(mapnik-core INTERFACE ${MAPNIK_COMPILE_DEFS}) -install(TARGETS headers +install(TARGETS mapnik-core EXPORT MapnikTargets LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 48e83ce78..fece18e8a 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -2,7 +2,7 @@ project(mapnik-demo) add_executable(mapnik-demo rundemo.cpp) -target_link_libraries(mapnik-demo PRIVATE mapnik::headers mapnik::agg mapnik::mapnik) +target_link_libraries(mapnik-demo PRIVATE mapnik::core mapnik::agg mapnik::mapnik) install(TARGETS mapnik-demo LIBRARY DESTINATION ${MAPNIK_LIB_DIR} diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index c618b6fa5..5d71d1c40 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -29,7 +29,7 @@ set_target_properties(mapnik-viewer PROPERTIES target_link_libraries(mapnik-viewer PRIVATE Qt5::Widgets - mapnik::headers + mapnik::core mapnik::agg mapnik::mapnik ) diff --git a/deps/agg/CMakeLists.txt b/deps/agg/CMakeLists.txt index f54669c49..9cd0de942 100644 --- a/deps/agg/CMakeLists.txt +++ b/deps/agg/CMakeLists.txt @@ -7,7 +7,7 @@ target_include_directories(agg INTERFACE $ $ ) -target_link_libraries(agg INTERFACE mapnik::headers) +target_link_libraries(agg INTERFACE mapnik::core) install(TARGETS agg EXPORT MapnikTargets diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index e3d4e84a7..57de8f507 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -25,7 +25,7 @@ To use Mapnik in your project add the following lines to your CMakeLists.tzt. ``` find_package(mapnik CONFIG REQUIRED) [...] -target_link_libraries(mytarget ... mapnik::headers mapnik::mapnik) +target_link_libraries(mytarget ... mapnik::core mapnik::mapnik) ``` All mapnik executables and targets are exported within `MapnikTargets.cmake`. diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 1c04d128b..677ac2538 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(input-csv SHARED add_library(mapnik::plugin::input::csv ALIAS input-csv) target_link_libraries(input-csv PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik mapnik::wkt mapnik::json diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 5c47cbb58..4b35fb814 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(mapnik::plugin::input::gdal ALIAS input-gdal) target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIR}) target_link_libraries(input-gdal PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik ${GDAL_LIBRARY} ) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 77c7ff743..73d39e14a 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -7,7 +7,7 @@ add_library(input-geobuf SHARED add_library(mapnik::plugin::input::geobuf ALIAS input-geobuf) target_link_libraries(input-geobuf PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik ) set_target_properties(input-geobuf PROPERTIES PREFIX "") diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 6d2c184f9..09da0e935 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -9,7 +9,7 @@ add_library(input-geojson SHARED add_library(mapnik::plugin::input::geojson ALIAS input-geojson) target_link_libraries(input-geojson PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik mapnik::json ) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index d03ac7329..3656e3a79 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -12,7 +12,7 @@ add_library(mapnik::plugin::input::ogr ALIAS input-ogr) target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIR}) target_link_libraries(input-ogr PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik ${GDAL_LIBRARY} ) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 3d837eb4f..fe6622cf0 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -11,7 +11,7 @@ add_library(mapnik::plugin::input::pgraster ALIAS input-pgraster) target_link_libraries(input-pgraster PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik PostgreSQL::PostgreSQL ) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index f07a45458..73113f282 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -9,7 +9,7 @@ add_library(input-postgis SHARED add_library(mapnik::plugin::input::postgis ALIAS input-postgis) target_link_libraries(input-postgis PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik PostgreSQL::PostgreSQL ) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 50586425c..548a361a2 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -8,7 +8,7 @@ add_library(input-raster SHARED add_library(mapnik::plugin::input::raster ALIAS input-raster) target_link_libraries(input-raster PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik ) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 8f90aff12..ed3a1f365 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -11,7 +11,7 @@ add_library(input-shape SHARED add_library(mapnik::plugin::input::shape ALIAS input-shape) target_link_libraries(input-shape PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik ) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 4bbd0fc98..7be226609 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -9,7 +9,7 @@ add_library(input-sqlite SHARED add_library(mapnik::plugin::input::sqlite ALIAS input-sqlite) target_link_libraries(input-sqlite PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik SQLite::SQLite3 ) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 78799a5d1..baefe69ee 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -7,7 +7,7 @@ add_library(input-topojson SHARED add_library(mapnik::plugin::input::topojson ALIAS input-topojson) target_link_libraries(input-topojson PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik mapnik::json ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e98bc2c3b..7599ba4b4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -290,7 +290,7 @@ endif() target_compile_definitions(mapnik PRIVATE ${COMPILE_DEFS}) target_link_libraries(mapnik PRIVATE - mapnik::headers + mapnik::core mapnik::agg ) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index b00651904..183b7c745 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories(json PRIVATE ${MAPBOX_GEOMETRY_INCLUDE_DIRS} ${MAPBOX_VARIANT_INCLUDE_DIRS} ) -target_link_libraries(json PRIVATE mapnik::headers ${ICUU_LIB}) +target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) install(TARGETS json EXPORT MapnikTargets diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 2e3fc5fb9..35168f669 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -16,7 +16,7 @@ target_include_directories(wkt PRIVATE ${MAPBOX_GEOMETRY_INCLUDE_DIRS} ${MAPBOX_VARIANT_INCLUDE_DIRS} ) -target_link_libraries(wkt PRIVATE mapnik::headers) +target_link_libraries(wkt PRIVATE mapnik::core) install(TARGETS wkt EXPORT MapnikTargets diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e4b8eeef2..c5787b6ac 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -108,7 +108,7 @@ add_executable(mapnik-test-unit ) target_link_libraries(mapnik-test-unit PUBLIC Catch - mapnik::headers + mapnik::core mapnik::agg mapnik::mapnik mapnik::json @@ -118,7 +118,7 @@ target_link_libraries(mapnik-test-unit PUBLIC add_executable(agg_rasterizer_integer_overflow_test standalone/agg_rasterizer_integer_overflow_test.cpp) target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC Catch - mapnik::headers + mapnik::core mapnik::mapnik mapnik::agg mapnik::json @@ -127,7 +127,7 @@ target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC add_executable(datasource_registration_test standalone/datasource_registration_test.cpp) target_link_libraries(datasource_registration_test PUBLIC Catch - mapnik::headers + mapnik::core mapnik::mapnik mapnik::agg ) @@ -135,7 +135,7 @@ target_link_libraries(datasource_registration_test PUBLIC add_executable(font_registration_test standalone/font_registration_test.cpp) target_link_libraries(font_registration_test PUBLIC Catch - mapnik::headers + mapnik::core mapnik::mapnik mapnik::agg mapnik::json @@ -145,7 +145,7 @@ target_link_libraries(font_registration_test PUBLIC add_executable(map_xml_test standalone/map_xml_test.cpp) target_link_libraries(map_xml_test PUBLIC Catch - mapnik::headers + mapnik::core mapnik::mapnik mapnik::agg mapnik::json @@ -162,7 +162,7 @@ target_link_libraries( Catch Boost::program_options Boost::filesystem - mapnik::headers + mapnik::core mapnik::mapnik mapnik::agg ) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index f706fd584..17d8e23cb 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -3,7 +3,7 @@ project(geometry_to_wkb) add_executable(geometry_to_wkb main.cpp) target_link_libraries(geometry_to_wkb PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik ) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index 22076f781..70123b379 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -9,7 +9,7 @@ add_executable(mapnik-index ../../plugins/input/csv/csv_utils.cpp # this project depends on this file ) target_link_libraries(mapnik-index PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik mapnik::json mapnik::wkt diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index eed2e90a6..0dbc73f2a 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -5,7 +5,7 @@ find_package(Boost 1.74 REQUIRED COMPONENTS program_options) add_executable(mapnik-render mapnik-render.cpp) target_link_libraries(mapnik-render PRIVATE - mapnik::headers + mapnik::core mapnik::mapnik Boost::program_options ) diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index 8e9eed31a..ad9c12e41 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -3,7 +3,7 @@ project(ogrindex) add_executable(ogrindex ogrindex.cpp) -target_link_libraries(ogrindex PRIVATE mapnik::headers mapnik::mapnik) +target_link_libraries(ogrindex PRIVATE mapnik::core mapnik::mapnik) install(TARGETS ogrindex EXPORT MapnikTargets diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index c98427ec9..d57046bee 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -13,7 +13,7 @@ target_link_libraries(pgsql2sqlite PRIVATE SQLite::SQLite3 PostgreSQL::PostgreSQL Boost::program_options - mapnik::headers + mapnik::core mapnik::mapnik ) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 969c86817..79a9f24ff 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -9,7 +9,7 @@ add_executable(shapeindex target_include_directories(shapeindex PRIVATE ../../plugins/input/shape) target_link_libraries(shapeindex PRIVATE Boost::program_options - mapnik::headers + mapnik::core mapnik::mapnik ) install(TARGETS shapeindex diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index 015de5c3d..6f1a52eab 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -8,7 +8,7 @@ add_executable(svg2png target_link_libraries(svg2png PRIVATE Boost::program_options - mapnik::headers + mapnik::core mapnik::mapnik mapnik::agg ) From 167461ccc4b740a0a0c2146a275a7efb436b9c1b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 19 Mar 2021 22:51:50 +0100 Subject: [PATCH 066/141] rename internal name mapnik-core to core since the exported name would be mapnik::mapnik-core instead of mapnik::core. This fixes the issue --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f4e3fd84..b6a4e4993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,10 +224,10 @@ if(NOT WIN32) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) endif() -add_library(mapnik-core INTERFACE) -add_library(mapnik::core ALIAS mapnik-core) +add_library(core INTERFACE) +add_library(mapnik::core ALIAS core) -target_include_directories(mapnik-core INTERFACE +target_include_directories(core INTERFACE $ $ $ @@ -237,7 +237,7 @@ target_include_directories(mapnik-core INTERFACE $ ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) -target_link_libraries(mapnik-core INTERFACE +target_link_libraries(core INTERFACE Boost::headers Boost::regex Boost::filesystem @@ -248,9 +248,9 @@ target_link_libraries(mapnik-core INTERFACE harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} ) -target_compile_definitions(mapnik-core INTERFACE ${MAPNIK_COMPILE_DEFS}) +target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) -install(TARGETS mapnik-core +install(TARGETS core EXPORT MapnikTargets LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} From 9835f07179c086cc55b7ae3fd0d44a8173ce7a70 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 14:57:27 +0100 Subject: [PATCH 067/141] find and link icu first --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6a4e4993..8e37eac76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,8 +92,8 @@ message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") -mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) +mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) mapnik_find_package(Freetype REQUIRED) mapnik_find_package(harfbuzz CONFIG REQUIRED) @@ -238,12 +238,12 @@ target_include_directories(core INTERFACE ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) target_link_libraries(core INTERFACE - Boost::headers - Boost::regex - Boost::filesystem ICU::uc ICU::data ICU::i18n + Boost::headers + Boost::regex + Boost::filesystem Freetype::Freetype harfbuzz::harfbuzz ${MAPNIK_OPTIONAL_LIBS} From db6d1a1293b12f2bcdbc5a999fe9de5cc81ddd02 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 15:16:12 +0100 Subject: [PATCH 068/141] fix typo in text --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e37eac76..e7e98d7d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) -set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++11 is minimum.") +set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++14 is minimum.") message(STATUS "Using c++${CMAKE_CXX_STANDARD}") if(WIN32) From 61a12482621859726c52f2b4d2f24c7ece88f32c Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 15:17:08 +0100 Subject: [PATCH 069/141] fix false default cmake install dir --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7e98d7d3..c68aef0c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ set(MAPNIK_LIB_DIR ${DEFAULT_LIB_DIR} CACHE STRING "Install directory for librar # https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#archive-output-artifacts set(MAPNIK_ARCHIVE_DIR ${DEFAULT_ARCHIVE_DIR} CACHE STRING "Install directory for archives") -set(INSTALL_CMAKE_DIR ${MAPNIK_LIB_DIR}/mapnik/cmake CACHE STRING "Install directory of the cmake targets") +set(INSTALL_CMAKE_DIR ${MAPNIK_LIB_DIR}/cmake/mapnik CACHE STRING "Install directory of the cmake targets") if(WIN32) set(DEFAULT_PLUGINS_INSTALL_DIR ${MAPNIK_BIN_DIR}/mapnik/input) From e963af53a52d2511ab96bc23b1a84aad824525af Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 15:21:39 +0100 Subject: [PATCH 070/141] find proj without config --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c68aef0c5..7a2b82559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,7 +202,7 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html message(STATUS "Using PROJ") - mapnik_find_package(PROJ4 CONFIG REQUIRED) + mapnik_find_package(PROJ4 REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4 ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1) list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) From 772e50ba792345f6732b8d19f41122632c7977dc Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 23:28:36 +0100 Subject: [PATCH 071/141] copy basic dlls for mapnik-demo --- demo/c++/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index fece18e8a..bdb517ec0 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -9,3 +9,9 @@ install(TARGETS mapnik-demo ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) + +if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) + include(CopyDllsForDebug) + add_custom_command(TARGET mapnik-demo POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) + copy_dlls_for_debug(mapnik-demo \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") +endif() From 59b97a57fc82bfb6079012b7b66f8fb3ee0d1823 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 23:31:11 +0100 Subject: [PATCH 072/141] test data changes --- test/data | 2 +- test/data-visual | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/data b/test/data index dd0c41c3f..c67cf1185 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit dd0c41c3f9f5dc98291a727af00bb42734d2a8c0 +Subproject commit c67cf11850d65e963e6103b6141f1eca67667aa2 diff --git a/test/data-visual b/test/data-visual index 1f20cf257..bacfd251d 160000 --- a/test/data-visual +++ b/test/data-visual @@ -1 +1 @@ -Subproject commit 1f20cf257f35224d3c139a6015b1cf70814b0d24 +Subproject commit bacfd251da550fa82ea56f6710dc6f85431480c2 From 31c0b0854879920d559b669ac4a5a9696f8fbfba Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 24 Mar 2021 23:55:12 +0100 Subject: [PATCH 073/141] renamed MAPNIK_USE_PROJ4 to MAPNIK_USE_PROJ and removed ACCEPT_USE_OF_DEPRECATED_PROJ_API_H --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a2b82559..72e308dba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,7 +203,7 @@ if(USE_PROJ) #https://proj.org/development/cmake.html message(STATUS "Using PROJ") mapnik_find_package(PROJ4 REQUIRED) - list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ4 ACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ) list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() From 0a3bb4e8bdecfa891db91bf0128e34f410aca6ec Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 08:52:09 +0100 Subject: [PATCH 074/141] update test data deps. somehow got messed up in last commit --- test/data | 2 +- test/data-visual | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/data b/test/data index c67cf1185..dd0c41c3f 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit c67cf11850d65e963e6103b6141f1eca67667aa2 +Subproject commit dd0c41c3f9f5dc98291a727af00bb42734d2a8c0 diff --git a/test/data-visual b/test/data-visual index bacfd251d..1f20cf257 160000 --- a/test/data-visual +++ b/test/data-visual @@ -1 +1 @@ -Subproject commit bacfd251da550fa82ea56f6710dc6f85431480c2 +Subproject commit 1f20cf257f35224d3c139a6015b1cf70814b0d24 From c29c84327a8f8d357e3ed4eb086623aadb8618d2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 13:34:25 +0100 Subject: [PATCH 075/141] add proj_transform_cache to source list --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7599ba4b4..a17e9d6b0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,6 +58,7 @@ set(MAPNIK_SOURCES parse_transform.cpp path_expression_grammar_x3.cpp plugin.cpp + proj_transform_cache.cpp proj_transform.cpp projection.cpp raster_colorizer.cpp From b2116fd9e9e484aec16dc3903c331d9fae3434ff Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 17:26:29 +0100 Subject: [PATCH 076/141] added benchmarks; needed mutex header --- CMakeLists.txt | 5 +++ benchmark/CMakeLists.txt | 44 +++++++++++++++++++++++++++ benchmark/include/bench_framework.hpp | 1 + 3 files changed, 50 insertions(+) create mode 100644 benchmark/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 72e308dba..b2a86d971 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,8 @@ option(USE_PLUGIN_INPUT_TOPOJSON "adds plugin input topojson" ON) option(BUILD_DEMO_VIEWER "builds the demo viewer" ON) option(BUILD_DEMO_CPP "builds the demo c++ application" ON) +option(BUILD_BENCHMARK "builds benchmark project" ON) + option(BUILD_UTILITY_GEOMETRY_TO_WKB "builds the utility program geometry_to_wkb" ON) option(BUILD_UTILITY_MAPNIK_INDEX "builds the utility program mapnik_index" ON) option(BUILD_UTILITY_MAPNIK_RENDER "builds the utility program mapnik_render" ON) @@ -264,6 +266,9 @@ add_subdirectory(src) add_subdirectory(plugins) add_subdirectory(utils) add_subdirectory(demo) +if(BUILD_BENCHMARK) + add_subdirectory(benchmark) +endif() if(BUILD_TEST) enable_testing() add_subdirectory(test) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt new file mode 100644 index 000000000..825fc95ea --- /dev/null +++ b/benchmark/CMakeLists.txt @@ -0,0 +1,44 @@ +project(mapnik-benchmark) + +set(BENCHMARK_SRCS + src/normalize_angle.cpp + src/test_array_allocation.cpp + src/test_expression_parse.cpp + src/test_face_ptr_creation.cpp + src/test_font_registration.cpp + src/test_getline.cpp + src/test_marker_cache.cpp + src/test_noop_rendering.cpp + src/test_numeric_cast_vs_static_cast.cpp + src/test_offset_converter.cpp + src/test_png_encoding1.cpp + src/test_png_encoding2.cpp + src/test_polygon_clipping_rendering.cpp + src/test_polygon_clipping.cpp + src/test_proj_transform1.cpp + src/test_quad_tree.cpp + src/test_rendering_shared_map.cpp + src/test_rendering.cpp + src/test_to_bool.cpp + src/test_to_double.cpp + src/test_to_int.cpp + src/test_to_string1.cpp + src/test_to_string2.cpp + src/test_utf_encoding.cpp +) +macro(mapnik_create_benchmark) + get_filename_component(BENCHNAME ${ARGV0} NAME_WE) + add_executable(mapnik-benchmark-${BENCHNAME} ${ARGV0}) + target_include_directories(mapnik-benchmark-${BENCHNAME} PRIVATE include) + target_link_libraries(mapnik-benchmark-${BENCHNAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik) + + if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) + include(CopyDllsForDebug) + add_custom_command(TARGET mapnik-benchmark-${BENCHNAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) + copy_dlls_for_debug(mapnik-benchmark-${BENCHNAME} \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") + endif() +endmacro() + +foreach(benchmark ${BENCHMARK_SRCS}) + mapnik_create_benchmark(${benchmark}) +endforeach() diff --git a/benchmark/include/bench_framework.hpp b/benchmark/include/bench_framework.hpp index df2a9e57b..c7729dd16 100644 --- a/benchmark/include/bench_framework.hpp +++ b/benchmark/include/bench_framework.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include namespace benchmark { From eb943d11d0b84c8f0144ce849941d8a2f40ddd61 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 18:42:17 +0100 Subject: [PATCH 077/141] add postgis to unit tests --- test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c5787b6ac..f2feb2bc7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,7 @@ project(mapnik-test) find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(PostgreSQL REQUIRED) include(FetchContent) include(CopyDllsForDebug) @@ -113,6 +114,7 @@ target_link_libraries(mapnik-test-unit PUBLIC mapnik::mapnik mapnik::json mapnik::wkt + PostgreSQL::PostgreSQL ) add_executable(agg_rasterizer_integer_overflow_test standalone/agg_rasterizer_integer_overflow_test.cpp) From 2b977f14c937a64f0a954b904dab6a2fb4e4ced7 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 18:46:18 +0100 Subject: [PATCH 078/141] changed proj; add mapnik_proj_version; use boost regex icu workaround --- CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2a86d971..0264c2b56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,8 @@ option(BUILD_UTILITY_PGSQL2SQLITE "builds the utility program pgsql2sqlite" ON) option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) +option(USE_BOOST_REGEX_ICU_WORKAROUND "if you don't use your system libraries and get double linked icu libraries set this to ON" OFF) + set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++14 is minimum.") message(STATUS "Using c++${CMAKE_CXX_STANDARD}") @@ -96,6 +98,9 @@ message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) +if(USE_BOOST_REGEX_ICU_WORKAROUND) + set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES) +endif() mapnik_find_package(Freetype REQUIRED) mapnik_find_package(harfbuzz CONFIG REQUIRED) @@ -203,11 +208,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - message(STATUS "Using PROJ") - mapnik_find_package(PROJ4 REQUIRED) - list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + mapnik_find_package(PROJ REQUIRED) + message(STATUS "Using PROJ version: ${PROJ_VERSION}") + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From 1367e7007f99476433ce4fede39c14b9620a626b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 25 Mar 2021 21:28:41 +0100 Subject: [PATCH 079/141] print version strings if available --- CMakeLists.txt | 10 +++------- cmake/MapnikFindPackage.cmake | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0264c2b56..881c90421 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,11 +96,14 @@ message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") + +# Begin project configuration mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) if(USE_BOOST_REGEX_ICU_WORKAROUND) set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES) endif() + mapnik_find_package(Freetype REQUIRED) mapnik_find_package(harfbuzz CONFIG REQUIRED) @@ -166,41 +169,35 @@ set(MAPNIK_OPTIONAL_LIBS "") set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") if(USE_LIBXML2) - message(STATUS "Using LibXml2") mapnik_find_package(LibXml2 REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) list(APPEND MAPNIK_OPTIONAL_LIBS LibXml2::LibXml2) endif() if(USE_PNG) - message(STATUS "Using PNG") mapnik_find_package(PNG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_PNG) list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() if(USE_JPEG) - message(STATUS "Using JPEG") mapnik_find_package(JPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) list(APPEND MAPNIK_OPTIONAL_LIBS JPEG::JPEG) endif() if(USE_TIFF) - message(STATUS "Using TIFF") mapnik_find_package(TIFF REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_TIFF) list(APPEND MAPNIK_OPTIONAL_LIBS TIFF::TIFF) endif() if(USE_WEBP) - message(STATUS "Using WEBP") mapnik_find_package(WebP CONFIG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP) list(APPEND MAPNIK_OPTIONAL_LIBS WebP::webp) endif() if(USE_CAIRO) - message(STATUS "Using Cairo renderer") mapnik_find_package(Cairo REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO) list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo) @@ -209,7 +206,6 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html mapnik_find_package(PROJ REQUIRED) - message(STATUS "Using PROJ version: ${PROJ_VERSION}") math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) diff --git a/cmake/MapnikFindPackage.cmake b/cmake/MapnikFindPackage.cmake index d4e6c5acd..14c33805e 100644 --- a/cmake/MapnikFindPackage.cmake +++ b/cmake/MapnikFindPackage.cmake @@ -1,6 +1,23 @@ +macro(mapnik_print_version) + string(TOUPPER ${ARGV0} TLNUP) + set(TLN ${ARGV0}) + if(${TLN}_VERSION_STRING) + message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION_STRING}") + elseif(${TLN}_VERSION) + message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION}") + elseif(${TLNUP}_VERSION_STRING) + message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION_STRING}") + elseif(${TLNUP}_VERSION) + message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION}") + else() + message(STATUS "Using ${ARGV0}") + endif() +endmacro() + macro(mapnik_find_package) find_package(${ARGN}) set(MAPNIK_TMP_DEP ${ARGN}) list(JOIN MAPNIK_TMP_DEP " " MAPNIK_TMP_DEP) list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})") + mapnik_print_version(${ARGV0}) endmacro() From 7897bb5c83e0394325fcd438f6bb9d7c149d7c5e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 26 Mar 2021 15:45:15 +0100 Subject: [PATCH 080/141] add threads to mapnik::core --- CMakeLists.txt | 3 +++ cmake/MapnikFindPackage.cmake | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 881c90421..de4ff528d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") # Begin project configuration +mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) if(USE_BOOST_REGEX_ICU_WORKAROUND) @@ -207,6 +208,7 @@ if(USE_PROJ) #https://proj.org/development/cmake.html mapnik_find_package(PROJ REQUIRED) math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) @@ -242,6 +244,7 @@ target_include_directories(core INTERFACE ${MAPNIK_OPTIONAL_LIBS_INCLUDE} ) target_link_libraries(core INTERFACE + Threads::Threads ICU::uc ICU::data ICU::i18n diff --git a/cmake/MapnikFindPackage.cmake b/cmake/MapnikFindPackage.cmake index 14c33805e..a4a10ba7d 100644 --- a/cmake/MapnikFindPackage.cmake +++ b/cmake/MapnikFindPackage.cmake @@ -21,3 +21,18 @@ macro(mapnik_find_package) list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})") mapnik_print_version(${ARGV0}) endmacro() + +macro(mapnik_find_threads) + find_package(Threads REQUIRED) + if(CMAKE_THREAD_LIBS_INIT) + message(STATUS "Using Threads (system libraries)") + elseif(CMAKE_USE_WIN32_THREADS_INIT) + message(STATUS "Using Threads (win32 threads)") + elseif(CMAKE_USE_PTHREADS_INIT) + message(STATUS "Using Threads (pthread)") + elseif(CMAKE_HP_PTHREADS_INIT) + message(STATUS "Using Threads (HP thread)") + else() + message(STATUS "Using Threads (unknown backend)") + endif() +endmacro() From d2066da339a9732223fa3e00c636c4c7cd6ca2e3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 31 Mar 2021 20:25:46 +0200 Subject: [PATCH 081/141] hopefully fix unstatisfied proj_transform_cache --- src/cairo_io.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cairo_io.cpp b/src/cairo_io.cpp index 7d524e61f..13f4689e2 100644 --- a/src/cairo_io.cpp +++ b/src/cairo_io.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef HAVE_CAIRO #include From 7121bd6fbfff847d4677476d7f920f71863ece00 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 1 Apr 2021 15:55:57 +0200 Subject: [PATCH 082/141] Revert "hopefully fix unstatisfied proj_transform_cache" This reverts commit d2066da339a9732223fa3e00c636c4c7cd6ca2e3. --- src/cairo_io.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cairo_io.cpp b/src/cairo_io.cpp index 13f4689e2..7d524e61f 100644 --- a/src/cairo_io.cpp +++ b/src/cairo_io.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #ifdef HAVE_CAIRO #include From b1e1ea66f5b27b0c1f1d53f976dc2f0bc5e8f71f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 1 Apr 2021 16:03:58 +0200 Subject: [PATCH 083/141] try fix linux take II --- include/mapnik/map.hpp | 2 +- src/map.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/mapnik/map.hpp b/include/mapnik/map.hpp index 7b0c155c5..8cb81f5db 100644 --- a/include/mapnik/map.hpp +++ b/include/mapnik/map.hpp @@ -103,7 +103,7 @@ private: boost::optional font_directory_; freetype_engine::font_file_mapping_type font_file_mapping_; freetype_engine::font_memory_cache_type font_memory_cache_; - std::unique_ptr proj_cache_ = {}; + std::unique_ptr proj_cache_; public: using const_style_iterator = std::map::const_iterator; using style_iterator = std::map::iterator; diff --git a/src/map.cpp b/src/map.cpp index 8d20225ca..bc7d4d2c4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -76,7 +76,8 @@ Map::Map() extra_params_(), font_directory_(), font_file_mapping_(), - font_memory_cache_() {} + font_memory_cache_(), + proj_cache_(std::make_unique()) {} Map::Map(int width,int height, std::string const& srs) : width_(width), @@ -90,7 +91,8 @@ Map::Map(int width,int height, std::string const& srs) extra_params_(), font_directory_(), font_file_mapping_(), - font_memory_cache_() {} + font_memory_cache_(), + proj_cache_(std::make_unique()) {} Map::Map(Map const& rhs) : width_(rhs.width_), @@ -112,7 +114,8 @@ Map::Map(Map const& rhs) font_directory_(rhs.font_directory_), font_file_mapping_(rhs.font_file_mapping_), // on copy discard memory caches - font_memory_cache_() + font_memory_cache_(), + proj_cache_(std::make_unique()) { init_proj_transforms(); } From f57d39378de636943b8da9fa4c5035d15e473d7a Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 1 Apr 2021 16:15:32 +0200 Subject: [PATCH 084/141] add BIGINT and MAPNIK_MEMORY_MAPPED_FILE; require cxx standard, disable compiler specific flags (CXX_EXTENSIONS) --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index de4ff528d..bb00aaae9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,8 @@ option(USE_CAIRO "adds the cairo renderer" ON) option(USE_PROJ "adds proj support" ON) option(USE_GRID_RENDERER "adds grid renderer" ON) option(USE_SVG_RENDERER "adds grid renderer" ON) +option(USE_BIGINT "uses 64 bit instead of 32" ON) +option(USE_MEMORY_MAPPED_FILE "uses file cache" ON) option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) @@ -65,6 +67,11 @@ option(USE_BOOST_REGEX_ICU_WORKAROUND "if you don't use your system libraries an set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++14 is minimum.") message(STATUS "Using c++${CMAKE_CXX_STANDARD}") +# https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html +set(CXX_EXTENSIONS OFF CACHE STRING "Enables the compiler specific extensions.") # Fallsback to -std=c++ if off +message(STATUS "Using c++ extensions: ${CXX_EXTENSIONS}") +# https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD_REQUIRED.html#prop_tgt:CXX_STANDARD_REQUIRED +set(CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD if(WIN32) set(DEFAULT_BIN_DIR bin) @@ -169,6 +176,15 @@ set(MAPNIK_COMPILE_DEFS "") set(MAPNIK_OPTIONAL_LIBS "") set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") +if(USE_BIGINT) + message(STATUS "uses BIGINT") + list(APPEND MAPNIK_COMPILE_DEFS BIGINT) +endif() +if(USE_MEMORY_MAPPED_FILE) + message(STATUS "uses MAPNIK_MEMORY_MAPPED_FILE") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE) +endif() + if(USE_LIBXML2) mapnik_find_package(LibXml2 REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) From bed3ffb3dcb0e3dbf7ff03b0970d87f858d3d1c3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 1 Apr 2021 18:01:43 +0200 Subject: [PATCH 085/141] fix typo grid renderer -> svg renderer --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb00aaae9..25ac6309f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ option(USE_LIBXML2 "adds libxml2 support" ON) option(USE_CAIRO "adds the cairo renderer" ON) option(USE_PROJ "adds proj support" ON) option(USE_GRID_RENDERER "adds grid renderer" ON) -option(USE_SVG_RENDERER "adds grid renderer" ON) +option(USE_SVG_RENDERER "adds svg renderer" ON) option(USE_BIGINT "uses 64 bit instead of 32" ON) option(USE_MEMORY_MAPPED_FILE "uses file cache" ON) From 02f78e4ce50bc8b066771de13db9dd2906beb7dc Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 9 Apr 2021 15:50:50 +0200 Subject: [PATCH 086/141] fixed Dll copying on windows; copy plugins and fonts into appropiate directories when building. --- CMakeLists.txt | 3 +- benchmark/CMakeLists.txt | 28 +++++++++------ cmake/CopyDllsForDebug.cmake | 14 +++++--- cmake/MapnikCopyDependencies.cmake | 58 ++++++++++++++++++++++++++++++ demo/c++/CMakeLists.txt | 8 ++--- demo/viewer/CMakeLists.txt | 12 +++---- test/CMakeLists.txt | 22 ++++++++---- 7 files changed, 113 insertions(+), 32 deletions(-) create mode 100644 cmake/MapnikCopyDependencies.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 25ac6309f..a01e05b49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,9 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(MapnikFindPackage) +include(MapnikCopyDependencies) -set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully" "") +set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (currently only windows) to the executable directory" ON) option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 825fc95ea..7e409fb17 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -26,18 +26,26 @@ set(BENCHMARK_SRCS src/test_to_string2.cpp src/test_utf_encoding.cpp ) -macro(mapnik_create_benchmark) +function(mapnik_create_benchmark) get_filename_component(BENCHNAME ${ARGV0} NAME_WE) - add_executable(mapnik-benchmark-${BENCHNAME} ${ARGV0}) - target_include_directories(mapnik-benchmark-${BENCHNAME} PRIVATE include) - target_link_libraries(mapnik-benchmark-${BENCHNAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik) + set(TARGET_NAME "mapnik-benchmark-${BENCHNAME}") + add_executable(${TARGET_NAME} ${ARGV0}) + target_include_directories(${TARGET_NAME} PRIVATE include) + target_link_libraries(${TARGET_NAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik) + + # it might be possible that some buildsystems generate different directories. So invoke the scripts for all benchmarks + mapnik_copy_plugins(TARGET ${TARGET_NAME} + DESTINATION plugins/input + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson + ) + mapnik_require_fonts(TARGET ${TARGET_NAME} mapnik-test-unit DESTINATION fonts) - if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) - include(CopyDllsForDebug) - add_custom_command(TARGET mapnik-benchmark-${BENCHNAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) - copy_dlls_for_debug(mapnik-benchmark-${BENCHNAME} \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") - endif() -endmacro() + mapnik_copy_dependencies(TARGETS ${TARGET_NAME} + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson + ) +endfunction() foreach(benchmark ${BENCHMARK_SRCS}) mapnik_create_benchmark(${benchmark}) diff --git a/cmake/CopyDllsForDebug.cmake b/cmake/CopyDllsForDebug.cmake index 7f668868a..3c0e118a6 100644 --- a/cmake/CopyDllsForDebug.cmake +++ b/cmake/CopyDllsForDebug.cmake @@ -11,19 +11,25 @@ if(RUN_IT) # Script ran by the add_custom_command include(BundleUtilities) include(InstallRequiredSystemLibraries) + string (REPLACE " " ";" TO_FIXUP_LIBS "${TO_FIXUP_LIBS}") + string (REPLACE " " ";" TO_FIXUP_DIRS "${TO_FIXUP_DIRS}") + #message(STATUS "${TO_FIXUP_FILE} ${TO_FIXUP_LIBS} ${TO_FIXUP_DIRS}") fixup_bundle("${TO_FIXUP_FILE}" "${TO_FIXUP_LIBS}" "${TO_FIXUP_DIRS}") # End of script ran by the add_custom_command else() set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE}) -function(copy_dlls_for_debug _targets _libs _dirs) +function(copy_dlls_for_debug) + set(options) + set(oneValueArgs) + set(multiValueArgs TARGETS LIBS DIRS) + cmake_parse_arguments(MAPNIK_COPY_DLLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(WIN32) - foreach(_target ${_targets}) + foreach(_target IN LISTS MAPNIK_COPY_DLLS_TARGETS) add_custom_command( TARGET ${_target} POST_BUILD - COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$ -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs} -P ${THIS_FILE} + COMMAND ${CMAKE_COMMAND} ARGS -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE="$" -DTO_FIXUP_LIBS:STRING="${MAPNIK_COPY_DLLS_LIBS}" -DTO_FIXUP_DIRS="${MAPNIK_COPY_DLLS_DIRS}" -P "${THIS_FILE}" COMMENT "Fixing up dependencies for ${_target}" - VERBATIM ) endforeach() endif(WIN32) diff --git a/cmake/MapnikCopyDependencies.cmake b/cmake/MapnikCopyDependencies.cmake new file mode 100644 index 000000000..11736c7e4 --- /dev/null +++ b/cmake/MapnikCopyDependencies.cmake @@ -0,0 +1,58 @@ +function(mapnik_find_target_location) + set(options) + set(multiValueArgs TARGETS) + cmake_parse_arguments( WIG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + +endfunction() + +function(mapnik_copy_dependencies) + if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) + set(options) + set(oneValueArgs) + set(multiValueArgs TARGETS PLUGINS) + cmake_parse_arguments(MAPNIK_CP_DEPS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + include(CopyDllsForDebug) + foreach(TARGET IN LISTS MAPNIK_CP_DEPS_TARGETS) + add_custom_command(TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) + endforeach() + + set(LIBS "") + foreach(PLUGIN IN LISTS MAPNIK_CP_DEPS_PLUGINS) + if(TARGET ${PLUGIN}) # only copy plugins that are be build + list(APPEND LIBS "$") + endif() + endforeach() + copy_dlls_for_debug(TARGETS ${MAPNIK_CP_DEPS_TARGETS} LIBS ${LIBS} DIRS ${ADDITIONAL_LIBARIES_PATHS}) + endif() +endfunction() + +function(mapnik_copy_plugins) + set(options) + set(oneValueArgs TARGET DESTINATION) + set(multiValueArgs PLUGINS) + cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + # copy_if_different requires a existing directory. + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}) + foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS) + #message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}") + if(TARGET ${PLUGIN}) + add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND + ${CMAKE_COMMAND} -E copy_if_different "$" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/) + else() + message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.") + endif() + endforeach() + +endfunction() + +function(mapnik_require_fonts) + set(options) + set(oneValueArgs TARGET DESTINATION) + set(multiValueArgs) + cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND + ${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/) +endfunction() diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index bdb517ec0..00bd7cf0f 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -10,8 +10,6 @@ install(TARGETS mapnik-demo RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) -if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) - include(CopyDllsForDebug) - add_custom_command(TARGET mapnik-demo POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) - copy_dlls_for_debug(mapnik-demo \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") -endif() +mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape) +mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts) +mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 5d71d1c40..9d0aadbad 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -45,9 +45,9 @@ install(TARGETS mapnik-viewer RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) - -if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) - include(CopyDllsForDebug) - add_custom_command(TARGET mapnik-viewer POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) - copy_dlls_for_debug(mapnik-viewer \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") -endif() +mapnik_copy_dependencies( + TARGETS + mapnik-viewer + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f2feb2bc7..f29c53cc4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -173,12 +173,22 @@ include(CTest) include(${catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${catch2_SOURCE_DIR}/contrib/ParseAndAddCatchTests.cmake) -if(COPY_LIBRARIES_FOR_EXECUTABLES AND WIN32) - include(CopyDllsForDebug) - add_custom_command(TARGET mapnik-test-unit POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$" ${CMAKE_CURRENT_BINARY_DIR}) - set(APPS mapnik-test-unit agg_rasterizer_integer_overflow_test datasource_registration_test font_registration_test map_xml_test mapnik-test-visual) - copy_dlls_for_debug(${APPS} \"\" \"${ADDITIONAL_LIBARIES_PATHS}\") -endif() +# use only mapnik-test-unit since it has the same build path +mapnik_copy_plugins( + TARGET mapnik-test-unit + DESTINATION plugins/input + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson +) +mapnik_require_fonts(TARGET mapnik-test-unit DESTINATION fonts) + +mapnik_copy_dependencies( + TARGETS + mapnik-test-unit agg_rasterizer_integer_overflow_test datasource_registration_test font_registration_test map_xml_test mapnik-test-visual + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson +) + file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) file(COPY data-visual DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) From 1929fbc0ba0fe27c079876c1f07f17b6e1af2d2d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 9 Apr 2021 15:53:21 +0200 Subject: [PATCH 087/141] add an option to disable plugin and font copying --- CMakeLists.txt | 5 ++-- cmake/MapnikCopyDependencies.cmake | 47 ++++++++++++++++-------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a01e05b49..3e6bda855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(MapnikFindPackage) include(MapnikCopyDependencies) -set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "currently only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") -option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (currently only windows) to the executable directory" ON) +set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") +option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" ON) +option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON) option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) option(BUILD_TEST "builds the tests" ON) diff --git a/cmake/MapnikCopyDependencies.cmake b/cmake/MapnikCopyDependencies.cmake index 11736c7e4..4d14174a7 100644 --- a/cmake/MapnikCopyDependencies.cmake +++ b/cmake/MapnikCopyDependencies.cmake @@ -28,31 +28,34 @@ function(mapnik_copy_dependencies) endfunction() function(mapnik_copy_plugins) - set(options) - set(oneValueArgs TARGET DESTINATION) - set(multiValueArgs PLUGINS) - cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - # copy_if_different requires a existing directory. - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}) - foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS) - #message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}") - if(TARGET ${PLUGIN}) - add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND - ${CMAKE_COMMAND} -E copy_if_different "$" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/) - else() - message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.") - endif() - endforeach() + if(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES) + set(options) + set(oneValueArgs TARGET DESTINATION) + set(multiValueArgs PLUGINS) + cmake_parse_arguments(MAPNIK_CP_PLG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + # copy_if_different requires a existing directory. + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}) + foreach(PLUGIN IN LISTS MAPNIK_CP_PLG_PLUGINS) + #message(STATUS "copying plugin ${PLUGIN} to path: ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}") + if(TARGET ${PLUGIN}) + add_custom_command(TARGET ${MAPNIK_CP_PLG_TARGET} POST_BUILD COMMAND + ${CMAKE_COMMAND} -E copy_if_different "$" ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_CP_PLG_DESTINATION}/) + else() + message(NOTICE "${MAPNIK_CP_PLG_TARGET} requires plugin ${PLUGIN} but it isn't build. Check USE_PLUGIN_INPUT_ options to enable the plugin.") + endif() + endforeach() + endif() endfunction() function(mapnik_require_fonts) - set(options) - set(oneValueArgs TARGET DESTINATION) - set(multiValueArgs) - cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + if(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES) + set(options) + set(oneValueArgs TARGET DESTINATION) + set(multiValueArgs) + cmake_parse_arguments(MAPNIK_REQUIRE_FONTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND - ${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/) + add_custom_command(TARGET ${MAPNIK_REQUIRE_FONTS_TARGET} POST_BUILD COMMAND + ${CMAKE_COMMAND} -E copy_directory ${mapnik_SOURCE_DIR}/fonts ${CMAKE_CURRENT_BINARY_DIR}/${MAPNIK_REQUIRE_FONTS_DESTINATION}/) + endif() endfunction() From e1fa32f21fca744e43dac91167b19a01fa0d0e94 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 10 Apr 2021 14:36:22 +0200 Subject: [PATCH 088/141] install dependencies. Required for windows (and ?macos?). Needs testing on linux. --- CMakeLists.txt | 7 +++ benchmark/CMakeLists.txt | 27 ++++++------ cmake/MapnikInstall.cmake | 61 +++++++++++++++++++++++++++ demo/c++/CMakeLists.txt | 7 +-- demo/viewer/CMakeLists.txt | 6 +-- plugins/input/csv/CMakeLists.txt | 2 + plugins/input/gdal/CMakeLists.txt | 4 +- plugins/input/geobuf/CMakeLists.txt | 4 +- plugins/input/geojson/CMakeLists.txt | 4 +- plugins/input/ogr/CMakeLists.txt | 4 +- plugins/input/pgraster/CMakeLists.txt | 4 +- plugins/input/postgis/CMakeLists.txt | 4 +- plugins/input/raster/CMakeLists.txt | 4 +- plugins/input/shape/CMakeLists.txt | 4 +- plugins/input/sqlite/CMakeLists.txt | 4 +- plugins/input/topojson/CMakeLists.txt | 4 +- src/CMakeLists.txt | 2 + src/json/CMakeLists.txt | 7 +-- src/wkt/CMakeLists.txt | 7 +-- utils/geometry_to_wkb/CMakeLists.txt | 7 +-- utils/mapnik-index/CMakeLists.txt | 8 +--- utils/mapnik-render/CMakeLists.txt | 8 +--- utils/ogrindex/CMakeLists.txt | 2 + utils/pgsql2sqlite/CMakeLists.txt | 7 +-- utils/shapeindex/CMakeLists.txt | 8 +--- utils/svg2png/CMakeLists.txt | 8 +--- 26 files changed, 113 insertions(+), 101 deletions(-) create mode 100644 cmake/MapnikInstall.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e6bda855..9cef60113 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,10 +17,12 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(MapnikFindPackage) include(MapnikCopyDependencies) +include(MapnikInstall) set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" ON) option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON) +option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON) option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) option(BUILD_TEST "builds the tests" ON) @@ -177,6 +179,9 @@ endif() set(MAPNIK_COMPILE_DEFS "") set(MAPNIK_OPTIONAL_LIBS "") set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") +# (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope +set_property(GLOBAL PROPERTY TARGETS "") +set_property(GLOBAL PROPERTY PLUGINS "") if(USE_BIGINT) message(STATUS "uses BIGINT") @@ -331,3 +336,5 @@ install(EXPORT MapnikTargets install(DIRECTORY include/ TYPE INCLUDE) install(DIRECTORY deps/agg/include/ TYPE INCLUDE) install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") + +mapnik_install_targets() diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index 7e409fb17..d67b4411f 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -32,21 +32,24 @@ function(mapnik_create_benchmark) add_executable(${TARGET_NAME} ${ARGV0}) target_include_directories(${TARGET_NAME} PRIVATE include) target_link_libraries(${TARGET_NAME} PRIVATE mapnik::core mapnik::agg mapnik::mapnik) - - # it might be possible that some buildsystems generate different directories. So invoke the scripts for all benchmarks - mapnik_copy_plugins(TARGET ${TARGET_NAME} - DESTINATION plugins/input - PLUGINS - input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson - ) - mapnik_require_fonts(TARGET ${TARGET_NAME} mapnik-test-unit DESTINATION fonts) - mapnik_copy_dependencies(TARGETS ${TARGET_NAME} - PLUGINS - input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson - ) + mapnik_copy_dependencies(TARGETS ${TARGET_NAME}) endfunction() foreach(benchmark ${BENCHMARK_SRCS}) mapnik_create_benchmark(${benchmark}) endforeach() + +# we just need one target to reference the directory correctly. mapnik-benchmark-normalize_angle is just the first in BENCHMARK_SRCS +mapnik_require_fonts(TARGET mapnik-benchmark-normalize_angle DESTINATION fonts) +# copy all plugins +mapnik_copy_plugins(TARGET mapnik-benchmark-normalize_angle + DESTINATION plugins/input + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson +) +# copy all plugin dlls. +mapnik_copy_dependencies(TARGETS mapnik-benchmark-normalize_angle + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson +) diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake new file mode 100644 index 000000000..38b6c687d --- /dev/null +++ b/cmake/MapnikInstall.cmake @@ -0,0 +1,61 @@ +function(mapnik_install) + set(options ALREADY_INSTALLED IS_PLUGIN) + set(oneValueArgs TARGET) + set(multiValueArgs) + cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND NOT ${MAPNIK_INSTALL_IS_PLUGIN}) + install(TARGETS ${MAPNIK_INSTALL_TARGET} + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} + ) + elseif(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND ${MAPNIK_INSTALL_IS_PLUGIN}) + install(TARGETS ${MAPNIK_INSTALL_TARGET} + RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} + ) + endif() + if(NOT ${MAPNIK_INSTALL_IS_PLUGIN}) + message(STATUS "${MAPNIK_INSTALL_TARGET}") + get_target_property(TARGET_TYPE "${MAPNIK_INSTALL_TARGET}" TYPE) + if (TARGET_TYPE STREQUAL "EXECUTABLE") + get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS) + list(APPEND MAPNIK_INSTALLED_TARGETS ${MAPNIK_INSTALL_TARGET}) + set_property(GLOBAL PROPERTY TARGETS ${MAPNIK_INSTALLED_TARGETS}) + endif() + else() + get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS) + list(APPEND MAPNIK_INSTALLED_PLUGINS ${MAPNIK_INSTALL_TARGET}) + set_property(GLOBAL PROPERTY PLUGINS ${MAPNIK_INSTALLED_PLUGINS}) + endif() +endfunction() + + +function(mapnik_install_targets) + if(INSTALL_DEPENDENCIES) + # https://cmake.org/cmake/help/latest/policy/CMP0087.html + cmake_policy(SET CMP0087 NEW) + get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS) + get_property(MAPNIK_INSTALLED_PLUGINS GLOBAL PROPERTY PLUGINS) + set(INTERNAL_TARGETS "") + set(INTERNAL_PLUGINS "") + + foreach(_target IN LISTS MAPNIK_INSTALLED_TARGETS) + list(APPEND INTERNAL_TARGETS "${CMAKE_INSTALL_PREFIX}/${MAPNIK_BIN_DIR}/$") + endforeach() + foreach(_target IN LISTS MAPNIK_INSTALLED_PLUGINS) + list(APPEND INTERNAL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${PLUGINS_INSTALL_DIR}/$") + endforeach() + # all other executables get auto detected and fixed. + list(GET INTERNAL_TARGETS 0 INTERNAL_TARGETS) + + INSTALL(CODE " + message(STATUS \"${INTERNAL_TARGETS}\") + message(STATUS \"${INTERNAL_PLUGINS}\") + + include(BundleUtilities) + fixup_bundle(\"${INTERNAL_TARGETS}\" \"${INTERNAL_PLUGINS}\" \"${ADDITIONAL_LIBARIES_PATHS}\") + " COMPONENT Runtime) + endif() + +endfunction() diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 00bd7cf0f..7b86d37f2 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -4,12 +4,7 @@ add_executable(mapnik-demo rundemo.cpp) target_link_libraries(mapnik-demo PRIVATE mapnik::core mapnik::agg mapnik::mapnik) -install(TARGETS mapnik-demo - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) - +mapnik_install(TARGET mapnik-demo) mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape) mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts) mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 9d0aadbad..01fab3db8 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -39,11 +39,7 @@ plugins_dir=${PLUGINS_INSTALL_DIR} fonts/1/dir=${FONTS_INSTALL_DIR}" ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) -install(TARGETS mapnik-viewer - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) +mapnik_install(TARGET mapnik-viewer) mapnik_copy_dependencies( TARGETS diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 677ac2538..3d251a5ea 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -23,3 +23,5 @@ set_target_properties(input-csv PROPERTIES SUFFIX ".input") install(TARGETS input-csv RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) + +mapnik_install(TARGET input-csv IS_PLUGIN) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 4b35fb814..92b305766 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -18,6 +18,4 @@ set_target_properties(input-gdal PROPERTIES PREFIX "") set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") set_target_properties(input-gdal PROPERTIES SUFFIX ".input") -install(TARGETS input-gdal - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-gdal IS_PLUGIN) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 73d39e14a..bb5fef85e 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -14,6 +14,4 @@ set_target_properties(input-geobuf PROPERTIES PREFIX "") set_target_properties(input-geobuf PROPERTIES OUTPUT_NAME "geobuf") set_target_properties(input-geobuf PROPERTIES SUFFIX ".input") -install(TARGETS input-geobuf - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-geobuf IS_PLUGIN) diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 09da0e935..39b392fe5 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -18,6 +18,4 @@ set_target_properties(input-geojson PROPERTIES PREFIX "") set_target_properties(input-geojson PROPERTIES OUTPUT_NAME "geojson") set_target_properties(input-geojson PROPERTIES SUFFIX ".input") -install(TARGETS input-geojson - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-geojson IS_PLUGIN) diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 3656e3a79..0791c093b 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -20,6 +20,4 @@ set_target_properties(input-ogr PROPERTIES PREFIX "") set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") set_target_properties(input-ogr PROPERTIES SUFFIX ".input") -install(TARGETS input-ogr - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-ogr IS_PLUGIN) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index fe6622cf0..146036044 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -19,6 +19,4 @@ set_target_properties(input-pgraster PROPERTIES PREFIX "") set_target_properties(input-pgraster PROPERTIES OUTPUT_NAME "pgraster") set_target_properties(input-pgraster PROPERTIES SUFFIX ".input") -install(TARGETS input-pgraster - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-pgraster IS_PLUGIN) diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 73113f282..0102bac63 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -18,6 +18,4 @@ set_target_properties(input-postgis PROPERTIES PREFIX "") set_target_properties(input-postgis PROPERTIES OUTPUT_NAME "postgis") set_target_properties(input-postgis PROPERTIES SUFFIX ".input") -install(TARGETS input-postgis - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-postgis IS_PLUGIN) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 548a361a2..9956b6d9b 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -16,6 +16,4 @@ set_target_properties(input-raster PROPERTIES PREFIX "") set_target_properties(input-raster PROPERTIES OUTPUT_NAME "raster") set_target_properties(input-raster PROPERTIES SUFFIX ".input") -install(TARGETS input-raster - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-raster IS_PLUGIN) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index ed3a1f365..c0a42b460 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -19,6 +19,4 @@ set_target_properties(input-shape PROPERTIES PREFIX "") set_target_properties(input-shape PROPERTIES OUTPUT_NAME "shape") set_target_properties(input-shape PROPERTIES SUFFIX ".input") -install(TARGETS input-shape - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-shape IS_PLUGIN) diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 7be226609..4d1317aa5 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -18,6 +18,4 @@ set_target_properties(input-sqlite PROPERTIES PREFIX "") set_target_properties(input-sqlite PROPERTIES OUTPUT_NAME "sqlite") set_target_properties(input-sqlite PROPERTIES SUFFIX ".input") -install(TARGETS input-sqlite - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-sqlite IS_PLUGIN) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index baefe69ee..32cfb1bd1 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -16,6 +16,4 @@ set_target_properties(input-topojson PROPERTIES PREFIX "") set_target_properties(input-topojson PROPERTIES OUTPUT_NAME "topojson") set_target_properties(input-topojson PROPERTIES SUFFIX ".input") -install(TARGETS input-topojson - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) +mapnik_install(TARGET input-topojson IS_PLUGIN) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a17e9d6b0..b0a84ae5f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -303,3 +303,5 @@ install(TARGETS mapnik INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ ) + +mapnik_install(TARGET mapnik ALREADY_INSTALLED) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 183b7c745..e3682d31e 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -26,9 +26,4 @@ target_include_directories(json PRIVATE ) target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) -install(TARGETS json - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) +mapnik_install(TARGET json) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 35168f669..161fd87d4 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -18,9 +18,4 @@ target_include_directories(wkt PRIVATE ) target_link_libraries(wkt PRIVATE mapnik::core) -install(TARGETS wkt - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) +mapnik_install(TARGET wkt) diff --git a/utils/geometry_to_wkb/CMakeLists.txt b/utils/geometry_to_wkb/CMakeLists.txt index 17d8e23cb..8aca170fe 100644 --- a/utils/geometry_to_wkb/CMakeLists.txt +++ b/utils/geometry_to_wkb/CMakeLists.txt @@ -7,9 +7,4 @@ target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik ) -install(TARGETS geometry_to_wkb - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) +mapnik_install(TARGET geometry_to_wkb) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index 70123b379..7a600a8b2 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -15,9 +15,5 @@ target_link_libraries(mapnik-index PRIVATE mapnik::wkt Boost::program_options ) -install(TARGETS mapnik-index - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) + +mapnik_install(TARGET mapnik-index) diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 0dbc73f2a..08c689797 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -9,9 +9,5 @@ target_link_libraries(mapnik-render PRIVATE mapnik::mapnik Boost::program_options ) -install(TARGETS mapnik-render - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) + +mapnik_install(TARGET mapnik-render) diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index ad9c12e41..afc13541b 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -11,3 +11,5 @@ install(TARGETS ogrindex ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) + +mapnik_install(TARGET mapnik-ogrindex) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index d57046bee..8ff6eb1f2 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -17,9 +17,4 @@ target_link_libraries(pgsql2sqlite PRIVATE mapnik::mapnik ) -install(TARGETS pgsql2sqlite - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) +mapnik_install(TARGET pgsql2sqlite) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 79a9f24ff..55621cdd5 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -12,9 +12,5 @@ target_link_libraries(shapeindex PRIVATE mapnik::core mapnik::mapnik ) -install(TARGETS shapeindex - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) + +mapnik_install(TARGET shapeindex) diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index 6f1a52eab..55572f393 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -12,9 +12,5 @@ target_link_libraries(svg2png PRIVATE mapnik::mapnik mapnik::agg ) -install(TARGETS svg2png - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) + +mapnik_install(TARGET svg2png) From 5a109a99fb4996d83a0b14c138e1b059812ab7c5 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Apr 2021 19:41:21 +0200 Subject: [PATCH 089/141] install dependencies only on windows and install plugins into correct dir --- cmake/MapnikInstall.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake index 38b6c687d..6f0cfd553 100644 --- a/cmake/MapnikInstall.cmake +++ b/cmake/MapnikInstall.cmake @@ -12,6 +12,8 @@ function(mapnik_install) ) elseif(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND ${MAPNIK_INSTALL_IS_PLUGIN}) install(TARGETS ${MAPNIK_INSTALL_TARGET} + LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR} + ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR} RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) endif() @@ -32,7 +34,7 @@ endfunction() function(mapnik_install_targets) - if(INSTALL_DEPENDENCIES) + if(INSTALL_DEPENDENCIES AND WIN32) # https://cmake.org/cmake/help/latest/policy/CMP0087.html cmake_policy(SET CMP0087 NEW) get_property(MAPNIK_INSTALLED_TARGETS GLOBAL PROPERTY TARGETS) From d17abeddb7e6cfa7eb2584b4d6892a4140e6dbff Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 30 Jun 2021 10:33:20 +0200 Subject: [PATCH 090/141] [cmake] add folders for visual studio --- .gitignore | 1 + CMakeLists.txt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 922bdcf21..bf3bf93e0 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ test/unit/run test/visual/run # cmake build +.vs diff --git a/CMakeLists.txt b/CMakeLists.txt index 9cef60113..981eb75de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,11 @@ project(mapnik DESCRIPTION "Mapnik is an open source toolkit for developing mapping applications" LANGUAGES CXX ) - message(STATUS "mapnik version: ${PROJECT_VERSION}") +# https://cliutils.gitlab.io/modern-cmake/chapters/features/ides.html +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(MapnikFindPackage) include(MapnikCopyDependencies) From cdf41a31444fd2ffcc19c354e17d6c4b899b3f0d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 2 Jul 2021 13:55:55 +0200 Subject: [PATCH 091/141] install sparsehash --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 981eb75de..f65ca5399 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,6 +337,7 @@ install(EXPORT MapnikTargets install(DIRECTORY include/ TYPE INCLUDE) install(DIRECTORY deps/agg/include/ TYPE INCLUDE) +install(DIRECTORY deps/mapnik TYPE INCLUDE) install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") mapnik_install_targets() From d61067132724a4aa33881da9f0fc4cd7546cb5e2 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 2 Jul 2021 16:02:30 +0200 Subject: [PATCH 092/141] try install json and wkt again --- src/json/CMakeLists.txt | 9 +++++++++ src/wkt/CMakeLists.txt | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index e3682d31e..899293562 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -26,4 +26,13 @@ target_include_directories(json PRIVATE ) target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) +install(TARGETS json + EXPORT MapnikTargets + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} + INCLUDES DESTINATION include/ + PUBLIC_HEADER DESTINATION include/ +) + mapnik_install(TARGET json) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 161fd87d4..5f3e9d485 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -18,4 +18,13 @@ target_include_directories(wkt PRIVATE ) target_link_libraries(wkt PRIVATE mapnik::core) +install(TARGETS wkt + EXPORT MapnikTargets + LIBRARY DESTINATION ${MAPNIK_LIB_DIR} + ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} + RUNTIME DESTINATION ${MAPNIK_BIN_DIR} + INCLUDES DESTINATION include/ + PUBLIC_HEADER DESTINATION include/ +) + mapnik_install(TARGET wkt) From 7f2511632faa81c7d93373fa5a858c066fd193f8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 2 Jul 2021 22:26:36 +0200 Subject: [PATCH 093/141] add packaging --- CMakeLists.txt | 12 ++++++++---- cmake/pack.cmake | 14 ++++++++++++++ src/CMakeLists.txt | 1 + src/json/CMakeLists.txt | 1 + src/wkt/CMakeLists.txt | 1 + 5 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 cmake/pack.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f65ca5399..b5b6ffca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,12 +231,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ4 REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) @@ -289,6 +289,7 @@ install(TARGETS core RUNTIME DESTINATION ${MAPNIK_BIN_DIR} INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ + COMPONENT mapnik ) add_subdirectory(deps) @@ -341,3 +342,6 @@ install(DIRECTORY deps/mapnik TYPE INCLUDE) install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") mapnik_install_targets() + + +include(pack) diff --git a/cmake/pack.cmake b/cmake/pack.cmake new file mode 100644 index 000000000..eb27bda41 --- /dev/null +++ b/cmake/pack.cmake @@ -0,0 +1,14 @@ +include(InstallRequiredSystemLibraries) +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES + \\.git/ + build/ + ".*~$" + out/ + \\.vs/ + \\.vscode/ +) +set(CPACK_VERBATIM_VARIABLES YES) + +include(CPack) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0a84ae5f..efb1f9b08 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -302,6 +302,7 @@ install(TARGETS mapnik RUNTIME DESTINATION ${MAPNIK_BIN_DIR} INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ + COMPONENT mapnik ) mapnik_install(TARGET mapnik ALREADY_INSTALLED) diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 899293562..fa5c148f1 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -33,6 +33,7 @@ install(TARGETS json RUNTIME DESTINATION ${MAPNIK_BIN_DIR} INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ + COMPONENT mapnik ) mapnik_install(TARGET json) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 5f3e9d485..2637f2a70 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -25,6 +25,7 @@ install(TARGETS wkt RUNTIME DESTINATION ${MAPNIK_BIN_DIR} INCLUDES DESTINATION include/ PUBLIC_HEADER DESTINATION include/ + COMPONENT mapnik ) mapnik_install(TARGET wkt) From 7231d06a4642030bcb90c19b6989d75195e17a02 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 2 Jul 2021 22:43:01 +0200 Subject: [PATCH 094/141] ups. this shouldn't be commited --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5b6ffca9..9ce2fb9d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,12 +231,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ4 REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From 7a13a940df70e92efcb6955d4d741391acaa66f8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 5 Jul 2021 17:13:45 +0200 Subject: [PATCH 095/141] build plugins as modules. --- CMakeLists.txt | 8 ++++---- plugins/input/csv/CMakeLists.txt | 7 +------ plugins/input/gdal/CMakeLists.txt | 2 +- plugins/input/geobuf/CMakeLists.txt | 2 +- plugins/input/geojson/CMakeLists.txt | 2 +- plugins/input/ogr/CMakeLists.txt | 2 +- plugins/input/pgraster/CMakeLists.txt | 2 +- plugins/input/postgis/CMakeLists.txt | 2 +- plugins/input/raster/CMakeLists.txt | 2 +- plugins/input/shape/CMakeLists.txt | 2 +- plugins/input/sqlite/CMakeLists.txt | 2 +- plugins/input/topojson/CMakeLists.txt | 2 +- 12 files changed, 15 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ce2fb9d5..b5b6ffca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,12 +231,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ4 REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index 3d251a5ea..ecf4edda6 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -1,6 +1,6 @@ project(input-csv) -add_library(input-csv SHARED +add_library(input-csv MODULE csv_datasource.cpp csv_featureset.cpp csv_index_featureset.cpp @@ -18,10 +18,5 @@ target_link_libraries(input-csv PRIVATE set_target_properties(input-csv PROPERTIES PREFIX "") set_target_properties(input-csv PROPERTIES OUTPUT_NAME "csv") set_target_properties(input-csv PROPERTIES SUFFIX ".input") -#install(TARGETS input-csv DESTINATION bin/plugins/input) - -install(TARGETS input-csv - RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} -) mapnik_install(TARGET input-csv IS_PLUGIN) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 92b305766..0bba721cc 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -2,7 +2,7 @@ project(input-gdal) find_package(GDAL REQUIRED) -add_library(input-gdal SHARED +add_library(input-gdal MODULE gdal_datasource.cpp gdal_featureset.cpp ) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index bb5fef85e..56a027aeb 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -1,6 +1,6 @@ project(input-geobuf) -add_library(input-geobuf SHARED +add_library(input-geobuf MODULE geobuf_datasource.cpp geobuf_featureset.cpp ) diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 39b392fe5..6f830e13b 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,6 +1,6 @@ project(input-geojson) -add_library(input-geojson SHARED +add_library(input-geojson MODULE geojson_datasource.cpp geojson_featureset.cpp geojson_index_featureset.cpp diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 0791c093b..c8fd113de 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -2,7 +2,7 @@ project(input-ogr) find_package(GDAL REQUIRED) -add_library(input-ogr SHARED +add_library(input-ogr MODULE ogr_converter.cpp ogr_datasource.cpp ogr_featureset.cpp diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 146036044..adcb6d8f6 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -2,7 +2,7 @@ project(input-pgraster) find_package(PostgreSQL REQUIRED) -add_library(input-pgraster SHARED +add_library(input-pgraster MODULE pgraster_datasource.cpp pgraster_featureset.cpp pgraster_wkb_reader.cpp diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 0102bac63..843786857 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -2,7 +2,7 @@ project(input-postgis) find_package(PostgreSQL REQUIRED) -add_library(input-postgis SHARED +add_library(input-postgis MODULE postgis_datasource.cpp postgis_featureset.cpp ) diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index 9956b6d9b..f4e2f0ef8 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -1,6 +1,6 @@ project(input-raster) -add_library(input-raster SHARED +add_library(input-raster MODULE raster_datasource.cpp raster_featureset.cpp raster_info.cpp diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index c0a42b460..2c6ec6979 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,6 +1,6 @@ project(input-shape) -add_library(input-shape SHARED +add_library(input-shape MODULE dbfile.cpp dbf_test.cpp shape_datasource.cpp diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index 4d1317aa5..89e693062 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -2,7 +2,7 @@ project(input-sqlite) find_package(SQLite3 REQUIRED) -add_library(input-sqlite SHARED +add_library(input-sqlite MODULE sqlite_datasource.cpp sqlite_featureset.cpp ) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 32cfb1bd1..966d25b85 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -1,6 +1,6 @@ project(input-topojson) -add_library(input-topojson SHARED +add_library(input-topojson MODULE topojson_datasource.cpp topojson_featureset.cpp ) From 6a19824c1235f22787843c2bcb7cd261225b4c29 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 5 Jul 2021 21:58:53 +0200 Subject: [PATCH 096/141] hate proj4... --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5b6ffca9..9ce2fb9d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,12 +231,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ4 REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From e408bf9a225aa4dc0ceeb2e7b3f2ff4218216816 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 6 Jul 2021 21:32:36 +0200 Subject: [PATCH 097/141] add find harfbuzz.cmake --- CMakeLists.txt | 15 ++-- cmake/FindHarfBuzz.cmake | 187 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 cmake/FindHarfBuzz.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ce2fb9d5..51f7bc249 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,13 +113,14 @@ message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") # Begin project configuration mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) -mapnik_find_package(Boost 1.74 REQUIRED COMPONENTS filesystem system regex) +mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex) if(USE_BOOST_REGEX_ICU_WORKAROUND) set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES) endif() mapnik_find_package(Freetype REQUIRED) -mapnik_find_package(harfbuzz CONFIG REQUIRED) +# we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details +mapnik_find_package(HarfBuzz REQUIRED) if(USE_EXTERNAL_MAPBOX_GEOMETRY) # this is used to provide a way to specify include dirs with CACHE VARIABLES @@ -231,12 +232,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ4 REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) @@ -277,7 +278,7 @@ target_link_libraries(core INTERFACE Boost::regex Boost::filesystem Freetype::Freetype - harfbuzz::harfbuzz + HarfBuzz::HarfBuzz ${MAPNIK_OPTIONAL_LIBS} ) target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) diff --git a/cmake/FindHarfBuzz.cmake b/cmake/FindHarfBuzz.cmake new file mode 100644 index 000000000..a0296f321 --- /dev/null +++ b/cmake/FindHarfBuzz.cmake @@ -0,0 +1,187 @@ +# Copyright (c) 2012, Intel Corporation +# Copyright (c) 2019 Sony Interactive Entertainment Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# Try to find Harfbuzz include and library directories. +# +# After successful discovery, this will set for inclusion where needed: +# HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz headers +# HarfBuzz_LIBRARIES - containg the HarfBuzz library + +#[=======================================================================[.rst: +FindHarfBuzz +-------------- + +Find HarfBuzz headers and libraries. + +Imported Targets +^^^^^^^^^^^^^^^^ + +``HarfBuzz::HarfBuzz`` + The HarfBuzz library, if found. + +``HarfBuzz::ICU`` + The HarfBuzz ICU library, if found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables in your project: + +``HarfBuzz_FOUND`` + true if (the requested version of) HarfBuzz is available. +``HarfBuzz_VERSION`` + the version of HarfBuzz. +``HarfBuzz_LIBRARIES`` + the libraries to link against to use HarfBuzz. +``HarfBuzz_INCLUDE_DIRS`` + where to find the HarfBuzz headers. +``HarfBuzz_COMPILE_OPTIONS`` + this should be passed to target_compile_options(), if the + target is not used for linking + +#]=======================================================================] + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz) +set(HarfBuzz_COMPILE_OPTIONS ${PC_HARFBUZZ_CFLAGS_OTHER}) +set(HarfBuzz_VERSION ${PC_HARFBUZZ_CFLAGS_VERSION}) + +find_path(HarfBuzz_INCLUDE_DIR + NAMES hb.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz +) + +find_library(HarfBuzz_LIBRARY + NAMES ${HarfBuzz_NAMES} harfbuzz + HINTS ${PC_HARFBUZZ_LIBDIR} ${PC_HARFBUZZ_LIBRARY_DIRS} +) + +if (HarfBuzz_INCLUDE_DIR AND NOT HarfBuzz_VERSION) + if (EXISTS "${HarfBuzz_INCLUDE_DIR}/hb-version.h") + file(READ "${HarfBuzz_INCLUDE_DIR}/hb-version.h" _harfbuzz_version_content) + + string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\.[0-9]+\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}") + set(HarfBuzz_VERSION "${CMAKE_MATCH_1}") + endif () +endif () + +if ("${HarfBuzz_FIND_VERSION}" VERSION_GREATER "${HarfBuzz_VERSION}") + message(FATAL_ERROR "Required version (" ${HarfBuzz_FIND_VERSION} ") is higher than found version (" ${HarfBuzz_VERSION} ")") +endif () + +# Find components +if (HarfBuzz_INCLUDE_DIR AND HarfBuzz_LIBRARY) + set(_HarfBuzz_REQUIRED_LIBS_FOUND ON) + set(HarfBuzz_LIBS_FOUND "HarfBuzz (required): ${HarfBuzz_LIBRARY}") +else () + set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF) + set(HarfBuzz_LIBS_NOT_FOUND "HarfBuzz (required)") +endif () + +if ("ICU" IN_LIST HarfBuzz_FIND_COMPONENTS) + pkg_check_modules(PC_HARFBUZZ_ICU QUIET harfbuzz-icu) + set(HarfBuzz_ICU_COMPILE_OPTIONS ${PC_HARFBUZZ_ICU_CFLAGS_OTHER}) + + find_path(HarfBuzz_ICU_INCLUDE_DIR + NAMES hb-icu.h + HINTS ${PC_HARFBUZZ_ICU_INCLUDEDIR} ${PC_HARFBUZZ_ICU_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz + ) + + find_library(HarfBuzz_ICU_LIBRARY + NAMES ${HarfBuzz_ICU_NAMES} harfbuzz-icu + HINTS ${PC_HARFBUZZ_ICU_LIBDIR} ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} + ) + + if (HarfBuzz_ICU_LIBRARY) + if (HarfBuzz_FIND_REQUIRED_ICU) + list(APPEND HarfBuzz_LIBS_FOUND "ICU (required): ${HarfBuzz_ICU_LIBRARY}") + else () + list(APPEND HarfBuzz_LIBS_FOUND "ICU (optional): ${HarfBuzz_ICU_LIBRARY}") + endif () + else () + if (HarfBuzz_FIND_REQUIRED_ICU) + set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF) + list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (required)") + else () + list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (optional)") + endif () + endif () +endif () + +if (NOT HarfBuzz_FIND_QUIETLY) + if (HarfBuzz_LIBS_FOUND) + message(STATUS "Found the following HarfBuzz libraries:") + foreach (found ${HarfBuzz_LIBS_FOUND}) + message(STATUS " ${found}") + endforeach () + endif () + if (HarfBuzz_LIBS_NOT_FOUND) + message(STATUS "The following HarfBuzz libraries were not found:") + foreach (found ${HarfBuzz_LIBS_NOT_FOUND}) + message(STATUS " ${found}") + endforeach () + endif () +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(HarfBuzz + FOUND_VAR HarfBuzz_FOUND + REQUIRED_VARS HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY _HarfBuzz_REQUIRED_LIBS_FOUND + VERSION_VAR HarfBuzz_VERSION +) + +if (HarfBuzz_LIBRARY AND NOT TARGET HarfBuzz::HarfBuzz) + add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED GLOBAL) + set_target_properties(HarfBuzz::HarfBuzz PROPERTIES + IMPORTED_LOCATION "${HarfBuzz_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${HarfBuzz_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}" + ) +endif () + +if (HarfBuzz_ICU_LIBRARY AND NOT TARGET HarfBuzz::ICU) + add_library(HarfBuzz::ICU UNKNOWN IMPORTED GLOBAL) + set_target_properties(HarfBuzz::ICU PROPERTIES + IMPORTED_LOCATION "${HarfBuzz_ICU_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${HarfBuzz_ICU_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_ICU_INCLUDE_DIR}" + ) +endif () + +mark_as_advanced( + HarfBuzz_INCLUDE_DIR + HarfBuzz_ICU_INCLUDE_DIR + HarfBuzz_LIBRARY + HarfBuzz_ICU_LIBRARY +) + +if (HarfBuzz_FOUND) + set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY} ${HarfBuzz_ICU_LIBRARY}) + set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR} ${HarfBuzz_ICU_INCLUDE_DIR}) +endif () From eb1236d5dd6b19b4f1672e09069f35554ec20bef Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 6 Jul 2021 21:32:58 +0200 Subject: [PATCH 098/141] use proj *gr* --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51f7bc249..04a46cd03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,12 +232,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ4 REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From c5f05656548c40957a00cf9a467142f64be87e96 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 6 Jul 2021 22:07:29 +0200 Subject: [PATCH 099/141] remove subsequent boost require version calls. --- test/CMakeLists.txt | 2 +- utils/mapnik-index/CMakeLists.txt | 2 +- utils/mapnik-render/CMakeLists.txt | 2 +- utils/pgsql2sqlite/CMakeLists.txt | 2 +- utils/shapeindex/CMakeLists.txt | 2 +- utils/svg2png/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f29c53cc4..0e57e997d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-test) -find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(Boost REQUIRED COMPONENTS program_options) find_package(PostgreSQL REQUIRED) include(FetchContent) diff --git a/utils/mapnik-index/CMakeLists.txt b/utils/mapnik-index/CMakeLists.txt index 7a600a8b2..3ec41c401 100644 --- a/utils/mapnik-index/CMakeLists.txt +++ b/utils/mapnik-index/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-index) -find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(Boost REQUIRED COMPONENTS program_options) add_executable(mapnik-index mapnik-index.cpp diff --git a/utils/mapnik-render/CMakeLists.txt b/utils/mapnik-render/CMakeLists.txt index 08c689797..b98ac8630 100644 --- a/utils/mapnik-render/CMakeLists.txt +++ b/utils/mapnik-render/CMakeLists.txt @@ -1,6 +1,6 @@ project(mapnik-render) -find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(Boost REQUIRED COMPONENTS program_options) add_executable(mapnik-render mapnik-render.cpp) diff --git a/utils/pgsql2sqlite/CMakeLists.txt b/utils/pgsql2sqlite/CMakeLists.txt index 8ff6eb1f2..19883f4a9 100644 --- a/utils/pgsql2sqlite/CMakeLists.txt +++ b/utils/pgsql2sqlite/CMakeLists.txt @@ -1,5 +1,5 @@ project(pgsql2sqlite) -find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(Boost REQUIRED COMPONENTS program_options) find_package(SQLite3 REQUIRED) find_package(PostgreSQL REQUIRED) diff --git a/utils/shapeindex/CMakeLists.txt b/utils/shapeindex/CMakeLists.txt index 55621cdd5..4aae25bf1 100644 --- a/utils/shapeindex/CMakeLists.txt +++ b/utils/shapeindex/CMakeLists.txt @@ -1,6 +1,6 @@ project(shapeindex) -find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(Boost REQUIRED COMPONENTS program_options) add_executable(shapeindex shapeindex.cpp diff --git a/utils/svg2png/CMakeLists.txt b/utils/svg2png/CMakeLists.txt index 55572f393..51a8baecd 100644 --- a/utils/svg2png/CMakeLists.txt +++ b/utils/svg2png/CMakeLists.txt @@ -1,6 +1,6 @@ project(svg2png) -find_package(Boost 1.74 REQUIRED COMPONENTS program_options) +find_package(Boost REQUIRED COMPONENTS program_options) add_executable(svg2png svg2png.cpp From cdb598e67bbf988aef9b937e09c32d925dee9c5f Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 6 Jul 2021 22:19:28 +0200 Subject: [PATCH 100/141] add harfbuzz minimum version and HarfBuzz::ICU target. probably fixes osx --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04a46cd03..c29630750 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ endif() mapnik_find_package(Freetype REQUIRED) # we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details -mapnik_find_package(HarfBuzz REQUIRED) +mapnik_find_package(HarfBuzz 0.9.34 REQUIRED COMPONENTS ICU) if(USE_EXTERNAL_MAPBOX_GEOMETRY) # this is used to provide a way to specify include dirs with CACHE VARIABLES @@ -279,6 +279,7 @@ target_link_libraries(core INTERFACE Boost::filesystem Freetype::Freetype HarfBuzz::HarfBuzz + HarfBuzz::ICU ${MAPNIK_OPTIONAL_LIBS} ) target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) From 3397fff8eaf3f4a40bc478e64cfb7db6ad4c5474 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Tue, 6 Jul 2021 22:46:07 +0200 Subject: [PATCH 101/141] add harfbuzz fallback --- CMakeLists.txt | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c29630750..1d2a07d98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,9 @@ message(STATUS "Installing plugins to ${PLUGINS_INSTALL_DIR}") set(FONTS_INSTALL_DIR ${MAPNIK_BIN_DIR}/fonts CACHE STRING "installs the fonts in the specified directory") message(STATUS "Installing fonts to ${FONTS_INSTALL_DIR}") +set(MAPNIK_COMPILE_DEFS "") +set(MAPNIK_OPTIONAL_LIBS "") +set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") # Begin project configuration mapnik_find_threads() @@ -119,8 +122,19 @@ if(USE_BOOST_REGEX_ICU_WORKAROUND) endif() mapnik_find_package(Freetype REQUIRED) -# we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details -mapnik_find_package(HarfBuzz 0.9.34 REQUIRED COMPONENTS ICU) + +# try to find harfbuzz with the native configuration and fallback to our "own" FindHarfBuzz +set(HARFBUZZ_MINIMUM_VERSION 0.9.34) +mapnik_find_package(harfbuzz CONFIG QUIET) +if(harfbuzz_FOUND) + message(STATUS "Found harfbuzz native cmake") + list(APPEND MAPNIK_OPTIONAL_LIBS harfbuzz::harfbuzz) +else() + # we use our "own" FindHarfBuzz. See https://github.com/mapnik/mapnik/pull/4191#issuecomment-874728157 for more details + message(STATUS "Fallback to FindHarfBuzz") + mapnik_find_package(HarfBuzz ${HARFBUZZ_MINIMUM_VERSION} REQUIRED COMPONENTS ICU) + list(APPEND MAPNIK_OPTIONAL_LIBS HarfBuzz::HarfBuzz HarfBuzz::ICU) +endif() if(USE_EXTERNAL_MAPBOX_GEOMETRY) # this is used to provide a way to specify include dirs with CACHE VARIABLES @@ -179,9 +193,6 @@ if(NOT MAPBOX_VARIANT_INCLUDE_DIRS) message(FATAL_ERROR "Set MAPBOX_VARIANT_INCLUDE_DIRS to the mapbox/variant include dir") endif() -set(MAPNIK_COMPILE_DEFS "") -set(MAPNIK_OPTIONAL_LIBS "") -set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") # (used by MapnikInstall.cmake. properties are needed since "set(...)" will be out of scope set_property(GLOBAL PROPERTY TARGETS "") set_property(GLOBAL PROPERTY PLUGINS "") @@ -278,8 +289,6 @@ target_link_libraries(core INTERFACE Boost::regex Boost::filesystem Freetype::Freetype - HarfBuzz::HarfBuzz - HarfBuzz::ICU ${MAPNIK_OPTIONAL_LIBS} ) target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) From 59f9974baa8693d8b99c4f479b413e7a41c46ef9 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 7 Jul 2021 21:06:59 +0200 Subject: [PATCH 102/141] TEMP: use openjpeg --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d2a07d98..31822e07c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,9 +218,9 @@ if(USE_PNG) endif() if(USE_JPEG) - mapnik_find_package(JPEG REQUIRED) + mapnik_find_package(OpenJPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) - list(APPEND MAPNIK_OPTIONAL_LIBS JPEG::JPEG) + list(APPEND MAPNIK_OPTIONAL_LIBS openjp2) endif() if(USE_TIFF) @@ -243,12 +243,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ4 REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From 01159d07217364405e558e8b0585dcdb92e9107c Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 7 Jul 2021 21:11:28 +0200 Subject: [PATCH 103/141] still forget proj everytime... --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31822e07c..23584bc8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,12 +243,12 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ4 REQUIRED) - math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + mapnik_find_package(PROJ REQUIRED) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From c5ced60c38ed8f5e41f9c7b1e1a9b7bb4dd0dc6a Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 21 Jul 2021 18:16:48 +0200 Subject: [PATCH 104/141] fix some bugs when using ubuntu to build --- CMakeLists.txt | 27 +++++-- cmake/FindWebP.cmake | 166 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 4 deletions(-) create mode 100644 cmake/FindWebP.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 23584bc8f..4588a4152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,10 @@ option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, u 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_OPENJPEG "adds openjpeg support" ON) +if(USE_JPEG AND USE_OPENJPEG) + message(FATAL_ERROR "Choose either USE_JPEG OR USE_OPENJPEG") +endif() option(USE_PNG "adds png support" ON) option(USE_TIFF "adds tiff support" ON) option(USE_WEBP "adds webp support" ON) @@ -114,6 +118,7 @@ set(MAPNIK_OPTIONAL_LIBS "") set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") # Begin project configuration +mapnik_find_package(PkgConfig REQUIRED) mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex) @@ -217,11 +222,16 @@ if(USE_PNG) list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() -if(USE_JPEG) +if(USE_OPENJPEG) mapnik_find_package(OpenJPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) list(APPEND MAPNIK_OPTIONAL_LIBS openjp2) endif() +if(USE_JPEG) + mapnik_find_package(JPEG REQUIRED) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) + list(APPEND MAPNIK_OPTIONAL_LIBS JPEG::JPEG) +endif() if(USE_TIFF) mapnik_find_package(TIFF REQUIRED) @@ -230,9 +240,9 @@ if(USE_TIFF) endif() if(USE_WEBP) - mapnik_find_package(WebP CONFIG REQUIRED) + mapnik_find_package(WebP REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP) - list(APPEND MAPNIK_OPTIONAL_LIBS WebP::webp) + list(APPEND MAPNIK_OPTIONAL_LIBS WebP::libwebp) endif() if(USE_CAIRO) @@ -243,7 +253,16 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ REQUIRED) + mapnik_find_package(PROJ QUIET) + # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config + if(NOT PROJ_FOUND) + message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") + pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) + string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}") + set(PROJ_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}") + set(PROJ_VERSION_PATCH "${CMAKE_MATCH_3}") + endif() math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake new file mode 100644 index 000000000..c93e78ceb --- /dev/null +++ b/cmake/FindWebP.cmake @@ -0,0 +1,166 @@ +# Copyright (C) 2020 Sony Interactive Entertainment Inc. +# Copyright (C) 2012 Raphael Kubo da Costa +# Copyright (C) 2013 Igalia S.L. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#[=======================================================================[.rst: +FindWebP +-------------- + +Find WebP headers and libraries. + +Imported Targets +^^^^^^^^^^^^^^^^ + +``WebP::libwebp`` + The WebP library, if found. + +``WebP::demux`` + The WebP demux library, if found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables in your project: + +``WebP_FOUND`` + true if (the requested version of) WebP is available. +``WebP_VERSION`` + the version of WebP. +``WebP_LIBRARIES`` + the libraries to link against to use WebP. +``WebP_INCLUDE_DIRS`` + where to find the WebP headers. +``WebP_COMPILE_OPTIONS`` + this should be passed to target_compile_options(), if the + target is not used for linking + +#]=======================================================================] + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_WEBP QUIET libwebp) +set(WebP_COMPILE_OPTIONS ${PC_WEBP_CFLAGS_OTHER}) +set(WebP_VERSION ${PC_WEBP_CFLAGS_VERSION}) + +find_path(WebP_INCLUDE_DIR + NAMES webp/decode.h + HINTS ${PC_WEBP_INCLUDEDIR} ${PC_WEBP_INCLUDE_DIRS} +) + +find_library(WebP_LIBRARY + NAMES ${WebP_NAMES} webp + HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS} +) + +# There's nothing in the WebP headers that could be used to detect the exact +# WebP version being used so don't attempt to do so. A version can only be found +# through pkg-config +if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}") + if (WebP_VERSION) + message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${WebP_VERSION} ")") + else () + message(WARNING "Cannot determine WebP version without pkg-config") + endif () +endif () + +# Find components +if (WebP_INCLUDE_DIR AND WebP_LIBRARY) + set(_WebP_REQUIRED_LIBS_FOUND ON) + set(WebP_LIBS_FOUND "WebP (required): ${WebP_LIBRARY}") +else () + set(_WebP_REQUIRED_LIBS_FOUND OFF) + set(WebP_LIBS_NOT_FOUND "WebP (required)") +endif () + +if ("demux" IN_LIST WebP_FIND_COMPONENTS) + find_library(WebP_DEMUX_LIBRARY + NAMES ${WebP_DEMUX_NAMES} webpdemux + HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS} + ) + + if (WebP_DEMUX_LIBRARY) + if (WebP_FIND_REQUIRED_demux) + list(APPEND WebP_LIBS_FOUND "demux (required): ${WebP_DEMUX_LIBRARY}") + else () + list(APPEND WebP_LIBS_FOUND "demux (optional): ${WebP_DEMUX_LIBRARY}") + endif () + else () + if (WebP_FIND_REQUIRED_demux) + set(_WebP_REQUIRED_LIBS_FOUND OFF) + list(APPEND WebP_LIBS_NOT_FOUND "demux (required)") + else () + list(APPEND WebP_LIBS_NOT_FOUND "demux (optional)") + endif () + endif () +endif () + +if (NOT WebP_FIND_QUIETLY) + if (WebP_LIBS_FOUND) + message(STATUS "Found the following WebP libraries:") + foreach (found ${WebP_LIBS_FOUND}) + message(STATUS " ${found}") + endforeach () + endif () + if (WebP_LIBS_NOT_FOUND) + message(STATUS "The following WebP libraries were not found:") + foreach (found ${WebP_LIBS_NOT_FOUND}) + message(STATUS " ${found}") + endforeach () + endif () +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WebP + FOUND_VAR WebP_FOUND + REQUIRED_VARS WebP_INCLUDE_DIR WebP_LIBRARY _WebP_REQUIRED_LIBS_FOUND + VERSION_VAR WebP_VERSION +) + +if (WebP_LIBRARY AND NOT TARGET WebP::libwebp) + add_library(WebP::libwebp UNKNOWN IMPORTED GLOBAL) + set_target_properties(WebP::libwebp PROPERTIES + IMPORTED_LOCATION "${WebP_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${WebP_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIR}" + ) +endif () + +if (WebP_DEMUX_LIBRARY AND NOT TARGET WebP::demux) + add_library(WebP::demux UNKNOWN IMPORTED GLOBAL) + set_target_properties(WebP::demux PROPERTIES + IMPORTED_LOCATION "${WebP_DEMUX_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${WebP_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIR}" + ) +endif () + +mark_as_advanced( + WebP_INCLUDE_DIR + WebP_LIBRARY + WebP_DEMUX_LIBRARY +) + +if (WebP_FOUND) + set(WebP_LIBRARIES ${WebP_LIBRARY} ${WebP_DEMUX_LIBRARY}) + set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR}) +endif () From e5cf5dda3909a593110123567760f211464d6650 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 21 Jul 2021 18:24:40 +0200 Subject: [PATCH 105/141] default to jpeg. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4588a4152..fd1d463e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, u 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_OPENJPEG "adds openjpeg support" ON) +option(USE_OPENJPEG "adds openjpeg support" OFF) if(USE_JPEG AND USE_OPENJPEG) message(FATAL_ERROR "Choose either USE_JPEG OR USE_OPENJPEG") endif() From 282986c50319bdebe41c396c5705fb9c3cce4922 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 21 Jul 2021 20:03:42 +0200 Subject: [PATCH 106/141] fix config file naming scheme. Only happens when using older cmake versions. But this was definitly an issue. Target name should be the same on the file (case sensitive) --- CMakeLists.txt | 26 ++++++++++++------- ...kConfig.cmake.in => mapnikConfig.cmake.in} | 2 +- docs/cmake-usage.md | 2 +- 3 files changed, 19 insertions(+), 11 deletions(-) rename cmake/{MapnikConfig.cmake.in => mapnikConfig.cmake.in} (88%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd1d463e7..db78d5357 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,27 +341,35 @@ include(CMakePackageConfigHelpers) # set the cmake targets install location set(INCLUDE_INSTALL_DIR include/) write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES) -configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MapnikConfig.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake" INSTALL_DESTINATION ${INSTALL_CMAKE_DIR} PATH_VARS INCLUDE_INSTALL_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES ) -install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/MapnikConfigVersion.cmake" - DESTINATION ${INSTALL_CMAKE_DIR} +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake" + DESTINATION ${INSTALL_CMAKE_DIR} +) + +install( + FILES + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindHarfBuzz.cmake" + DESTINATION ${INSTALL_CMAKE_DIR}/Modules ) -install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake" DESTINATION ${INSTALL_CMAKE_DIR}/Modules) install(EXPORT MapnikTargets - FILE MapnikTargets.cmake + FILE mapnikTargets.cmake NAMESPACE mapnik:: DESTINATION ${INSTALL_CMAKE_DIR} ) diff --git a/cmake/MapnikConfig.cmake.in b/cmake/mapnikConfig.cmake.in similarity index 88% rename from cmake/MapnikConfig.cmake.in rename to cmake/mapnikConfig.cmake.in index 74071d493..8e724e9ff 100644 --- a/cmake/MapnikConfig.cmake.in +++ b/cmake/mapnikConfig.cmake.in @@ -10,6 +10,6 @@ include(CMakeFindDependencyMacro) @MAPNIK_DEPENDENCIES@ -include("${CMAKE_CURRENT_LIST_DIR}/MapnikTargets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/mapnikTargets.cmake") check_required_components(mapnik) diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index 57de8f507..e62402c68 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -28,7 +28,7 @@ find_package(mapnik CONFIG REQUIRED) target_link_libraries(mytarget ... mapnik::core mapnik::mapnik) ``` -All mapnik executables and targets are exported within `MapnikTargets.cmake`. +All mapnik executables and targets are exported within `mapnikTargets.cmake`. The plugin dir is available in the variable `MAPNIK_PLUGINS_DIR`. The font path is is available in the variable `MAPNIK_FONTS_DIR`. From 199fd8218bbcfbe8e4456fa66d66fe8efa305087 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 21 Jul 2021 20:08:22 +0200 Subject: [PATCH 107/141] this fixes a bug when including a package via pkg-config: We will append the call to the config file to find the package via find_package. However this does not work when the package was included with pkg-config --- cmake/MapnikFindPackage.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/MapnikFindPackage.cmake b/cmake/MapnikFindPackage.cmake index a4a10ba7d..8bcd96216 100644 --- a/cmake/MapnikFindPackage.cmake +++ b/cmake/MapnikFindPackage.cmake @@ -16,10 +16,14 @@ endmacro() macro(mapnik_find_package) find_package(${ARGN}) - set(MAPNIK_TMP_DEP ${ARGN}) - list(JOIN MAPNIK_TMP_DEP " " MAPNIK_TMP_DEP) - list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})") - mapnik_print_version(${ARGV0}) + if(${ARGV0}_FOUND) + set(MAPNIK_TMP_DEP ${ARGN}) + list(JOIN MAPNIK_TMP_DEP " " MAPNIK_TMP_DEP) + list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})") + mapnik_print_version(${ARGV0}) + else() + message(STATUS "not found: ${ARGV0}") + endif() endmacro() macro(mapnik_find_threads) From 3a2996e5b0ab644d0b9a008d3f86e48d0023f585 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 21 Jul 2021 20:20:44 +0200 Subject: [PATCH 108/141] install mapbox headers when using NOT USE_EXTERNAL* --- CMakeLists.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db78d5357..c8b4e3eff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,7 @@ if(USE_EXTERNAL_MAPBOX_GEOMETRY) else() set(MAPBOX_GEOMETRY_INCLUDE_DIRS $ + $ ) endif() if(NOT MAPBOX_GEOMETRY_INCLUDE_DIRS) @@ -164,6 +165,7 @@ if(USE_EXTERNAL_MAPBOX_POLYLABEL) else() set(MAPBOX_POLYLABEL_INCLUDE_DIRS $ + $ ) endif() if(NOT MAPBOX_POLYLABEL_INCLUDE_DIRS) @@ -178,6 +180,7 @@ if(USE_EXTERNAL_MAPBOX_PROTOZERO) else() set(MAPBOX_PROTOZERO_INCLUDE_DIRS $ + $ ) endif() if(NOT MAPBOX_PROTOZERO_INCLUDE_DIRS) @@ -192,6 +195,7 @@ if(USE_EXTERNAL_MAPBOX_VARIANT) else() set(MAPBOX_VARIANT_INCLUDE_DIRS $ + $ ) endif() if(NOT MAPBOX_VARIANT_INCLUDE_DIRS) @@ -379,7 +383,19 @@ install(DIRECTORY deps/agg/include/ TYPE INCLUDE) install(DIRECTORY deps/mapnik TYPE INCLUDE) install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") +if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ TYPE INCLUDE) +endif() +if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ TYPE INCLUDE) +endif() +if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ TYPE INCLUDE) +endif() +if(NOT USE_EXTERNAL_MAPBOX_VARIANT) + install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ TYPE INCLUDE) +endif() + mapnik_install_targets() - include(pack) From 9998ca7dd9edf6aaa6c5311f1da0087d01f3816a Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 20:17:03 +0200 Subject: [PATCH 109/141] fix gdal library variable --- plugins/input/gdal/CMakeLists.txt | 2 +- plugins/input/ogr/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 0bba721cc..952485f6c 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -12,7 +12,7 @@ target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIR}) target_link_libraries(input-gdal PRIVATE mapnik::core mapnik::mapnik - ${GDAL_LIBRARY} + ${GDAL_LIBRARIES} ) set_target_properties(input-gdal PROPERTIES PREFIX "") set_target_properties(input-gdal PROPERTIES OUTPUT_NAME "gdal") diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index c8fd113de..577a133dd 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -14,7 +14,7 @@ target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIR}) target_link_libraries(input-ogr PRIVATE mapnik::core mapnik::mapnik - ${GDAL_LIBRARY} + ${GDAL_LIBRARIES} ) set_target_properties(input-ogr PROPERTIES PREFIX "") set_target_properties(input-ogr PROPERTIES OUTPUT_NAME "ogr") From 81397f84bcc2f4fa6c8c87414a51e0418ff66881 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 20:34:08 +0200 Subject: [PATCH 110/141] add debug postfix to wkt, json and mapnik. Mapnik can be installed with multi configuration enviroment --- CMakeLists.txt | 4 ++++ src/CMakeLists.txt | 2 ++ src/json/CMakeLists.txt | 7 +++++-- src/wkt/CMakeLists.txt | 7 +++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b4e3eff..11a6da261 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,10 @@ message(STATUS "Using c++ extensions: ${CXX_EXTENSIONS}") # https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD_REQUIRED.html#prop_tgt:CXX_STANDARD_REQUIRED set(CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD +# add debug postfix to the libraries +set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json") +message(STATUS "added postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}") + if(WIN32) set(DEFAULT_BIN_DIR bin) set(DEFAULT_LIB_DIR lib) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index efb1f9b08..b65d12ed2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -295,6 +295,8 @@ target_link_libraries(mapnik PRIVATE mapnik::agg ) +set_target_properties(mapnik PROPERTIES DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX}) + install(TARGETS mapnik EXPORT MapnikTargets LIBRARY DESTINATION ${MAPNIK_LIB_DIR} diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index fa5c148f1..2ced71b33 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -15,8 +15,6 @@ add_library(json STATIC ) add_library(mapnik::json ALIAS json) -set_property(TARGET json PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(json PRIVATE ${JPEG_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} @@ -26,6 +24,11 @@ target_include_directories(json PRIVATE ) target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) +set_target_properties(json PROPERTIES + DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} + POSITION_INDEPENDENT_CODE ON +) + install(TARGETS json EXPORT MapnikTargets LIBRARY DESTINATION ${MAPNIK_LIB_DIR} diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 2637f2a70..da9c6d94b 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -6,8 +6,6 @@ add_library(wkt STATIC ) add_library(mapnik::wkt ALIAS wkt) -set_property(TARGET wkt PROPERTY POSITION_INDEPENDENT_CODE ON) - target_include_directories(wkt PRIVATE ${MAPNIK_INCLUDE_PATH} ${JPEG_INCLUDE_DIR} @@ -18,6 +16,11 @@ target_include_directories(wkt PRIVATE ) target_link_libraries(wkt PRIVATE mapnik::core) +set_target_properties(wkt PROPERTIES + DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} + POSITION_INDEPENDENT_CODE ON +) + install(TARGETS wkt EXPORT MapnikTargets LIBRARY DESTINATION ${MAPNIK_LIB_DIR} From bcc66a739c2b5ce4becd559e0fc6dc5d4c0b2db4 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 20:44:29 +0200 Subject: [PATCH 111/141] remove openjpeg again. was just a test. --- CMakeLists.txt | 11 ++--------- demo/c++/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11a6da261..54dda37ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,10 +33,6 @@ option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, u 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_OPENJPEG "adds openjpeg support" OFF) -if(USE_JPEG AND USE_OPENJPEG) - message(FATAL_ERROR "Choose either USE_JPEG OR USE_OPENJPEG") -endif() option(USE_PNG "adds png support" ON) option(USE_TIFF "adds tiff support" ON) option(USE_WEBP "adds webp support" ON) @@ -214,6 +210,7 @@ if(USE_BIGINT) message(STATUS "uses BIGINT") list(APPEND MAPNIK_COMPILE_DEFS BIGINT) endif() + if(USE_MEMORY_MAPPED_FILE) message(STATUS "uses MAPNIK_MEMORY_MAPPED_FILE") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE) @@ -224,17 +221,13 @@ if(USE_LIBXML2) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) list(APPEND MAPNIK_OPTIONAL_LIBS LibXml2::LibXml2) endif() + if(USE_PNG) mapnik_find_package(PNG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_PNG) list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() -if(USE_OPENJPEG) - mapnik_find_package(OpenJPEG REQUIRED) - list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) - list(APPEND MAPNIK_OPTIONAL_LIBS openjp2) -endif() if(USE_JPEG) mapnik_find_package(JPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 7b86d37f2..1ac290b6d 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -5,6 +5,6 @@ add_executable(mapnik-demo rundemo.cpp) target_link_libraries(mapnik-demo PRIVATE mapnik::core mapnik::agg mapnik::mapnik) mapnik_install(TARGET mapnik-demo) -mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape) +mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape input-gdal) mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts) mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape) From 3001e0c78aeb50364bb5a859cc8bc0ae33d99966 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 20:44:36 +0200 Subject: [PATCH 112/141] Revert "remove openjpeg again. was just a test." This reverts commit bcc66a739c2b5ce4becd559e0fc6dc5d4c0b2db4. --- CMakeLists.txt | 11 +++++++++-- demo/c++/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54dda37ed..11a6da261 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,10 @@ option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, u 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_OPENJPEG "adds openjpeg support" OFF) +if(USE_JPEG AND USE_OPENJPEG) + message(FATAL_ERROR "Choose either USE_JPEG OR USE_OPENJPEG") +endif() option(USE_PNG "adds png support" ON) option(USE_TIFF "adds tiff support" ON) option(USE_WEBP "adds webp support" ON) @@ -210,7 +214,6 @@ if(USE_BIGINT) message(STATUS "uses BIGINT") list(APPEND MAPNIK_COMPILE_DEFS BIGINT) endif() - if(USE_MEMORY_MAPPED_FILE) message(STATUS "uses MAPNIK_MEMORY_MAPPED_FILE") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE) @@ -221,13 +224,17 @@ if(USE_LIBXML2) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) list(APPEND MAPNIK_OPTIONAL_LIBS LibXml2::LibXml2) endif() - if(USE_PNG) mapnik_find_package(PNG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_PNG) list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() +if(USE_OPENJPEG) + mapnik_find_package(OpenJPEG REQUIRED) + list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) + list(APPEND MAPNIK_OPTIONAL_LIBS openjp2) +endif() if(USE_JPEG) mapnik_find_package(JPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) diff --git a/demo/c++/CMakeLists.txt b/demo/c++/CMakeLists.txt index 1ac290b6d..7b86d37f2 100644 --- a/demo/c++/CMakeLists.txt +++ b/demo/c++/CMakeLists.txt @@ -5,6 +5,6 @@ add_executable(mapnik-demo rundemo.cpp) target_link_libraries(mapnik-demo PRIVATE mapnik::core mapnik::agg mapnik::mapnik) mapnik_install(TARGET mapnik-demo) -mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape input-gdal) +mapnik_copy_plugins(TARGET mapnik-demo DESTINATION plugins/input PLUGINS input-shape) mapnik_require_fonts(TARGET mapnik-demo DESTINATION fonts) mapnik_copy_dependencies(TARGETS mapnik-demo PLUGINS input-shape) From 7b0aa9d3bf30f343601cccfa2e863b3679028203 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 20:45:16 +0200 Subject: [PATCH 113/141] remove openjpeg again. was just a test --- CMakeLists.txt | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11a6da261..54dda37ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,10 +33,6 @@ option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, u 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_OPENJPEG "adds openjpeg support" OFF) -if(USE_JPEG AND USE_OPENJPEG) - message(FATAL_ERROR "Choose either USE_JPEG OR USE_OPENJPEG") -endif() option(USE_PNG "adds png support" ON) option(USE_TIFF "adds tiff support" ON) option(USE_WEBP "adds webp support" ON) @@ -214,6 +210,7 @@ if(USE_BIGINT) message(STATUS "uses BIGINT") list(APPEND MAPNIK_COMPILE_DEFS BIGINT) endif() + if(USE_MEMORY_MAPPED_FILE) message(STATUS "uses MAPNIK_MEMORY_MAPPED_FILE") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE) @@ -224,17 +221,13 @@ if(USE_LIBXML2) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) list(APPEND MAPNIK_OPTIONAL_LIBS LibXml2::LibXml2) endif() + if(USE_PNG) mapnik_find_package(PNG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_PNG) list(APPEND MAPNIK_OPTIONAL_LIBS PNG::PNG) endif() -if(USE_OPENJPEG) - mapnik_find_package(OpenJPEG REQUIRED) - list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) - list(APPEND MAPNIK_OPTIONAL_LIBS openjp2) -endif() if(USE_JPEG) mapnik_find_package(JPEG REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_JPEG) From 03b1f18c89dfa77befd63344682ad3cd7a36efe1 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 21:04:45 +0200 Subject: [PATCH 114/141] make pkg-config optionally. But fail later when we actually need pkg-config as a fallback --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54dda37ed..35479ad2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ set(MAPNIK_OPTIONAL_LIBS "") set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") # Begin project configuration -mapnik_find_package(PkgConfig REQUIRED) +mapnik_find_package(PkgConfig) mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex) From b925abf4035307479312ff1ddd3e449d9886966a Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 21:35:12 +0200 Subject: [PATCH 115/141] fix library name --- src/CMakeLists.txt | 5 ++++- src/json/CMakeLists.txt | 1 + src/wkt/CMakeLists.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b65d12ed2..5de2a86e6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -295,7 +295,10 @@ target_link_libraries(mapnik PRIVATE mapnik::agg ) -set_target_properties(mapnik PROPERTIES DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX}) +set_target_properties(mapnik PROPERTIES + DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} + PREFIX "lib" +) install(TARGETS mapnik EXPORT MapnikTargets diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 2ced71b33..93f0baad7 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -27,6 +27,7 @@ target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) set_target_properties(json PROPERTIES DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} POSITION_INDEPENDENT_CODE ON + PREFIX "libmapnik-" ) install(TARGETS json diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index da9c6d94b..7ef2255fa 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -19,6 +19,7 @@ target_link_libraries(wkt PRIVATE mapnik::core) set_target_properties(wkt PROPERTIES DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} POSITION_INDEPENDENT_CODE ON + PREFIX "libmapnik-" ) install(TARGETS wkt From bbcf1c2009aeedc54cdd63648d11d27e83b0a6e8 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 21:45:25 +0200 Subject: [PATCH 116/141] add multithreaded --- CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35479ad2a..456dc4be9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,7 @@ option(USE_GRID_RENDERER "adds grid renderer" ON) option(USE_SVG_RENDERER "adds svg renderer" ON) option(USE_BIGINT "uses 64 bit instead of 32" ON) option(USE_MEMORY_MAPPED_FILE "uses file cache" ON) +option(USE_MULTITHREADED "enables the multithreaded features (threadsafe)" ON) option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) @@ -81,7 +82,7 @@ set(CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD # add debug postfix to the libraries set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json") -message(STATUS "added postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}") +message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}") if(WIN32) set(DEFAULT_BIN_DIR bin) @@ -118,7 +119,18 @@ set(MAPNIK_OPTIONAL_LIBS "") set(MAPNIK_OPTIONAL_LIBS_INCLUDE "") # Begin project configuration -mapnik_find_package(PkgConfig) + +# needs to be before the first call of find_boost. +if(USE_MULTITHREADED) + message(STATUS "multithreaded enabled") + set(Boost_USE_MULTITHREADED ON) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_THREADSAFE) +else() + set(Boost_USE_MULTITHREADED OFF) + message(STATUS "multithreaded disabled") +endif() + +find_package(PkgConfig) mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex) From 14944cd23590f78955a5f782adf7c490162941ec Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 21:55:01 +0200 Subject: [PATCH 117/141] added some docs --- docs/cmake-usage.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index e62402c68..c1dc5b647 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -32,3 +32,8 @@ All mapnik executables and targets are exported within `mapnikTargets.cmake`. The plugin dir is available in the variable `MAPNIK_PLUGINS_DIR`. The font path is is available in the variable `MAPNIK_FONTS_DIR`. + +## Recommendations + +If you target a specific platform, it is recommended to create a toolchain file and set all the options and library path that you would normally set via cmd line options. +If you are using a recent cmake version (>=3.19?), it is recommended to use a CMakePreset instead. https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html From 4d3affb95dbcf43bfc888016e638a8fb06957ed6 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 22:06:01 +0200 Subject: [PATCH 118/141] fix gdal include dir --- plugins/input/gdal/CMakeLists.txt | 2 +- plugins/input/ogr/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 952485f6c..ca0cb4d6f 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -8,7 +8,7 @@ add_library(input-gdal MODULE ) add_library(mapnik::plugin::input::gdal ALIAS input-gdal) -target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIR}) +target_include_directories(input-gdal PRIVATE ${GDAL_INCLUDE_DIRS}) target_link_libraries(input-gdal PRIVATE mapnik::core mapnik::mapnik diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index 577a133dd..599a325a9 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(input-ogr MODULE ) add_library(mapnik::plugin::input::ogr ALIAS input-ogr) -target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIR}) +target_include_directories(input-ogr PRIVATE ${GDAL_INCLUDE_DIRS}) target_link_libraries(input-ogr PRIVATE mapnik::core mapnik::mapnik From d737569574a83e5e40acd7778c19c76b0fb433d4 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 22:45:39 +0200 Subject: [PATCH 119/141] add presets --- .gitignore | 2 + CMakeLists.txt | 10 ++--- CMakePresets.json | 105 ++++++++++++++++++++++++++++++++++++++++++++ docs/cmake-usage.md | 59 ++++++++++++++++++++++++- 4 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 CMakePresets.json diff --git a/.gitignore b/.gitignore index bf3bf93e0..9f55b20da 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,5 @@ test/visual/run # cmake build .vs + +CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 456dc4be9..b718b25b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -266,9 +266,9 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ QUIET) + mapnik_find_package(PROJ4 QUIET) # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config - if(NOT PROJ_FOUND) + if(NOT PROJ4_FOUND) message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}") @@ -276,11 +276,11 @@ if(USE_PROJ) set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}") set(PROJ_VERSION_PATCH "${CMAKE_MATCH_3}") endif() - math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..5477c3989 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,105 @@ +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "linux-clang", + "displayName": "Linux clang", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_CXX_FLAGS": "-stdlib=libstdc++", + "CMAKE_EXE_LINKER_FLAGS": "-stdlib=libstdc++", + "CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libstdc++" + } + }, + { + "name": "linux-clang-debug", + "displayName": "Linux clang debug", + "inherits": "linux-clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "linux-clang-release", + "displayName": "Linux clang release", + "inherits": "linux-clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "linux-gcc", + "displayName": "Linux gcc", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++" + } + }, + { + "name": "linux-gcc-debug", + "displayName": "Linux gcc debug", + "inherits": "linux-gcc", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "linux-gcc-release", + "displayName": "Linux gcc release", + "inherits": "linux-gcc", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "windows-default", + "displayName": "Windows x64 Debug", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "windows-default-release", + "displayName": "Windows x64 Release", + "inherits": "windows-default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default" + } + ] +} diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index c1dc5b647..cd99ff2fd 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -36,4 +36,61 @@ The font path is is available in the variable `MAPNIK_FONTS_DIR`. ## Recommendations If you target a specific platform, it is recommended to create a toolchain file and set all the options and library path that you would normally set via cmd line options. -If you are using a recent cmake version (>=3.19?), it is recommended to use a CMakePreset instead. https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html +If you are using a recent cmake version (>=3.20), it is recommended to use a CMakePreset instead. https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html + + +## CMakePreset example + +If you are using CMakePresets and need to add vcpkg integration, just create a `CMakeUserPresets.json` file beside `CMakePresets.json. +This could look like this: +```json +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "vcpkg-x64-win-debug", + "inherits": "windows-default", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + }, + { + "name": "vcpkg-x64-win-release", + "inherits": "windows-default-release", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + } + ] +} +``` + + +If your libraries are not in the global search paths, you could add a own `CMakeUserPresets.json` with + +```json +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "linux-clang-debug-own", + "inherits": "linux-clang-debug", + "cacheVariables": { + "WebP_DIR": "/home/myuser/webp/cmake", + "USE_CAIRO": "OFF", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install" + } + } + ] +} +``` From 28d286ecb8c9b06ab7ceb62725c55621b7a6603d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 22:46:23 +0200 Subject: [PATCH 120/141] i really need to upgrade proj... --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b718b25b9..456dc4be9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -266,9 +266,9 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ4 QUIET) + mapnik_find_package(PROJ QUIET) # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config - if(NOT PROJ4_FOUND) + if(NOT PROJ_FOUND) message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}") @@ -276,11 +276,11 @@ if(USE_PROJ) set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}") set(PROJ_VERSION_PATCH "${CMAKE_MATCH_3}") endif() - math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) From 1f6a794b43001b605c6b912a5c25eb75be227a7b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 22:54:22 +0200 Subject: [PATCH 121/141] add MAPNIK_DEBUG when using the mapnik debug configuration --- CMakePresets.json | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 5477c3989..1c735bb7f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -24,7 +24,8 @@ "displayName": "Linux clang debug", "inherits": "linux-clang", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE": "Debug", + "MAPNIK_DEBUG": "ON" } }, { @@ -50,7 +51,8 @@ "displayName": "Linux gcc debug", "inherits": "linux-gcc", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE": "Debug", + "MAPNIK_DEBUG": "ON" } }, { @@ -64,6 +66,7 @@ { "name": "windows-default", "displayName": "Windows x64 Debug", + "hidden": true, "generator": "Ninja", "binaryDir": "${sourceDir}/build/${presetName}", "architecture": { @@ -75,9 +78,9 @@ "strategy": "external" }, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl" + "CMAKE_CXX_COMPILER": "cl", + "MAPNIK_DEBUG": "ON" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { @@ -87,6 +90,14 @@ } } }, + { + "name": "windows-default-debug", + "displayName": "Windows x64 Debug", + "inherits": "windows-default", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, { "name": "windows-default-release", "displayName": "Windows x64 Release", From 01516c9603d27770f74bd3b793fcedf7810d871b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 22:56:00 +0200 Subject: [PATCH 122/141] fix --- CMakePresets.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 1c735bb7f..c14827bae 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -79,8 +79,7 @@ }, "cacheVariables": { "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "MAPNIK_DEBUG": "ON" + "CMAKE_CXX_COMPILER": "cl" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { @@ -95,7 +94,8 @@ "displayName": "Windows x64 Debug", "inherits": "windows-default", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE": "Debug", + "MAPNIK_DEBUG": "ON" } }, { From 54e63dd9fe8e958d818f6e9d643a90976b9f17c4 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Thu, 22 Jul 2021 23:05:48 +0200 Subject: [PATCH 123/141] some docs --- docs/cmake-usage.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index cd99ff2fd..da8f0468b 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -54,16 +54,18 @@ This could look like this: "configurePresets": [ { "name": "vcpkg-x64-win-debug", - "inherits": "windows-default", + "inherits": "windows-default-debug", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake" + "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake", + "ADDITIONAL_LIBARIES_PATHS":"D:/dev/vcpkg/x64-windows/debug/bin" } }, { "name": "vcpkg-x64-win-release", "inherits": "windows-default-release", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake" + "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake", + "ADDITIONAL_LIBARIES_PATHS":"D:/dev/vcpkg/x64-windows/bin" } } ] From 72600b996e69f156477cde6a4e14310fee78bc27 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 13:34:49 +0200 Subject: [PATCH 124/141] added missing options --- CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++++++ CMakePresets.json | 12 +++++++++--- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 456dc4be9..a2f3945df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,15 @@ option(USE_SVG_RENDERER "adds svg renderer" ON) option(USE_BIGINT "uses 64 bit instead of 32" ON) option(USE_MEMORY_MAPPED_FILE "uses file cache" ON) option(USE_MULTITHREADED "enables the multithreaded features (threadsafe)" ON) +option(USE_NO_ATEXIT "disable atexit" OFF) +option(USE_NO_DLCLOSE "disable dlclose" OFF) +option(USE_DEBUG_OUTPUT "enables some debug messages for development" OFF) +option(USE_LOG "enables logging output. See log severity level." OFF) +# 0 = debug +# 1 = warn +# 2 = error +# 3 = none +set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON") option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) @@ -71,6 +80,7 @@ option(BUILD_UTILITY_SHAPEINDEX "builds the utility program shapeindex" ON) option(BUILD_UTILITY_SVG2PNG "builds the utility program svg2png" ON) option(USE_BOOST_REGEX_ICU_WORKAROUND "if you don't use your system libraries and get double linked icu libraries set this to ON" OFF) +option(USE_GLIBC_WORKAROUND "see https://github.com/mapnik/mapnik/pull/3792 if you building with libstdc++-4.9" OFF) set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++14 is minimum.") message(STATUS "Using c++${CMAKE_CXX_STANDARD}") @@ -135,6 +145,7 @@ mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost 1.61 REQUIRED COMPONENTS filesystem system regex) if(USE_BOOST_REGEX_ICU_WORKAROUND) + message(STATUS "using boost regex workaround") set_property(TARGET Boost::regex PROPERTY INTERFACE_LINK_LIBRARIES) endif() @@ -218,6 +229,11 @@ endif() set_property(GLOBAL PROPERTY TARGETS "") set_property(GLOBAL PROPERTY PLUGINS "") +if(USE_GLIBC_WORKAROUND) + message("using glibc workaround") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_ENABLE_GLIBC_WORKAROUND) +endif() + if(USE_BIGINT) message(STATUS "uses BIGINT") list(APPEND MAPNIK_COMPILE_DEFS BIGINT) @@ -228,6 +244,27 @@ if(USE_MEMORY_MAPPED_FILE) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE) endif() +if(USE_NO_ATEXIT) + message(STATUS "uses MAPNIK_NO_ATEXIT") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_NO_ATEXIT) +endif() + +if(USE_NO_DLCLOSE) + message(STATUS "uses MAPNIK_NO_DLCLOSE") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_NO_DLCLOSE) +endif() + +if(USE_DEBUG_OUTPUT) + message(STATUS "enabled debug outputs") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_DEBUG) +endif() + +if(USE_LOG) + message(STATUS "logging enabled with level ${USE_LOG_SEVERITY}") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_LOG) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_DEFAULT_LOG_SEVERITY=${USE_LOG_SEVERITY}) +endif() + if(USE_LIBXML2) mapnik_find_package(LibXml2 REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_LIBXML2) diff --git a/CMakePresets.json b/CMakePresets.json index c14827bae..df911080d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -25,7 +25,9 @@ "inherits": "linux-clang", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "MAPNIK_DEBUG": "ON" + "USE_DEBUG_OUTPUT": "ON", + "USE_LOG": "ON", + "USE_LOG_SEVERITY": "0" } }, { @@ -52,7 +54,9 @@ "inherits": "linux-gcc", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "MAPNIK_DEBUG": "ON" + "USE_DEBUG_OUTPUT": "ON", + "USE_LOG": "ON", + "USE_LOG_SEVERITY": "0" } }, { @@ -95,7 +99,9 @@ "inherits": "windows-default", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "MAPNIK_DEBUG": "ON" + "USE_DEBUG_OUTPUT": "ON", + "USE_LOG": "ON", + "USE_LOG_SEVERITY": "0" } }, { From e2524f80df6eb23b7794070f60e88501dee08c45 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 15:48:17 +0200 Subject: [PATCH 125/141] rewrite webp to add debug libraries --- CMakeLists.txt | 2 +- cmake/FindWebP.cmake | 199 +++++++++++++------------------------------ 2 files changed, 61 insertions(+), 140 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2f3945df..36d90ecab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,7 +292,7 @@ endif() if(USE_WEBP) mapnik_find_package(WebP REQUIRED) list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP) - list(APPEND MAPNIK_OPTIONAL_LIBS WebP::libwebp) + list(APPEND MAPNIK_OPTIONAL_LIBS WebP::WebP) endif() if(USE_CAIRO) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake index c93e78ceb..d36d1879f 100644 --- a/cmake/FindWebP.cmake +++ b/cmake/FindWebP.cmake @@ -1,166 +1,87 @@ -# Copyright (C) 2020 Sony Interactive Entertainment Inc. -# Copyright (C) 2012 Raphael Kubo da Costa -# Copyright (C) 2013 Igalia S.L. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS -# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. #[=======================================================================[.rst: FindWebP --------------- +------- -Find WebP headers and libraries. +Finds the WebP library. Imported Targets ^^^^^^^^^^^^^^^^ -``WebP::libwebp`` - The WebP library, if found. +This module provides the following imported targets, if found: -``WebP::demux`` - The WebP demux library, if found. +``WebP::WebP`` + The WebP library Result Variables ^^^^^^^^^^^^^^^^ -This will define the following variables in your project: +This will define the following variables: ``WebP_FOUND`` - true if (the requested version of) WebP is available. + True if the system has the WebP library. ``WebP_VERSION`` - the version of WebP. -``WebP_LIBRARIES`` - the libraries to link against to use WebP. + The version of the WebP library which was found. ``WebP_INCLUDE_DIRS`` - where to find the WebP headers. -``WebP_COMPILE_OPTIONS`` - this should be passed to target_compile_options(), if the - target is not used for linking + Include directories needed to use WebP. +``WebP_LIBRARIES`` + Libraries needed to link to WebP. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``WebP_INCLUDE_DIR`` + The directory containing ``decode.h``. +``WebP_LIBRARY`` + The path to the Foo library. #]=======================================================================] -find_package(PkgConfig QUIET) -pkg_check_modules(PC_WEBP QUIET libwebp) -set(WebP_COMPILE_OPTIONS ${PC_WEBP_CFLAGS_OTHER}) -set(WebP_VERSION ${PC_WEBP_CFLAGS_VERSION}) - -find_path(WebP_INCLUDE_DIR - NAMES webp/decode.h - HINTS ${PC_WEBP_INCLUDEDIR} ${PC_WEBP_INCLUDE_DIRS} -) - -find_library(WebP_LIBRARY - NAMES ${WebP_NAMES} webp - HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS} -) - -# There's nothing in the WebP headers that could be used to detect the exact -# WebP version being used so don't attempt to do so. A version can only be found -# through pkg-config -if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}") - if (WebP_VERSION) - message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${WebP_VERSION} ")") - else () - message(WARNING "Cannot determine WebP version without pkg-config") - endif () -endif () - -# Find components -if (WebP_INCLUDE_DIR AND WebP_LIBRARY) - set(_WebP_REQUIRED_LIBS_FOUND ON) - set(WebP_LIBS_FOUND "WebP (required): ${WebP_LIBRARY}") -else () - set(_WebP_REQUIRED_LIBS_FOUND OFF) - set(WebP_LIBS_NOT_FOUND "WebP (required)") -endif () - -if ("demux" IN_LIST WebP_FIND_COMPONENTS) - find_library(WebP_DEMUX_LIBRARY - NAMES ${WebP_DEMUX_NAMES} webpdemux - HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS} - ) - - if (WebP_DEMUX_LIBRARY) - if (WebP_FIND_REQUIRED_demux) - list(APPEND WebP_LIBS_FOUND "demux (required): ${WebP_DEMUX_LIBRARY}") - else () - list(APPEND WebP_LIBS_FOUND "demux (optional): ${WebP_DEMUX_LIBRARY}") - endif () - else () - if (WebP_FIND_REQUIRED_demux) - set(_WebP_REQUIRED_LIBS_FOUND OFF) - list(APPEND WebP_LIBS_NOT_FOUND "demux (required)") - else () - list(APPEND WebP_LIBS_NOT_FOUND "demux (optional)") - endif () - endif () -endif () - -if (NOT WebP_FIND_QUIETLY) - if (WebP_LIBS_FOUND) - message(STATUS "Found the following WebP libraries:") - foreach (found ${WebP_LIBS_FOUND}) - message(STATUS " ${found}") - endforeach () - endif () - if (WebP_LIBS_NOT_FOUND) - message(STATUS "The following WebP libraries were not found:") - foreach (found ${WebP_LIBS_NOT_FOUND}) - message(STATUS " ${found}") - endforeach () - endif () -endif () +if(NOT WebP_LIBRARY) + find_package(PkgConfig QUIET) + pkg_check_modules(PC_WebP QUIET libwebp) + find_path(WebP_INCLUDE_DIR NAMES decode.h HINTS ${PC_WebP_INCLUDEDIR} ${PC_WebP_INCLUDE_DIR} PATH_SUFFIXES webp) + find_library(WebP_LIBRARY_RELEASE NAMES ${WebP_NAMES} webp HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS}) + find_library(WebP_LIBRARY_DEBUG NAMES ${WebP_NAMES} webpd HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS}) + include(SelectLibraryConfigurations) + select_library_configurations(WebP) +else() + file(TO_CMAKE_PATH "${WebP_LIBRARY}" WebP_LIBRARY) +endif() include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WebP - FOUND_VAR WebP_FOUND - REQUIRED_VARS WebP_INCLUDE_DIR WebP_LIBRARY _WebP_REQUIRED_LIBS_FOUND - VERSION_VAR WebP_VERSION -) - -if (WebP_LIBRARY AND NOT TARGET WebP::libwebp) - add_library(WebP::libwebp UNKNOWN IMPORTED GLOBAL) - set_target_properties(WebP::libwebp PROPERTIES - IMPORTED_LOCATION "${WebP_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${WebP_COMPILE_OPTIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIR}" - ) -endif () - -if (WebP_DEMUX_LIBRARY AND NOT TARGET WebP::demux) - add_library(WebP::demux UNKNOWN IMPORTED GLOBAL) - set_target_properties(WebP::demux PROPERTIES - IMPORTED_LOCATION "${WebP_DEMUX_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${WebP_COMPILE_OPTIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${WebP_INCLUDE_DIR}" - ) -endif () - -mark_as_advanced( - WebP_INCLUDE_DIR +find_package_handle_standard_args(WebP + REQUIRED_VARS WebP_LIBRARY - WebP_DEMUX_LIBRARY + WebP_INCLUDE_DIR ) +mark_as_advanced(WebP_INCLUDE_DIR WebP_LIBRARY) if (WebP_FOUND) - set(WebP_LIBRARIES ${WebP_LIBRARY} ${WebP_DEMUX_LIBRARY}) - set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR}) + set(WebP_LIBRARIES ${WebP_LIBRARY}) + set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR}) + if(NOT TARGET WebP::WebP) + add_library(WebP::WebP UNKNOWN IMPORTED) + set_target_properties(WebP::WebP PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${WebP_INCLUDE_DIR} + IMPORTED_LINK_INTERFACE_LANGUAGES C) + + if(WebP_LIBRARY_RELEASE) + set_property(TARGET WebP::WebP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION_RELEASE "${WebP_LIBRARY_RELEASE}") + endif() + + if(WebP_LIBRARY_DEBUG) + set_property(TARGET WebP::WebP APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION_DEBUG "${WebP_LIBRARY_DEBUG}") + endif() + + if(NOT WebP_LIBRARY_RELEASE AND NOT WebP_LIBRARY_DEBUG) + set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION "${WebP_LIBRARY}") + endif() + endif() endif () From 42fec3178404f5b33d53a4900d3ba9e198f7ee65 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 15:54:51 +0200 Subject: [PATCH 126/141] add version again to FindWebP --- cmake/FindWebP.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake index d36d1879f..6967f0305 100644 --- a/cmake/FindWebP.cmake +++ b/cmake/FindWebP.cmake @@ -44,6 +44,7 @@ The following cache variables may also be set: if(NOT WebP_LIBRARY) find_package(PkgConfig QUIET) pkg_check_modules(PC_WebP QUIET libwebp) + set(WebP_VERSION ${PC_WebP_VERSION}) find_path(WebP_INCLUDE_DIR NAMES decode.h HINTS ${PC_WebP_INCLUDEDIR} ${PC_WebP_INCLUDE_DIR} PATH_SUFFIXES webp) find_library(WebP_LIBRARY_RELEASE NAMES ${WebP_NAMES} webp HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS}) find_library(WebP_LIBRARY_DEBUG NAMES ${WebP_NAMES} webpd HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS}) @@ -53,11 +54,20 @@ else() file(TO_CMAKE_PATH "${WebP_LIBRARY}" WebP_LIBRARY) endif() +if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}") + if (WebP_VERSION) + message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${PC_WebP_VERSION} ")") + else () + message(WARNING "Cannot determine WebP version without pkg-config") + endif () +endif () + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(WebP REQUIRED_VARS WebP_LIBRARY WebP_INCLUDE_DIR + WebP_VERSION ) mark_as_advanced(WebP_INCLUDE_DIR WebP_LIBRARY) From 6739c3094137fa4f62ba2a8a8f3b9145481c013e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 16:04:25 +0200 Subject: [PATCH 127/141] fixed some var refs --- cmake/MapnikInstall.cmake | 6 +++--- utils/ogrindex/CMakeLists.txt | 10 +--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/cmake/MapnikInstall.cmake b/cmake/MapnikInstall.cmake index 6f0cfd553..5e9cd1349 100644 --- a/cmake/MapnikInstall.cmake +++ b/cmake/MapnikInstall.cmake @@ -4,20 +4,20 @@ function(mapnik_install) set(multiValueArgs) cmake_parse_arguments(MAPNIK_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND NOT ${MAPNIK_INSTALL_IS_PLUGIN}) + if(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND NOT MAPNIK_INSTALL_IS_PLUGIN) install(TARGETS ${MAPNIK_INSTALL_TARGET} LIBRARY DESTINATION ${MAPNIK_LIB_DIR} ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} RUNTIME DESTINATION ${MAPNIK_BIN_DIR} ) - elseif(NOT ${MAPNIK_INSTALL_ALREADY_INSTALLED} AND ${MAPNIK_INSTALL_IS_PLUGIN}) + elseif(NOT MAPNIK_INSTALL_ALREADY_INSTALLED AND MAPNIK_INSTALL_IS_PLUGIN) install(TARGETS ${MAPNIK_INSTALL_TARGET} LIBRARY DESTINATION ${PLUGINS_INSTALL_DIR} ARCHIVE DESTINATION ${PLUGINS_INSTALL_DIR} RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR} ) endif() - if(NOT ${MAPNIK_INSTALL_IS_PLUGIN}) + if(NOT MAPNIK_INSTALL_IS_PLUGIN) message(STATUS "${MAPNIK_INSTALL_TARGET}") get_target_property(TARGET_TYPE "${MAPNIK_INSTALL_TARGET}" TYPE) if (TARGET_TYPE STREQUAL "EXECUTABLE") diff --git a/utils/ogrindex/CMakeLists.txt b/utils/ogrindex/CMakeLists.txt index afc13541b..771b2c592 100644 --- a/utils/ogrindex/CMakeLists.txt +++ b/utils/ogrindex/CMakeLists.txt @@ -2,14 +2,6 @@ project(ogrindex) add_executable(ogrindex ogrindex.cpp) - target_link_libraries(ogrindex PRIVATE mapnik::core mapnik::mapnik) -install(TARGETS ogrindex - EXPORT MapnikTargets - LIBRARY DESTINATION ${MAPNIK_LIB_DIR} - ARCHIVE DESTINATION ${MAPNIK_ARCHIVE_DIR} - RUNTIME DESTINATION ${MAPNIK_BIN_DIR} -) - -mapnik_install(TARGET mapnik-ogrindex) +mapnik_install(TARGET ogrindex) From 08791f496d5632222c6a359abdeb4262b17486c9 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 16:10:35 +0200 Subject: [PATCH 128/141] add MAPNIK_STATS --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36d90ecab..ef7bb19af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ option(USE_LOG "enables logging output. See log severity level." OFF) # 2 = error # 3 = none set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON") +option(USE_STATS "Enable statistics reporting" OFF) option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) @@ -261,8 +262,12 @@ endif() if(USE_LOG) message(STATUS "logging enabled with level ${USE_LOG_SEVERITY}") - list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_LOG) - list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_DEFAULT_LOG_SEVERITY=${USE_LOG_SEVERITY}) + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_LOG MAPNIK_DEFAULT_LOG_SEVERITY=${USE_LOG_SEVERITY}) +endif() + +if(USE_STATS) + message(STATUS "adding statistics") + list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATS) endif() if(USE_LIBXML2) From f90c6844719f78e6a15d795403dbe7920954bb73 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 16:41:28 +0200 Subject: [PATCH 129/141] add missing generator to CMakePresets --- CMakePresets.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index df911080d..8f3d84f0d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -11,6 +11,7 @@ "displayName": "Linux clang", "hidden": true, "binaryDir": "${sourceDir}/build/${presetName}", + "generator": "Ninja", "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", @@ -43,6 +44,7 @@ "displayName": "Linux gcc", "hidden": true, "binaryDir": "${sourceDir}/build/${presetName}", + "generator": "Ninja", "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++" @@ -115,8 +117,12 @@ ], "buildPresets": [ { - "name": "default", - "configurePreset": "default" + "name": "windows-default", + "configurePreset": "windows-default-debug" + }, + { + "name": "linux-default", + "configurePreset": "linux-clang-debug" } ] } From ac6842656e22f8a04299eca394f6c8fc7af8a9ef Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 17:06:24 +0200 Subject: [PATCH 130/141] enable qt6 or qt5 for mapnik-viewer. android could be dropped --- demo/viewer/CMakeLists.txt | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 01fab3db8..790bcb33b 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -1,8 +1,9 @@ project(mapnik-viewer) -find_package(Qt5 COMPONENTS Widgets REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) -add_executable(mapnik-viewer +set(PROJECT_SOURCES about_dialog.cpp info_dialog.cpp layerdelegate.cpp @@ -19,6 +20,23 @@ add_executable(mapnik-viewer mapnik_viewer.qrc ) +if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) + qt_add_executable(mapnik-viewer + MANUAL_FINALIZATION + ${PROJECT_SOURCES} + ) +else() + if(ANDROID) + add_library(mapnik-viewer SHARED + ${PROJECT_SOURCES} + ) + else() + add_executable(mapnik-viewer + ${PROJECT_SOURCES} + ) + endif() +endif() + set_target_properties(mapnik-viewer PROPERTIES AUTOUIC_SEARCH_PATHS forms AUTORCC ON @@ -26,18 +44,23 @@ set_target_properties(mapnik-viewer PROPERTIES AUTOMOC ON ) - target_link_libraries(mapnik-viewer PRIVATE - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets mapnik::core mapnik::agg mapnik::mapnik ) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini "[mapnik] plugins_dir=${PLUGINS_INSTALL_DIR} fonts/1/dir=${FONTS_INSTALL_DIR}" ) + +if(QT_VERSION_MAJOR EQUAL 6) + qt_finalize_executable(mapnik-viewer) +endif() + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini DESTINATION bin) mapnik_install(TARGET mapnik-viewer) From f80a7724bfddd333fce8204628cde6827ad5710d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 18:14:37 +0200 Subject: [PATCH 131/141] delete clang toolchain(replaced by CMakePresets) --- cmake/clang.cmake | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 cmake/clang.cmake diff --git a/cmake/clang.cmake b/cmake/clang.cmake deleted file mode 100644 index 93aa0c73f..000000000 --- a/cmake/clang.cmake +++ /dev/null @@ -1,6 +0,0 @@ -set(CMAKE_C_COMPILER clang) -set(CMAKE_CXX_COMPILER clang++) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") From 02fed920742c13772e1724c4f292ba403892f8e3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 19:34:17 +0200 Subject: [PATCH 132/141] link with correct lib (clang) --- CMakePresets.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 8f3d84f0d..06a43f192 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -15,9 +15,9 @@ "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_CXX_FLAGS": "-stdlib=libstdc++", - "CMAKE_EXE_LINKER_FLAGS": "-stdlib=libstdc++", - "CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libstdc++" + "CMAKE_CXX_FLAGS": "-stdlib=libc++", + "CMAKE_EXE_LINKER_FLAGS": "-stdlib=libc++", + "CMAKE_SHARED_LINKER_FLAGS": "-stdlib=libc++" } }, { From 001718cf733f607a9eb374824b2a046985008930 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 18:39:42 +0200 Subject: [PATCH 133/141] some fixes for FindWebP --- cmake/FindWebP.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake index 6967f0305..e966a0cf8 100644 --- a/cmake/FindWebP.cmake +++ b/cmake/FindWebP.cmake @@ -64,10 +64,11 @@ endif () include(FindPackageHandleStandardArgs) find_package_handle_standard_args(WebP + FOUND_VAR WebP_FOUND REQUIRED_VARS WebP_LIBRARY WebP_INCLUDE_DIR - WebP_VERSION + VERSION_VAR WebP_VERSION ) mark_as_advanced(WebP_INCLUDE_DIR WebP_LIBRARY) From 6b5e4dcec23ee6671d94b65b7b9bd19bf4d79647 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 18:40:57 +0200 Subject: [PATCH 134/141] found var was deprecated. --- CMakeLists.txt | 10 +++++----- cmake/FindWebP.cmake | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef7bb19af..6a4db8e44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,9 +308,9 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ QUIET) + mapnik_find_package(PROJ4 QUIET) # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config - if(NOT PROJ_FOUND) + if(NOT PROJ4_FOUND) message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}") @@ -318,11 +318,11 @@ if(USE_PROJ) set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}") set(PROJ_VERSION_PATCH "${CMAKE_MATCH_3}") endif() - math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake index e966a0cf8..57c9e94e9 100644 --- a/cmake/FindWebP.cmake +++ b/cmake/FindWebP.cmake @@ -63,8 +63,7 @@ if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}") endif () include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WebP - FOUND_VAR WebP_FOUND +find_package_handle_standard_args(WebP REQUIRED_VARS WebP_LIBRARY WebP_INCLUDE_DIR From fcda7021b60677d76c4d22c91bc3e841555d6d74 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 18:41:07 +0200 Subject: [PATCH 135/141] Revert "found var was deprecated." This reverts commit 6b5e4dcec23ee6671d94b65b7b9bd19bf4d79647. --- CMakeLists.txt | 10 +++++----- cmake/FindWebP.cmake | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a4db8e44..ef7bb19af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,9 +308,9 @@ endif() if(USE_PROJ) #https://proj.org/development/cmake.html - mapnik_find_package(PROJ4 QUIET) + mapnik_find_package(PROJ QUIET) # currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config - if(NOT PROJ4_FOUND) + if(NOT PROJ_FOUND) message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...") pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj) string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}") @@ -318,11 +318,11 @@ if(USE_PROJ) set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}") set(PROJ_VERSION_PATCH "${CMAKE_MATCH_3}") endif() - math(EXPR MAPNIK_PROJ_VERSION "${PROJ4_VERSION_MAJOR}*10000 + ${PROJ4_VERSION_MINOR}*100 + ${PROJ4_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + math(EXPR MAPNIK_PROJ_VERSION "${PROJ_VERSION_MAJOR}*10000 + ${PROJ_VERSION_MINOR}*100 + ${PROJ_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) message(STATUS "Using mapnik PROJ version: ${MAPNIK_PROJ_VERSION}") list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_USE_PROJ MAPNIK_PROJ_VERSION=${MAPNIK_PROJ_VERSION}) - list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ4_LIBRARIES}) - list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ4_INCLUDE_DIRS}) + list(APPEND MAPNIK_OPTIONAL_LIBS ${PROJ_LIBRARIES}) + list(APPEND MAPNIK_OPTIONAL_LIBS_INCLUDE ${PROJ_INCLUDE_DIRS}) endif() if(USE_GRID_RENDERER) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake index 57c9e94e9..e966a0cf8 100644 --- a/cmake/FindWebP.cmake +++ b/cmake/FindWebP.cmake @@ -63,7 +63,8 @@ if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}") endif () include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(WebP +find_package_handle_standard_args(WebP + FOUND_VAR WebP_FOUND REQUIRED_VARS WebP_LIBRARY WebP_INCLUDE_DIR From a8d6bdcac1be7f8b7fb2ee584f3115ca875d8c96 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 23 Jul 2021 18:41:30 +0200 Subject: [PATCH 136/141] [FindWebP] FOUND_VAR is deprecated --- cmake/FindWebP.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/FindWebP.cmake b/cmake/FindWebP.cmake index e966a0cf8..860dc3dfe 100644 --- a/cmake/FindWebP.cmake +++ b/cmake/FindWebP.cmake @@ -64,7 +64,6 @@ endif () include(FindPackageHandleStandardArgs) find_package_handle_standard_args(WebP - FOUND_VAR WebP_FOUND REQUIRED_VARS WebP_LIBRARY WebP_INCLUDE_DIR From 8500b3cd69b7711ca6828cd620811bde8fd0964e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 24 Jul 2021 00:58:28 +0200 Subject: [PATCH 137/141] remove not needed include of --- include/mapnik/css/css_color_grammar_x3_def.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/mapnik/css/css_color_grammar_x3_def.hpp b/include/mapnik/css/css_color_grammar_x3_def.hpp index e42c02470..5db0d9c92 100644 --- a/include/mapnik/css/css_color_grammar_x3_def.hpp +++ b/include/mapnik/css/css_color_grammar_x3_def.hpp @@ -430,7 +430,6 @@ auto const css_color_def = hsla_color ; -#include MAPNIK_DISABLE_WARNING_PUSH #include BOOST_SPIRIT_DEFINE( From 83e77559c495e622cca96813d7f144e3d19bdf26 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 13 Aug 2021 17:21:46 +0200 Subject: [PATCH 138/141] update cmake docs --- docs/cmake-usage.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index da8f0468b..22ff34086 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -56,16 +56,16 @@ This could look like this: "name": "vcpkg-x64-win-debug", "inherits": "windows-default-debug", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake", - "ADDITIONAL_LIBARIES_PATHS":"D:/dev/vcpkg/x64-windows/debug/bin" + "CMAKE_TOOLCHAIN_FILE": "/scripts/buildsystems/vcpkg.cmake", + "ADDITIONAL_LIBARIES_PATHS":"/installed/x64-windows/debug/bin" } }, { "name": "vcpkg-x64-win-release", "inherits": "windows-default-release", "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake", - "ADDITIONAL_LIBARIES_PATHS":"D:/dev/vcpkg/x64-windows/bin" + "CMAKE_TOOLCHAIN_FILE": "/scripts/buildsystems/vcpkg.cmake", + "ADDITIONAL_LIBARIES_PATHS":"/installed/x64-windows/bin" } } ] From 4b4cfca706633f6302b504a829557da1d6c15332 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 13 Aug 2021 20:41:30 +0200 Subject: [PATCH 139/141] copy all plugins to the viewer build dir --- demo/viewer/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/demo/viewer/CMakeLists.txt b/demo/viewer/CMakeLists.txt index 790bcb33b..9f866d707 100644 --- a/demo/viewer/CMakeLists.txt +++ b/demo/viewer/CMakeLists.txt @@ -70,3 +70,10 @@ mapnik_copy_dependencies( PLUGINS input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson ) + +mapnik_copy_plugins(TARGET mapnik-viewer + DESTINATION + ${PLUGINS_INSTALL_DIR} + PLUGINS + input-csv input-gdal input-geobuf input-geojson input-ogr input-pgraster input-postgis input-raster input-shape input-sqlite input-topojson +) From 02180115bfb0fa91e45b02d48cd54c37865079d7 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Aug 2021 16:41:57 +0200 Subject: [PATCH 140/141] some last minor improvements --- CMakeLists.txt | 2 +- CMakePresets.json | 164 ++++++++++++++++++++++++++-------------- docs/cmake-usage.md | 6 ++ src/CMakeLists.txt | 15 ++-- src/json/CMakeLists.txt | 3 +- src/wkt/CMakeLists.txt | 3 +- 6 files changed, 127 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef7bb19af..4c6ba296b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ include(MapnikCopyDependencies) include(MapnikInstall) set(ADDITIONAL_LIBARIES_PATHS "" CACHE STRING "only used on windows. Pass directories containing the dlls that are missing. You can ignore this, if the build (verify_app step) runs successfully") -option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" ON) +option(COPY_LIBRARIES_FOR_EXECUTABLES "copies required shared libaries (only windows) to the executable build directory" OFF) option(COPY_FONTS_AND_PLUGINS_FOR_EXECUTABLES "copies required plugins and fonts into the executable build directory" ON) option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON) diff --git a/CMakePresets.json b/CMakePresets.json index 06a43f192..5f2a874f0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -7,11 +7,41 @@ }, "configurePresets": [ { - "name": "linux-clang", - "displayName": "Linux clang", + "name": "use-ninja", "hidden": true, - "binaryDir": "${sourceDir}/build/${presetName}", - "generator": "Ninja", + "generator": "Ninja" + }, + { + "name": "default-build-dir", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}" + }, + { + "name": "debug-build", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "USE_DEBUG_OUTPUT": "ON", + "USE_LOG": "ON", + "USE_LOG_SEVERITY": "0" + } + }, + { + "name": "release-build", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "USE_DEBUG_OUTPUT": "OFF", + "USE_LOG": "OFF" + } + }, + { + "name": "use-clang", + "hidden": true, + "inherits": [ + "default-build-dir", + "use-ninja" + ], "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", @@ -21,60 +51,76 @@ } }, { - "name": "linux-clang-debug", - "displayName": "Linux clang debug", - "inherits": "linux-clang", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "USE_DEBUG_OUTPUT": "ON", - "USE_LOG": "ON", - "USE_LOG_SEVERITY": "0" - } - }, - { - "name": "linux-clang-release", - "displayName": "Linux clang release", - "inherits": "linux-clang", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "linux-gcc", - "displayName": "Linux gcc", + "name": "use-gcc", "hidden": true, - "binaryDir": "${sourceDir}/build/${presetName}", - "generator": "Ninja", + "inherits": [ + "default-build-dir", + "use-ninja" + ], "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++" } }, + { + "name": "use-msvc-cl", + "hidden": true, + "inherits": [ + "default-build-dir", + "use-ninja" + ], + "cacheVariables": { + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl" + } + }, + { + "name": "use-msvc-clang-cl", + "hidden": true, + "inherits": [ + "default-build-dir", + "use-ninja" + ], + "cacheVariables": { + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + } + }, + { + "name": "linux-clang-debug", + "displayName": "Linux clang debug", + "inherits": [ + "use-clang", + "debug-build" + ] + }, + { + "name": "linux-clang-release", + "displayName": "Linux clang release", + "inherits": [ + "use-clang", + "release-build" + ] + }, { "name": "linux-gcc-debug", "displayName": "Linux gcc debug", - "inherits": "linux-gcc", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "USE_DEBUG_OUTPUT": "ON", - "USE_LOG": "ON", - "USE_LOG_SEVERITY": "0" - } + "inherits": [ + "use-gcc", + "debug-build" + ] }, { "name": "linux-gcc-release", "displayName": "Linux gcc release", - "inherits": "linux-gcc", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } + "inherits": [ + "use-gcc", + "release-build" + ] }, { - "name": "windows-default", - "displayName": "Windows x64 Debug", + "name": "windows-arch-x64", "hidden": true, - "generator": "Ninja", - "binaryDir": "${sourceDir}/build/${presetName}", "architecture": { "value": "x64", "strategy": "external" @@ -82,11 +128,16 @@ "toolset": { "value": "host=x64", "strategy": "external" - }, - "cacheVariables": { - "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl" - }, + } + }, + { + "name": "windows-default", + "displayName": "Windows x64 Debug", + "hidden": true, + "inherits": [ + "use-msvc-cl", + "windows-arch-x64" + ], "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ @@ -98,21 +149,18 @@ { "name": "windows-default-debug", "displayName": "Windows x64 Debug", - "inherits": "windows-default", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "USE_DEBUG_OUTPUT": "ON", - "USE_LOG": "ON", - "USE_LOG_SEVERITY": "0" - } + "inherits": [ + "windows-default", + "debug-build" + ] }, { "name": "windows-default-release", "displayName": "Windows x64 Release", - "inherits": "windows-default", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } + "inherits": [ + "windows-default", + "release-build" + ] } ], "buildPresets": [ diff --git a/docs/cmake-usage.md b/docs/cmake-usage.md index 22ff34086..f3cfbcf05 100644 --- a/docs/cmake-usage.md +++ b/docs/cmake-usage.md @@ -96,3 +96,9 @@ If your libraries are not in the global search paths, you could add a own `CMake ] } ``` + +Build with: +``` +$ cmake --preset +$ cmake --build --preset +``` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5de2a86e6..c2679f065 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,6 @@ 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 @@ -296,10 +292,19 @@ target_link_libraries(mapnik PRIVATE ) set_target_properties(mapnik PROPERTIES - DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} + DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" + OUTPUT_NAME "mapnik" PREFIX "lib" ) +if(MSVC) + # disable some msvc warnings and enable bigobj + # 4068 will warn about unknown definitions. Would not be needed if https://github.com/mapbox/geometry.hpp/pull/69 is merged. + # 4661 warns about enum definitions. should be investigated at some point + # 4910 warns about extern and dllexport at the same time. should be investigated at some point + target_compile_options(mapnik PUBLIC "/bigobj" "/wd4068" "/wd4661" "/wd4910") +endif() + install(TARGETS mapnik EXPORT MapnikTargets LIBRARY DESTINATION ${MAPNIK_LIB_DIR} diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 93f0baad7..0748d2043 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -25,8 +25,9 @@ target_include_directories(json PRIVATE target_link_libraries(json PRIVATE mapnik::core ${ICUU_LIB}) set_target_properties(json PROPERTIES - DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} POSITION_INDEPENDENT_CODE ON + DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" + OUTPUT_NAME "json" PREFIX "libmapnik-" ) diff --git a/src/wkt/CMakeLists.txt b/src/wkt/CMakeLists.txt index 7ef2255fa..9c0934290 100644 --- a/src/wkt/CMakeLists.txt +++ b/src/wkt/CMakeLists.txt @@ -17,8 +17,9 @@ target_include_directories(wkt PRIVATE target_link_libraries(wkt PRIVATE mapnik::core) set_target_properties(wkt PROPERTIES - DEBUG_POSTFIX ${MAPNIK_DEBUG_POSTFIX} POSITION_INDEPENDENT_CODE ON + DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" + OUTPUT_NAME "wkt" PREFIX "libmapnik-" ) From f40822980e9794649e40c9ffcfb1df8b9f0cae9d Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Wed, 25 Aug 2021 17:25:23 +0200 Subject: [PATCH 141/141] update to latest catch2 --- test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0e57e997d..a18720306 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,7 +9,7 @@ include(CopyDllsForDebug) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.13.3) + GIT_TAG v2.13.7) FetchContent_MakeAvailable(Catch2) # Prepare "Catch" library for other executables @@ -193,7 +193,7 @@ mapnik_copy_dependencies( file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) file(COPY data-visual DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test) -ParseAndAddCatchTests(mapnik-test-unit) +catch_discover_tests(mapnik-test-unit) catch_discover_tests(agg_rasterizer_integer_overflow_test) catch_discover_tests(datasource_registration_test) catch_discover_tests(font_registration_test)