diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index becd9cb6b..000000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -build -.vs -.vscode diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 480044ded..000000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: - - "**" - tags: - - "v*.*.*" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - submodules: "recursive" - - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - # list of Docker images to use as base name for tags - images: | - ghcr.io/mathisloge/mapnik - # generate Docker tags based on the following events/attributes - tags: | - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to GHCR - if: github.event_name != 'pull_request' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a9ccc26..578cbe08e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,11 @@ add_feature_info(BUILD_TESTING BUILD_TESTING "Adds tests") mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON) mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON) +mapnik_option(BUILD_SHARED_PLUGINS "build dynamic plugins" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option +if(WIN32 AND BUILD_SHARED_PLUGINS AND NOT BUILD_SHARED_LIBS) + message(FATAL_ERROR "static libmapnik and dynamic plugins won't work correctly") +endif() + mapnik_option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF) mapnik_option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF) mapnik_option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF) @@ -56,7 +61,6 @@ mapnik_option(USE_LOG "enables logging output. See log severity level." OFF) set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON") mapnik_option(USE_STATS "Enable statistics reporting" OFF) -mapnik_option(STATIC_PLUGINS "statically link plugins into libmapnik" OFF) mapnik_option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) mapnik_option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON) mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON) @@ -345,11 +349,9 @@ if(NOT WIN32) list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS}) endif() -if(MAPNIK_STATIC_PLUGINS) +if(NOT BUILD_SHARED_PLUGINS) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_PLUGINS) endif() - - # when building static, this have to be public so that all depending libs know about if(NOT BUILD_SHARED_LIBS) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_DEFINE) @@ -388,6 +390,7 @@ target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS}) mapnik_install(core) +### # forward declaring libraries to consume them when building static plugins (circle deps between mapnik <-> plugin_target) add_library(mapnik "") add_library(mapnik::mapnik ALIAS mapnik) @@ -396,6 +399,7 @@ add_library(mapnik::wkt ALIAS wkt) add_library(json STATIC "") add_library(mapnik::json ALIAS json) # end forward declaration +### add_subdirectory(deps) add_subdirectory(plugins) @@ -416,22 +420,22 @@ feature_summary(FILENAME "${CMAKE_CURRENT_BINARY_DIR}/packages.log" WHAT PACKAGE include(MapnikExport) include(MapnikExportPkgConfig) -install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) -install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) -install(DIRECTORY deps/mapnik DESTINATION ${MAPNIK_INCLUDE_DIR}) -install(DIRECTORY fonts/ DESTINATION ${FONTS_INSTALL_DIR} FILES_MATCHING PATTERN "*.py" EXCLUDE PATTERN "*") +install(DIRECTORY include/ DESTINATION "${MAPNIK_INCLUDE_DIR}") +install(DIRECTORY deps/agg/include/ DESTINATION "${MAPNIK_INCLUDE_DIR}") +install(DIRECTORY deps/mapnik DESTINATION "${MAPNIK_INCLUDE_DIR}") +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/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() if(NOT USE_EXTERNAL_MAPBOX_VARIANT) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ DESTINATION ${MAPNIK_INCLUDE_DIR}) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}") endif() mapnik_install_targets() diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1d7f7d1b3..000000000 --- a/Dockerfile +++ /dev/null @@ -1,41 +0,0 @@ -FROM ubuntu:21.04 -LABEL description="mapnik" - -ARG DEBIAN_FRONTEND=noninteractive - -RUN mkdir /app -COPY . /app -WORKDIR /app - -RUN apt update -RUN apt install -y gpg wget -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null -RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null -RUN apt update -RUN apt install -y \ - cmake \ - ninja-build \ - build-essential - -ENV BUILD_DEPENDENCIES="libicu-dev \ - libfreetype6-dev \ - libharfbuzz-dev \ - libxml2-dev \ - libjpeg-dev \ - libtiff-dev \ - libwebp-dev \ - libcairo2-dev \ - libproj-dev \ - libgdal-dev \ - libboost-filesystem-dev \ - libboost-program-options-dev \ - libboost-regex-dev \ - " - -RUN apt install -y $BUILD_DEPENDENCIES -RUN cmake --preset linux-gcc-release -DBUILD_DEMO_VIEWER=OFF -DBUILD_TESTING=OFF -DBUILD_DEMO_CPP=OFF -DBUILD_BENCHMARK=OFF -RUN cmake --build --preset linux-gcc-release -RUN cmake --build --preset linux-gcc-release --target install - -WORKDIR / -RUN rm -rf /app diff --git a/benchmark/include/bench_framework.hpp b/benchmark/include/bench_framework.hpp index 593931103..cc9439eee 100644 --- a/benchmark/include/bench_framework.hpp +++ b/benchmark/include/bench_framework.hpp @@ -2,6 +2,7 @@ #define MAPNIK_BENCH_FRAMEWORK_HPP // mapnik +#include #include #include #include @@ -124,6 +125,7 @@ inline int handle_args(int argc, char** argv, mapnik::parameters& params) #define BENCHMARK(test_class, name) \ int main(int argc, char** argv) \ { \ + mapnik::setup(); \ try \ { \ mapnik::parameters params; \ diff --git a/benchmark/src/normalize_angle.cpp b/benchmark/src/normalize_angle.cpp index fcfc7a5c2..97b6cdad1 100644 --- a/benchmark/src/normalize_angle.cpp +++ b/benchmark/src/normalize_angle.cpp @@ -30,6 +30,7 @@ struct bench_func : benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); return benchmark::sequencer(argc, argv) .BENCH_FUNC1(mapnik::util::normalize_angle, +3) .BENCH_FUNC1(mapnik::util::normalize_angle, +6) diff --git a/benchmark/src/test_array_allocation.cpp b/benchmark/src/test_array_allocation.cpp index 592a93d07..b80e9271f 100644 --- a/benchmark/src/test_array_allocation.cpp +++ b/benchmark/src/test_array_allocation.cpp @@ -349,6 +349,7 @@ class test7 : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); return benchmark::sequencer(argc, argv) .run("calloc") .run("malloc/memcpy") diff --git a/benchmark/src/test_expression_parse.cpp b/benchmark/src/test_expression_parse.cpp index d35a57ab2..956dcd39e 100644 --- a/benchmark/src/test_expression_parse.cpp +++ b/benchmark/src/test_expression_parse.cpp @@ -36,6 +36,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); test test_runner(params); diff --git a/benchmark/src/test_face_ptr_creation.cpp b/benchmark/src/test_face_ptr_creation.cpp index 4bbdf0301..64071c32f 100644 --- a/benchmark/src/test_face_ptr_creation.cpp +++ b/benchmark/src/test_face_ptr_creation.cpp @@ -59,6 +59,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); bool success = mapnik::freetype_engine::register_fonts("./fonts", true); diff --git a/benchmark/src/test_getline.cpp b/benchmark/src/test_getline.cpp index 305d1b530..b3ca0df7f 100644 --- a/benchmark/src/test_getline.cpp +++ b/benchmark/src/test_getline.cpp @@ -101,6 +101,7 @@ class test2 : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); int return_value = 0; try { diff --git a/benchmark/src/test_numeric_cast_vs_static_cast.cpp b/benchmark/src/test_numeric_cast_vs_static_cast.cpp index 542006910..b71c5bcf8 100644 --- a/benchmark/src/test_numeric_cast_vs_static_cast.cpp +++ b/benchmark/src/test_numeric_cast_vs_static_cast.cpp @@ -74,5 +74,6 @@ class test_numeric : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); return benchmark::sequencer(argc, argv).run("static_cast").run("numeric_cast").done(); } diff --git a/benchmark/src/test_offset_converter.cpp b/benchmark/src/test_offset_converter.cpp index 93988ce4c..e591d552f 100644 --- a/benchmark/src/test_offset_converter.cpp +++ b/benchmark/src/test_offset_converter.cpp @@ -92,6 +92,7 @@ class test_offset : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); int return_value = 0; diff --git a/benchmark/src/test_polygon_clipping.cpp b/benchmark/src/test_polygon_clipping.cpp index 9ec54f251..d8c3fce6d 100644 --- a/benchmark/src/test_polygon_clipping.cpp +++ b/benchmark/src/test_polygon_clipping.cpp @@ -510,6 +510,7 @@ expected_count << "\n"; valid = false; int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); diff --git a/benchmark/src/test_polygon_clipping_rendering.cpp b/benchmark/src/test_polygon_clipping_rendering.cpp index b0daba0c9..9c3e99b33 100644 --- a/benchmark/src/test_polygon_clipping_rendering.cpp +++ b/benchmark/src/test_polygon_clipping_rendering.cpp @@ -43,6 +43,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); mapnik::datasource_cache::instance().register_datasources("./plugins/input/"); diff --git a/benchmark/src/test_proj_transform1.cpp b/benchmark/src/test_proj_transform1.cpp index 96e338ceb..e179a671b 100644 --- a/benchmark/src/test_proj_transform1.cpp +++ b/benchmark/src/test_proj_transform1.cpp @@ -60,6 +60,7 @@ class test : public benchmark::test_case // echo -180 -60 | cs2cs -f "%.10f" epsg:4326 +to epsg:3857 int main(int argc, char** argv) { + mapnik::setup(); mapnik::box2d from(-180, -80, 180, 80); mapnik::box2d to(-20037508.3427892476, -15538711.0963092316, 20037508.3427892476, 15538711.0963092316); std::string from_str("epsg:4326"); diff --git a/benchmark/src/test_rendering.cpp b/benchmark/src/test_rendering.cpp index 0ba1fdff4..38cc9318a 100644 --- a/benchmark/src/test_rendering.cpp +++ b/benchmark/src/test_rendering.cpp @@ -95,6 +95,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); int return_value = 0; try { diff --git a/benchmark/src/test_rendering_shared_map.cpp b/benchmark/src/test_rendering_shared_map.cpp index 3d16f61fd..331033efc 100644 --- a/benchmark/src/test_rendering_shared_map.cpp +++ b/benchmark/src/test_rendering_shared_map.cpp @@ -150,6 +150,7 @@ class test : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); int return_value = 0; try { diff --git a/benchmark/src/test_utf_encoding.cpp b/benchmark/src/test_utf_encoding.cpp index badb0a661..c677541db 100644 --- a/benchmark/src/test_utf_encoding.cpp +++ b/benchmark/src/test_utf_encoding.cpp @@ -106,6 +106,7 @@ class test3 : public benchmark::test_case int main(int argc, char** argv) { + mapnik::setup(); mapnik::parameters params; benchmark::handle_args(argc, argv, params); int return_value = 0; diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index dc4f8e823..961b95a8f 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -20,6 +20,7 @@ * *****************************************************************************/ +#include #include #include #include @@ -52,7 +53,7 @@ int main(int, char**) "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs"; const std::string srs_merc = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 " "+units=m +nadgrids=@null +wktext +no_defs +over"; - + mapnik::setup(); try { std::cout << " running demo ... \n"; diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index 09e90fac3..9f5cd3dbe 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -23,12 +23,14 @@ #include #include #include +#include #include "mainwindow.hpp" int main(int argc, char** argv) { using mapnik::datasource_cache; using mapnik::freetype_engine; + mapnik::setup(); try { #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) diff --git a/include/mapnik/config.hpp b/include/mapnik/config.hpp index 27ada9b5e..312d72ffb 100644 --- a/include/mapnik/config.hpp +++ b/include/mapnik/config.hpp @@ -24,48 +24,40 @@ #define MAPNIK_CONFIG_HPP // Windows DLL support - +// clang-format off #ifdef _WIN32 #ifdef MAPNIK_STATIC_DEFINE -#define MAPNIK_DECL -#define MAPNIK_EXP +# define MAPNIK_DECL +# define MAPNIK_EXP #else -#define MAPNIK_EXP __declspec(dllexport) -#ifndef MAPNIK_DECL -#ifdef MAPNIK_EXPORTS -/* We are building this library */ -#define MAPNIK_DECL __declspec(dllexport) +# define MAPNIK_EXP __declspec(dllexport) +# ifndef MAPNIK_DECL +# ifdef MAPNIK_EXPORTS + /* We are building this library */ +# define MAPNIK_DECL __declspec(dllexport) +# else + /* We are using this library */ +# define MAPNIK_DECL __declspec(dllimport) +# endif +# endif +#endif +# pragma warning( disable: 4251 ) +# pragma warning( disable: 4275 ) +# if (_MSC_VER >= 1400) // vc8 +# pragma warning(disable : 4996) //_CRT_SECURE_NO_DEPRECATE +# endif #else -/* We are using this library */ -#define MAPNIK_DECL __declspec(dllimport) +# if __GNUC__ >= 4 +# define MAPNIK_EXP __attribute__ ((visibility ("default"))) +# define MAPNIK_DECL __attribute__ ((visibility ("default"))) +# define MAPNIK_IMP __attribute__ ((visibility ("default"))) +# else +# define MAPNIK_EXP +# define MAPNIK_DECL +# define MAPNIK_IMP +# endif #endif -#endif -#endif -#pragma warning(disable: 4251) -#pragma warning(disable: 4275) -#if (_MSC_VER >= 1400) // vc8 -#pragma warning(disable: 4996) //_CRT_SECURE_NO_DEPRECATE -#endif -#else -#define MAPNIK_DECL __declspec(dllimport) -#endif -#pragma warning(disable: 4251) -#pragma warning(disable: 4275) -#if (_MSC_VER >= 1400) // vc8 -#pragma warning(disable: 4996) //_CRT_SECURE_NO_DEPRECATE -#endif -#else -#if __GNUC__ >= 4 -#define MAPNIK_EXP __attribute__((visibility("default"))) -#define MAPNIK_DECL __attribute__((visibility("default"))) -#define MAPNIK_IMP __attribute__((visibility("default"))) -#else -#define MAPNIK_EXP -#define MAPNIK_DECL -#define MAPNIK_IMP -#endif -#endif - +// clang-format on #define PROJ_ENVELOPE_POINTS 20 #endif // MAPNIK_CONFIG_HPP diff --git a/include/mapnik/mapnik.hpp b/include/mapnik/mapnik.hpp new file mode 100644 index 000000000..e1545a48d --- /dev/null +++ b/include/mapnik/mapnik.hpp @@ -0,0 +1,9 @@ +#ifndef MAPNIK_MAPNIK_HPP +#define MAPNIK_MAPNIK_HPP +#include "config.hpp" + +namespace mapnik { +MAPNIK_DECL void setup(); +} + +#endif diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index 833b3c09e..9591c8181 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -26,12 +26,14 @@ // mapnik #include #include +#include // stl #include namespace mapnik { +DATASOURCE_PLUGIN_DEF(memory_datasource_plugin, memory) class MAPNIK_DECL memory_datasource : public datasource { friend class memory_featureset; diff --git a/include/mapnik/plugin.hpp b/include/mapnik/plugin.hpp index 46c06c421..b730a99c0 100644 --- a/include/mapnik/plugin.hpp +++ b/include/mapnik/plugin.hpp @@ -25,9 +25,9 @@ // mapnik #include - // stl #include +#include namespace mapnik { @@ -50,8 +50,7 @@ class PluginInfo : util::noncopyable private: std::string filename_; - std::string name_; - mapnik_lib_t* module_; + std::unique_ptr module_; }; } // namespace mapnik diff --git a/include/mapnik/warning.hpp b/include/mapnik/warning.hpp index 3ab29d16b..1c027026b 100644 --- a/include/mapnik/warning.hpp +++ b/include/mapnik/warning.hpp @@ -1,135 +1,137 @@ #ifndef MAPNIK_WARNING_HPP #define MAPNIK_WARNING_HPP +// clang-format off #if defined(_MSC_VER) -#define MAPNIK_DISABLE_WARNING_PUSH __pragma(warning(push)) -#define MAPNIK_DISABLE_WARNING_POP __pragma(warning(pop)) -#define MAPNIK_DISABLE_WARNING(warningNumber) __pragma(warning(disable : warningNumber)) - -// add warnings to deactivate here -// example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(4100) -#define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(4068) -#define MAPNIK_DISABLE_WARNING_PRAGMAS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNSEQUENCED // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SHADOW // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_CPP11_NARROWING // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SIGN_COMPARE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(4244) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_UNDEF // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(4996) -#define MAPNIK_DISABLE_WARNING_PADDED // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_WEAK_VTABLE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_EXTRA_SEMI // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_SWITCH_ENUM // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_MISSING_NORETURN // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_LONG_LONG // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE // MAPNIK_DISABLE_WARNING(??) -#define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(4101) -#define MAPNIK_DISABLE_MISMATCHED_TAGS // MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_PUSH __pragma(warning( push )) + #define MAPNIK_DISABLE_WARNING_POP __pragma(warning( pop )) + #define MAPNIK_DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber )) + // add warnings to deactivate here + // example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(4100) + #define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(4068) + #define MAPNIK_DISABLE_WARNING_PRAGMAS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNSEQUENCED //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SHADOW //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_CPP11_NARROWING //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SIGN_COMPARE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(4244) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_UNDEF //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(4996) + #define MAPNIK_DISABLE_WARNING_PADDED //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_WEAK_VTABLE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_EXTRA_SEMI //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_SWITCH_ENUM //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_MISSING_NORETURN //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_LONG_LONG //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE //MAPNIK_DISABLE_WARNING(??) + #define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(4101) + #define MAPNIK_DISABLE_MISMATCHED_TAGS //MAPNIK_DISABLE_WARNING(??) + #elif defined(__GNUC__) || defined(__clang__) -#define MAPNIK_DO_PRAGMA(X) _Pragma(#X) -#define MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DO_PRAGMA(GCC diagnostic push) -#define MAPNIK_DISABLE_WARNING_POP MAPNIK_DO_PRAGMA(GCC diagnostic pop) -#define MAPNIK_DISABLE_WARNING(warningName) MAPNIK_DO_PRAGMA(GCC diagnostic ignored #warningName) -// add warnings to deactivate here -// example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(-Wunused-parameter) -#define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(-Wunknown - pragmas) -#define MAPNIK_DISABLE_WARNING_PRAGMAS MAPNIK_DISABLE_WARNING(-Wpragmas) -#define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES MAPNIK_DISABLE_WARNING(-W #pragma - messages) -#define MAPNIK_DISABLE_WARNING_UNSEQUENCED MAPNIK_DISABLE_WARNING(-Wunsequenced) -#define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION MAPNIK_DISABLE_WARNING(-Wunused - function) -#define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER MAPNIK_DISABLE_WARNING(-Wunused - parameter) -#define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER MAPNIK_DISABLE_WARNING(-Wredeclared - class - member) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF MAPNIK_DISABLE_WARNING(-Wunused - local - typedef) -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS MAPNIK_DISABLE_WARNING(-Wunused - local - typedefs) -#define MAPNIK_DISABLE_WARNING_SHADOW MAPNIK_DISABLE_WARNING(-Wshadow) -#define MAPNIK_DISABLE_WARNING_CPP11_NARROWING MAPNIK_DISABLE_WARNING(-Wc++ 11 - narrowing) -#define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION MAPNIK_DISABLE_WARNING(-Wsign - conversion) -#define MAPNIK_DISABLE_WARNING_SIGN_COMPARE MAPNIK_DISABLE_WARNING(-Wsign - compare) -#define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(-Wconversion) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC MAPNIK_DISABLE_WARNING(-Wc++ 98 - compat - pedantic) -#define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION MAPNIK_DISABLE_WARNING(-Wdisabled - macro - expansion) -#define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST MAPNIK_DISABLE_WARNING(-Wold - style - cast) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION MAPNIK_DISABLE_WARNING(-Wdocumentation) -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND MAPNIK_DISABLE_WARNING(-Wdocumentation - unknown - command) -#define MAPNIK_DISABLE_WARNING_UNDEF MAPNIK_DISABLE_WARNING(-Wundef) -#define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(-Wdeprecated) -#define MAPNIK_DISABLE_WARNING_PADDED MAPNIK_DISABLE_WARNING(-Wpadded) -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT MAPNIK_DISABLE_WARNING(-Wc++ 98 - compat) -#define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO MAPNIK_DISABLE_WARNING(-Wreserved - id - macro) -#define MAPNIK_DISABLE_WARNING_WEAK_VTABLE MAPNIK_DISABLE_WARNING(-Wweak - vtables) -#define MAPNIK_DISABLE_WARNING_EXTRA_SEMI MAPNIK_DISABLE_WARNING(-Wextra - semi) -#define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS MAPNIK_DISABLE_WARNING(-Wglobal - constructors) -#define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE MAPNIK_DISABLE_WARNING(-Wheader - hygiene) -#define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS MAPNIK_DISABLE_WARNING(-Wexit - time - destructors) -#define MAPNIK_DISABLE_WARNING_SWITCH_ENUM MAPNIK_DISABLE_WARNING(-Wswitch - enum) -#define MAPNIK_DISABLE_WARNING_MISSING_NORETURN MAPNIK_DISABLE_WARNING(-Wmissing - noreturn) -#define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT MAPNIK_DISABLE_WARNING(-Wcovered - switch - default) -#define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL MAPNIK_DISABLE_WARNING(-Wfloat - equal) -#define MAPNIK_DISABLE_LONG_LONG MAPNIK_DISABLE_WARNING(-Wlong - long) -#define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE MAPNIK_DISABLE_WARNING(-Wundefined - var - template) -#define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(-Wunused - variable) -#define MAPNIK_DISABLE_MISMATCHED_TAGS MAPNIK_DISABLE_WARNING(-Wmismatched - tags) + #define MAPNIK_DO_PRAGMA(X) _Pragma(#X) + #define MAPNIK_DISABLE_WARNING_PUSH MAPNIK_DO_PRAGMA(GCC diagnostic push) + #define MAPNIK_DISABLE_WARNING_POP MAPNIK_DO_PRAGMA(GCC diagnostic pop) + #define MAPNIK_DISABLE_WARNING(warningName) MAPNIK_DO_PRAGMA(GCC diagnostic ignored #warningName) + // add warnings to deactivate here + // example: #define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(-Wunused-parameter) + #define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS MAPNIK_DISABLE_WARNING(-Wunknown-pragmas) + #define MAPNIK_DISABLE_WARNING_PRAGMAS MAPNIK_DISABLE_WARNING(-Wpragmas) + #define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES MAPNIK_DISABLE_WARNING(-W#pragma-messages) + #define MAPNIK_DISABLE_WARNING_UNSEQUENCED MAPNIK_DISABLE_WARNING(-Wunsequenced) + #define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION MAPNIK_DISABLE_WARNING(-Wunused-function) + #define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER MAPNIK_DISABLE_WARNING(-Wunused-parameter) + #define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER MAPNIK_DISABLE_WARNING(-Wredeclared-class-member) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF MAPNIK_DISABLE_WARNING(-Wunused-local-typedef) + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS MAPNIK_DISABLE_WARNING(-Wunused-local-typedefs) + #define MAPNIK_DISABLE_WARNING_SHADOW MAPNIK_DISABLE_WARNING(-Wshadow) + #define MAPNIK_DISABLE_WARNING_CPP11_NARROWING MAPNIK_DISABLE_WARNING(-Wc++11-narrowing) + #define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION MAPNIK_DISABLE_WARNING(-Wsign-conversion) + #define MAPNIK_DISABLE_WARNING_SIGN_COMPARE MAPNIK_DISABLE_WARNING(-Wsign-compare) + #define MAPNIK_DISABLE_WARNING_CONVERSION MAPNIK_DISABLE_WARNING(-Wconversion) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC MAPNIK_DISABLE_WARNING(-Wc++98-compat-pedantic) + #define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION MAPNIK_DISABLE_WARNING(-Wdisabled-macro-expansion) + #define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST MAPNIK_DISABLE_WARNING(-Wold-style-cast) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION MAPNIK_DISABLE_WARNING(-Wdocumentation) + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND MAPNIK_DISABLE_WARNING(-Wdocumentation-unknown-command) + #define MAPNIK_DISABLE_WARNING_UNDEF MAPNIK_DISABLE_WARNING(-Wundef) + #define MAPNIK_DISABLE_WARNING_DEPRECATED MAPNIK_DISABLE_WARNING(-Wdeprecated) + #define MAPNIK_DISABLE_WARNING_PADDED MAPNIK_DISABLE_WARNING(-Wpadded) + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT MAPNIK_DISABLE_WARNING(-Wc++98-compat) + #define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO MAPNIK_DISABLE_WARNING(-Wreserved-id-macro) + #define MAPNIK_DISABLE_WARNING_WEAK_VTABLE MAPNIK_DISABLE_WARNING(-Wweak-vtables) + #define MAPNIK_DISABLE_WARNING_EXTRA_SEMI MAPNIK_DISABLE_WARNING(-Wextra-semi) + #define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS MAPNIK_DISABLE_WARNING(-Wglobal-constructors) + #define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE MAPNIK_DISABLE_WARNING(-Wheader-hygiene) + #define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS MAPNIK_DISABLE_WARNING(-Wexit-time-destructors) + #define MAPNIK_DISABLE_WARNING_SWITCH_ENUM MAPNIK_DISABLE_WARNING(-Wswitch-enum) + #define MAPNIK_DISABLE_WARNING_MISSING_NORETURN MAPNIK_DISABLE_WARNING(-Wmissing-noreturn) + #define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT MAPNIK_DISABLE_WARNING(-Wcovered-switch-default) + #define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL MAPNIK_DISABLE_WARNING(-Wfloat-equal) + #define MAPNIK_DISABLE_LONG_LONG MAPNIK_DISABLE_WARNING(-Wlong-long) + #define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE MAPNIK_DISABLE_WARNING(-Wundefined-var-template) + #define MAPNIK_DISABLE_UNUSED_VARIABLE MAPNIK_DISABLE_WARNING(-Wunused-variable) + #define MAPNIK_DISABLE_MISMATCHED_TAGS MAPNIK_DISABLE_WARNING(-Wmismatched-tags) #else -#define MAPNIK_DISABLE_WARNING_PUSH -#define MAPNIK_DISABLE_WARNING_POP -// add all of the above warnings here (will be used if unknown compiler) -#define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS -#define MAPNIK_DISABLE_WARNING_PRAGMAS -#define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES -#define MAPNIK_DISABLE_WARNING_UNSEQUENCED -#define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION -#define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER -#define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF -#define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS -#define MAPNIK_DISABLE_WARNING_SHADOW -#define MAPNIK_DISABLE_WARNING_CPP11_NARROWING -#define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION -#define MAPNIK_DISABLE_WARNING_SIGN_COMPARE -#define MAPNIK_DISABLE_WARNING_CONVERSION -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC -#define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION -#define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION -#define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND -#define MAPNIK_DISABLE_WARNING_UNDEF -#define MAPNIK_DISABLE_WARNING_DEPRECATED -#define MAPNIK_DISABLE_WARNING_PADDED -#define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT -#define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO -#define MAPNIK_DISABLE_WARNING_WEAK_VTABLE -#define MAPNIK_DISABLE_WARNING_EXTRA_SEMI -#define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS -#define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE -#define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS -#define MAPNIK_DISABLE_WARNING_SWITCH_ENUM -#define MAPNIK_DISABLE_WARNING_MISSING_NORETURN -#define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT -#define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL -#define MAPNIK_DISABLE_LONG_LONG -#define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE -#define MAPNIK_DISABLE_UNUSED_VARIABLE -#define MAPNIK_DISABLE_MISMATCHED_TAGS + #define MAPNIK_DISABLE_WARNING_PUSH + #define MAPNIK_DISABLE_WARNING_POP + // add all of the above warnings here (will be used if unknown compiler) + #define MAPNIK_DISABLE_WARNING_UNKNOWN_PRAGMAS + #define MAPNIK_DISABLE_WARNING_PRAGMAS + #define MAPNIK_DISABLE_WARNING_PRAGMA_MESSAGES + #define MAPNIK_DISABLE_WARNING_UNSEQUENCED + #define MAPNIK_DISABLE_WARNING_UNUSED_FUNCTION + #define MAPNIK_DISABLE_WARNING_UNUSED_PARAMETER + #define MAPNIK_DISABLE_WARNING_REDECLARED_CLASS_MEMBER + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEF + #define MAPNIK_DISABLE_WARNING_UNUSED_LOCAL_TYPEDEFS + #define MAPNIK_DISABLE_WARNING_SHADOW + #define MAPNIK_DISABLE_WARNING_CPP11_NARROWING + #define MAPNIK_DISABLE_WARNING_SIGN_CONVERSION + #define MAPNIK_DISABLE_WARNING_SIGN_COMPARE + #define MAPNIK_DISABLE_WARNING_CONVERSION + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT_PEDANTIC + #define MAPNIK_DISABLE_WARNING_DISABLE_MACRO_EXPANSION + #define MAPNIK_DISABLE_WARNING_OLD_STYLE_CAST + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION + #define MAPNIK_DISABLE_WARNING_DOCUMENTATION_UNKNOWN_COMMAND + #define MAPNIK_DISABLE_WARNING_UNDEF + #define MAPNIK_DISABLE_WARNING_DEPRECATED + #define MAPNIK_DISABLE_WARNING_PADDED + #define MAPNIK_DISABLE_WARNING_CPP_98_COMPAT + #define MAPNIK_DISABLE_WARNING_RESERVED_ID_MACRO + #define MAPNIK_DISABLE_WARNING_WEAK_VTABLE + #define MAPNIK_DISABLE_WARNING_EXTRA_SEMI + #define MAPNIK_DISABLE_WARNING_GLOBAL_CONSTRUCTORS + #define MAPNIK_DISABLE_WARNING_HEADER_HYGIENE + #define MAPNIK_DISABLE_WARNING_EXIT_TIME_DESTRUCTORS + #define MAPNIK_DISABLE_WARNING_SWITCH_ENUM + #define MAPNIK_DISABLE_WARNING_MISSING_NORETURN + #define MAPNIK_DISABLE_WARNING_COVERED_SWITCH_DEFAULT + #define MAPNIK_DISABLE_WARNING_FLOAT_EQUAL + #define MAPNIK_DISABLE_LONG_LONG + #define MAPNIK_DISABLE_UNDEFINED_VAR_TEMPLATE + #define MAPNIK_DISABLE_UNUSED_VARIABLE + #define MAPNIK_DISABLE_MISMATCHED_TAGS +#endif +// clang-format on #endif -#endif \ No newline at end of file diff --git a/plugins/input/CMakeLists.txt b/plugins/input/CMakeLists.txt index 2849b8766..b5167c84a 100644 --- a/plugins/input/CMakeLists.txt +++ b/plugins/input/CMakeLists.txt @@ -1,12 +1,31 @@ set(_plugin_prefix "") set(_plugin_suffix ".input") +set(_plugin_library_output "${MAPNIK_OUTPUT_DIR}/plugins/input") +set(_plugin_runtime_output "${MAPNIK_OUTPUT_DIR}") +set(_plugin_archive_output "${MAPNIK_OUTPUT_DIR}/lib") +set(_plugin_fpic ON) set(_plugin_linkage MODULE) -set(_plugin_source_visibility PRIVATE) +set(_plugin_visibility PRIVATE) if(MAPNIK_STATIC_PLUGINS) set(_plugin_linkage INTERFACE) set(_plugin_visibility INTERFACE) endif() +macro(add_plugin_target plugin_target output_name) + add_library(${plugin_target} ${_plugin_linkage}) + set_target_properties(${plugin_target} PROPERTIES + OUTPUT_NAME "${output_name}" + POSITION_INDEPENDENT_CODE ${_plugin_fpic} + PREFIX "${_plugin_prefix}" + SUFFIX "${_plugin_suffix}" + LIBRARY_OUTPUT_DIRECTORY "${_plugin_library_output}" + RUNTIME_OUTPUT_DIRECTORY "${_plugin_runtime_output}" + ARCHIVE_OUTPUT_DIRECTORY "${_plugin_archive_output}" + ) + mapnik_install_plugin(${plugin_target}) +endmacro() + + add_subdirectory(base) # add a list with all build plugins so the copy dependencies command can wait for all build events diff --git a/plugins/input/base/CMakeLists.txt b/plugins/input/base/CMakeLists.txt index 1dca6a808..2e080bd29 100644 --- a/plugins/input/base/CMakeLists.txt +++ b/plugins/input/base/CMakeLists.txt @@ -9,3 +9,4 @@ target_include_directories(datasource-base INTERFACE target_link_libraries(datasource-base INTERFACE mapnik::core) mapnik_install(datasource-base) +install(DIRECTORY include/ DESTINATION "${MAPNIK_INCLUDE_DIR}") diff --git a/plugins/input/base/include/mapnik/datasource_plugin.hpp b/plugins/input/base/include/mapnik/datasource_plugin.hpp index cbff13d96..32d67dcfa 100644 --- a/plugins/input/base/include/mapnik/datasource_plugin.hpp +++ b/plugins/input/base/include/mapnik/datasource_plugin.hpp @@ -1,17 +1,18 @@ #ifndef DATASOURCE_PLUGIN_HPP #define DATASOURCE_PLUGIN_HPP #include -#include #include +#include namespace mapnik { class MAPNIK_DECL datasource_plugin { public: - datasource_plugin() {} - virtual ~datasource_plugin() {} - virtual void init_once() const = 0; - virtual const std::string& name() const = 0; + datasource_plugin() = default; + virtual ~datasource_plugin() = default; + virtual void after_load() const = 0; + virtual void before_unload() const = 0; + virtual const char* name() const = 0; virtual datasource_ptr create(parameters const& params) const = 0; }; } // namespace mapnik @@ -21,20 +22,23 @@ class MAPNIK_DECL datasource_plugin { \ public: \ static constexpr const char* kName = #pluginname; \ - void init_once() const override; \ - const std::string& name() const override; \ + void after_load() const override; \ + void before_unload() const override; \ + const char* name() const override; \ mapnik::datasource_ptr create(mapnik::parameters const& params) const override; \ }; #define DATASOURCE_PLUGIN_IMPL(classname, pluginclassname) \ - const std::string& classname::name() const { return kName; } \ + const char* classname::name() const { return kName; } \ mapnik::datasource_ptr classname::create(mapnik::parameters const& params) const \ { \ return std::make_shared(params); \ } -#define DATASOURCE_PLUGIN_EMPTY_INIT(classname) \ - void classname::init_once() const {} +#define DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(classname) \ + void classname::after_load() const {} +#define DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(classname) \ + void classname::before_unload() const {} #ifndef MAPNIK_STATIC_PLUGINS #define DATASOURCE_PLUGIN_EXPORT(classname) \ diff --git a/plugins/input/csv/CMakeLists.txt b/plugins/input/csv/CMakeLists.txt index b5a89f0b2..9d9d028b9 100644 --- a/plugins/input/csv/CMakeLists.txt +++ b/plugins/input/csv/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(input-csv ${_plugin_linkage}) +add_plugin_target(input-csv "csv") + target_sources(input-csv ${_plugin_visibility} csv_datasource.cpp csv_featureset.cpp @@ -12,12 +13,3 @@ target_link_libraries(input-csv ${_plugin_visibility} mapnik::json mapnik::datasource-base ) -set_target_properties(input-csv PROPERTIES - OUTPUT_NAME "csv" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-csv) diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 2ce50efeb..ee752110b 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -67,7 +67,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(csv_datasource_plugin, csv_datasource); DATASOURCE_PLUGIN_EXPORT(csv_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(csv_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(csv_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(csv_datasource_plugin); csv_datasource::csv_datasource(parameters const& params) : datasource(params) diff --git a/plugins/input/gdal/CMakeLists.txt b/plugins/input/gdal/CMakeLists.txt index 2db11e1c9..c6ae1f633 100644 --- a/plugins/input/gdal/CMakeLists.txt +++ b/plugins/input/gdal/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(GDAL REQUIRED) -add_library(input-gdal ${_plugin_linkage}) +add_plugin_target(input-gdal "gdal") target_sources(input-gdal ${_plugin_visibility} gdal_datasource.cpp gdal_featureset.cpp @@ -11,12 +11,4 @@ target_link_libraries(input-gdal ${_plugin_visibility} mapnik::datasource-base ${GDAL_LIBRARIES} ) -set_target_properties(input-gdal PROPERTIES - OUTPUT_NAME "gdal" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-gdal) + diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index dbfe90cbd..f86e17361 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -44,13 +44,16 @@ using mapnik::featureset_ptr; using mapnik::layer_descriptor; using mapnik::query; -static std::once_flag once_flag; - DATASOURCE_PLUGIN_IMPL(gdal_datasource_plugin, gdal_datasource); DATASOURCE_PLUGIN_EXPORT(gdal_datasource_plugin); -void gdal_datasource_plugin::init_once() const +void gdal_datasource_plugin::after_load() const { - std::call_once(once_flag, []() { GDALAllRegister(); }); + GDALAllRegister(); +} + +void gdal_datasource_plugin::before_unload() const +{ + GDALDestroyDriverManager(); } gdal_datasource::gdal_datasource(parameters const& params) diff --git a/plugins/input/geobuf/CMakeLists.txt b/plugins/input/geobuf/CMakeLists.txt index 57447fbed..4bd67c6e4 100644 --- a/plugins/input/geobuf/CMakeLists.txt +++ b/plugins/input/geobuf/CMakeLists.txt @@ -1,4 +1,5 @@ -add_library(input-geobuf ${_plugin_linkage}) +add_plugin_target(input-geobuf "geobuf") + target_sources(input-geobuf ${_plugin_visibility} geobuf_datasource.cpp geobuf_featureset.cpp @@ -7,12 +8,4 @@ target_link_libraries(input-geobuf ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) -set_target_properties(input-geobuf PROPERTIES - OUTPUT_NAME "geobuf" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-geobuf) + diff --git a/plugins/input/geobuf/geobuf_datasource.cpp b/plugins/input/geobuf/geobuf_datasource.cpp index 8945538c3..48eafa299 100644 --- a/plugins/input/geobuf/geobuf_datasource.cpp +++ b/plugins/input/geobuf/geobuf_datasource.cpp @@ -50,7 +50,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(geobuf_datasource_plugin, geobuf_datasource); DATASOURCE_PLUGIN_EXPORT(geobuf_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(geobuf_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(geobuf_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(geobuf_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/geojson/CMakeLists.txt b/plugins/input/geojson/CMakeLists.txt index 967f47820..cf86e73d5 100644 --- a/plugins/input/geojson/CMakeLists.txt +++ b/plugins/input/geojson/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-geojson ${_plugin_linkage}) +add_plugin_target(input-geojson "geojson") target_sources(input-geojson ${_plugin_visibility} geojson_datasource.cpp geojson_featureset.cpp @@ -10,12 +10,3 @@ target_link_libraries(input-geojson ${_plugin_visibility} mapnik::json mapnik::datasource-base ) -set_target_properties(input-geojson PROPERTIES - OUTPUT_NAME "geojson" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-geojson) diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 98a4ff899..84b63f5d4 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -69,7 +69,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(geojson_datasource_plugin, geojson_datasource); DATASOURCE_PLUGIN_EXPORT(geojson_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(geojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(geojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(geojson_datasource_plugin); struct attr_value_converter { diff --git a/plugins/input/ogr/CMakeLists.txt b/plugins/input/ogr/CMakeLists.txt index f6e562181..0034d4684 100644 --- a/plugins/input/ogr/CMakeLists.txt +++ b/plugins/input/ogr/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(GDAL REQUIRED) -add_library(input-ogr ${_plugin_linkage}) +add_plugin_target(input-ogr "ogr") target_sources(input-ogr ${_plugin_visibility} ogr_converter.cpp ogr_datasource.cpp @@ -13,12 +13,3 @@ target_link_libraries(input-ogr ${_plugin_visibility} mapnik::datasource-base ${GDAL_LIBRARIES} ) -set_target_properties(input-ogr PROPERTIES - OUTPUT_NAME "ogr" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-ogr) diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index 5acf30c6b..2e4cad22e 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include MAPNIK_DISABLE_WARNING_PUSH @@ -49,8 +50,6 @@ MAPNIK_DISABLE_WARNING_POP using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(ogr_datasource) - using mapnik::attribute_descriptor; using mapnik::box2d; using mapnik::coord2d; @@ -65,11 +64,19 @@ static std::once_flag once_flag; DATASOURCE_PLUGIN_IMPL(ogr_datasource_plugin, ogr_datasource); DATASOURCE_PLUGIN_EXPORT(ogr_datasource_plugin); -void ogr_datasource_plugin::init_once() const + +void ogr_datasource_plugin::after_load() const { // initialize ogr formats // NOTE: in GDAL >= 2.0 this is the same as GDALAllRegister() - std::call_once(once_flag, []() { OGRRegisterAll(); }); + OGRRegisterAll(); +} + +void ogr_datasource_plugin::before_unload() const +{ + // initialize ogr formats + // NOTE: in GDAL >= 2.0 this is the same as GDALDestroyDriverManager() + OGRCleanupAll(); } ogr_datasource::ogr_datasource(parameters const& params) diff --git a/plugins/input/pgraster/CMakeLists.txt b/plugins/input/pgraster/CMakeLists.txt index 4a570502d..7458a4420 100644 --- a/plugins/input/pgraster/CMakeLists.txt +++ b/plugins/input/pgraster/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(PostgreSQL REQUIRED) -add_library(input-pgraster ${_plugin_linkage}) +add_plugin_target(input-pgraster "pgraster") target_sources(input-pgraster ${_plugin_visibility} pgraster_datasource.cpp pgraster_featureset.cpp @@ -11,12 +11,3 @@ target_link_libraries(input-pgraster ${_plugin_visibility} mapnik::datasource-base PostgreSQL::PostgreSQL ) -set_target_properties(input-pgraster PROPERTIES - OUTPUT_NAME "pgraster" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-pgraster) diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 62acc1ebc..9ee183703 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -53,7 +53,9 @@ MAPNIK_DISABLE_WARNING_POP DATASOURCE_PLUGIN_IMPL(pgraster_datasource_plugin, pgraster_datasource); DATASOURCE_PLUGIN_EXPORT(pgraster_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(pgraster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(pgraster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(pgraster_datasource_plugin); + const std::string pgraster_datasource::RASTER_COLUMNS = "raster_columns"; const std::string pgraster_datasource::RASTER_OVERVIEWS = "raster_overviews"; diff --git a/plugins/input/postgis/CMakeLists.txt b/plugins/input/postgis/CMakeLists.txt index 7e7061b7a..93346d6e4 100644 --- a/plugins/input/postgis/CMakeLists.txt +++ b/plugins/input/postgis/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(PostgreSQL REQUIRED) -add_library(input-postgis ${_plugin_linkage}) +add_plugin_target(input-postgis "postgis") target_sources(input-postgis ${_plugin_visibility} postgis_datasource.cpp postgis_featureset.cpp @@ -10,12 +10,3 @@ target_link_libraries(input-postgis ${_plugin_visibility} mapnik::datasource-base PostgreSQL::PostgreSQL ) -set_target_properties(input-postgis PROPERTIES - OUTPUT_NAME "postgis" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-postgis) diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index f33ac5763..24965f0da 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -50,7 +50,8 @@ MAPNIK_DISABLE_WARNING_POP DATASOURCE_PLUGIN_IMPL(postgis_datasource_plugin, postgis_datasource); DATASOURCE_PLUGIN_EXPORT(postgis_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(postgis_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(postgis_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(postgis_datasource_plugin); const std::string postgis_datasource::GEOMETRY_COLUMNS = "geometry_columns"; const std::string postgis_datasource::SPATIAL_REF_SYS = "spatial_ref_system"; diff --git a/plugins/input/raster/CMakeLists.txt b/plugins/input/raster/CMakeLists.txt index c9f12d9e6..5adca0106 100644 --- a/plugins/input/raster/CMakeLists.txt +++ b/plugins/input/raster/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-raster ${_plugin_linkage}) +add_plugin_target(input-raster "raster") target_sources(input-raster ${_plugin_visibility} raster_datasource.cpp raster_featureset.cpp @@ -8,12 +8,3 @@ target_link_libraries(input-raster ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) -set_target_properties(input-raster PROPERTIES - OUTPUT_NAME "raster" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-raster) diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 88d7c68f2..bf50c529d 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -45,7 +45,8 @@ using mapnik::query; DATASOURCE_PLUGIN_IMPL(raster_datasource_plugin, raster_datasource); DATASOURCE_PLUGIN_EXPORT(raster_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(raster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(raster_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(raster_datasource_plugin); raster_datasource::raster_datasource(parameters const& params) : datasource(params) diff --git a/plugins/input/shape/CMakeLists.txt b/plugins/input/shape/CMakeLists.txt index 2cd86cdac..695312b23 100644 --- a/plugins/input/shape/CMakeLists.txt +++ b/plugins/input/shape/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-shape ${_plugin_linkage}) +add_plugin_target(input-shape "shape") target_sources(input-shape ${_plugin_visibility} dbfile.cpp dbf_test.cpp @@ -11,12 +11,3 @@ target_link_libraries(input-shape ${_plugin_visibility} mapnik::mapnik mapnik::datasource-base ) -set_target_properties(input-shape PROPERTIES - OUTPUT_NAME "shape" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-shape) diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 0ad264584..cff910796 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -49,7 +49,8 @@ MAPNIK_DISABLE_WARNING_POP DATASOURCE_PLUGIN_IMPL(shape_datasource_plugin, shape_datasource); DATASOURCE_PLUGIN_EXPORT(shape_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(shape_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(shape_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(shape_datasource_plugin); using mapnik::attribute_descriptor; using mapnik::Boolean; diff --git a/plugins/input/sqlite/CMakeLists.txt b/plugins/input/sqlite/CMakeLists.txt index d690db4fa..d3e9bc821 100644 --- a/plugins/input/sqlite/CMakeLists.txt +++ b/plugins/input/sqlite/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(SQLite3 REQUIRED) -add_library(input-sqlite ${_plugin_linkage}) +add_plugin_target(input-sqlite "sqlite") target_sources(input-sqlite ${_plugin_visibility} sqlite_datasource.cpp sqlite_featureset.cpp @@ -10,12 +10,3 @@ target_link_libraries(input-sqlite ${_plugin_visibility} mapnik::datasource-base SQLite::SQLite3 ) -set_target_properties(input-sqlite PROPERTIES - OUTPUT_NAME "sqlite" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-sqlite) diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index ace3039b8..71a55a2eb 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -52,7 +52,8 @@ using mapnik::query; DATASOURCE_PLUGIN_IMPL(sqlite_datasource_plugin, sqlite_datasource); DATASOURCE_PLUGIN_EXPORT(sqlite_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(sqlite_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(sqlite_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(sqlite_datasource_plugin); sqlite_datasource::sqlite_datasource(parameters const& params) : datasource(params) diff --git a/plugins/input/topojson/CMakeLists.txt b/plugins/input/topojson/CMakeLists.txt index 4b8fd3153..03f885e44 100644 --- a/plugins/input/topojson/CMakeLists.txt +++ b/plugins/input/topojson/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(input-topojson ${_plugin_linkage}) +add_plugin_target(input-topojson "topojson") target_sources(input-topojson ${_plugin_visibility} topojson_datasource.cpp topojson_featureset.cpp @@ -8,12 +8,3 @@ target_link_libraries(input-topojson ${_plugin_visibility} mapnik::json mapnik::datasource-base ) -set_target_properties(input-topojson PROPERTIES - OUTPUT_NAME "topojson" - PREFIX "${_plugin_prefix}" - SUFFIX "${_plugin_suffix}" - LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input" - RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}" - ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib" -) -mapnik_install_plugin(input-topojson) diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 1d10e33f6..8dec2f387 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -44,7 +44,8 @@ using mapnik::parameters; DATASOURCE_PLUGIN_IMPL(topojson_datasource_plugin, topojson_datasource); DATASOURCE_PLUGIN_EXPORT(topojson_datasource_plugin); -DATASOURCE_PLUGIN_EMPTY_INIT(topojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(topojson_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(topojson_datasource_plugin); struct attr_value_converter { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c86112cb..9fe5da903 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,7 @@ if(MAPNIK_STATIC_PLUGINS) endif() set_target_properties(mapnik PROPERTIES + POSITION_INDEPENDENT_CODE ON DEBUG_POSTFIX "${MAPNIK_DEBUG_POSTFIX}" OUTPUT_NAME "mapnik" PREFIX "lib" @@ -106,6 +107,7 @@ target_sources(mapnik PRIVATE layer.cpp load_map.cpp map.cpp + mapnik.cpp mapped_memory_cache.cpp marker_cache.cpp marker_helpers.cpp diff --git a/src/create_image_reader.hpp b/src/create_image_reader.hpp new file mode 100644 index 000000000..184b4eb13 --- /dev/null +++ b/src/create_image_reader.hpp @@ -0,0 +1,19 @@ +#ifndef MAPNIK_CREATE_IMAGE_READER_HPP +#define MAPNIK_CREATE_IMAGE_READER_HPP + +namespace mapnik { +#ifdef HAVE_JPEG +void register_jpeg_reader(); +#endif +#ifdef HAVE_PNG +void register_png_reader(); +#endif +#ifdef HAVE_TIFF +void register_tiff_reader(); +#endif +#ifdef HAVE_WEBP +void register_webp_reader(); +#endif +} // namespace mapnik + +#endif diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 4b08a2b7c..28ae3a12d 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -71,11 +72,9 @@ datasource_ptr datasource_cache::create(parameters const& params) throw config_error(std::string("Could not create datasource. Required ") + "parameter 'type' is missing"); } - datasource_ptr ds; - #ifdef MAPNIK_STATIC_PLUGINS // return if it's created, raise otherwise - ds = create_static_datasource(params); + datasource_ptr ds = create_static_datasource(params); if (ds) { return ds; @@ -114,16 +113,14 @@ datasource_ptr datasource_cache::create(parameters const& params) #ifdef __GNUC__ __extension__ #endif - create_ds create_datasource = reinterpret_cast(itr->second->get_symbol("create")); + datasource_plugin* create_datasource = reinterpret_cast(itr->second->get_symbol("plugin")); if (!create_datasource) { throw std::runtime_error(std::string("Cannot load symbols: ") + itr->second->get_error()); } - ds = datasource_ptr(create_datasource(params), datasource_deleter()); - - return ds; + return create_datasource->create(params); } std::string datasource_cache::plugin_directories() diff --git a/src/datasource_cache_static.cpp b/src/datasource_cache_static.cpp index 98a75998b..0577404a0 100644 --- a/src/datasource_cache_static.cpp +++ b/src/datasource_cache_static.cpp @@ -33,11 +33,6 @@ #include #include -#define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) \ - { \ - std::string{classname::kName}, std::make_shared() \ - } - // static plugin linkage #ifdef MAPNIK_STATIC_PLUGINS #if defined(MAPNIK_STATIC_PLUGIN_CSV) @@ -90,9 +85,12 @@ #endif #endif +#define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) \ + ds_map.emplace(std::string{classname::kName}, std::make_shared()) namespace mapnik { #ifdef MAPNIK_STATIC_PLUGINS + template datasource_ptr ds_generator(parameters const& params) { @@ -102,54 +100,54 @@ datasource_ptr ds_generator(parameters const& params) typedef datasource_ptr (*ds_generator_ptr)(parameters const& params); using datasource_map = std::unordered_map>; -static datasource_map ds_map +static datasource_map ds_map{}; + +void init_datasource_cache_static() { #if defined(MAPNIK_STATIC_PLUGIN_CSV) - REGISTER_STATIC_DATASOURCE_PLUGIN(csv_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(csv_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GDAL) - REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(gdal_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOBUF) - REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(geobuf_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_GEOJSON) - REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(geojson_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OCCI) - REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(occi_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OGR) - REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(ogr_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_PGRASTER) - REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(pgraster_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_OSM) - REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(osm_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_POSTGIS) - REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(postgis_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTER) - REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(raster_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_RASTERLITE) - REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(rasterlite_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_SHAPE) - REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(shape_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_SQLITE) - REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(sqlite_datasource_plugin); #endif #if defined(MAPNIK_STATIC_PLUGIN_TOPOJSON) - REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin), + REGISTER_STATIC_DATASOURCE_PLUGIN(topojson_datasource_plugin); #endif }; -#endif -#ifdef MAPNIK_STATIC_PLUGINS datasource_ptr create_static_datasource(parameters const& params) { datasource_ptr ds; diff --git a/src/jpeg_reader.cpp b/src/jpeg_reader.cpp index ff704f691..1e14acb59 100644 --- a/src/jpeg_reader.cpp +++ b/src/jpeg_reader.cpp @@ -91,7 +91,6 @@ class jpeg_reader : public image_reader static void attach_stream(j_decompress_ptr cinfo, input_stream* in); }; -namespace { image_reader* create_jpeg_reader(std::string const& filename) { return new jpeg_reader(filename); @@ -101,10 +100,11 @@ image_reader* create_jpeg_reader2(char const* data, size_t size) { return new jpeg_reader(data, size); } - -const bool registered = register_image_reader("jpeg", create_jpeg_reader); -const bool registered2 = register_image_reader("jpeg", create_jpeg_reader2); -} // namespace +void register_jpeg_reader() +{ + const bool registered = register_image_reader("jpeg", create_jpeg_reader); + const bool registered2 = register_image_reader("jpeg", create_jpeg_reader2); +} // ctors template diff --git a/src/mapnik.cpp b/src/mapnik.cpp new file mode 100644 index 000000000..0a9630ea9 --- /dev/null +++ b/src/mapnik.cpp @@ -0,0 +1,41 @@ +#include +#include // call once +#include "create_image_reader.hpp" +namespace mapnik { + +static void setup_once(); + +void setup() +{ + static std::once_flag init_flag; + std::call_once(init_flag, setup_once); +} +#ifdef MAPNIK_STATIC_PLUGINS +extern void init_datasource_cache_static(); +#endif +static void register_image_readers(); + +void setup_once() +{ +#ifdef MAPNIK_STATIC_PLUGINS + init_datasource_cache_static(); // defined in datasource_cache_static.cpp +#endif + register_image_readers(); +} + +void register_image_readers() +{ +#ifdef HAVE_JPEG + register_jpeg_reader(); +#endif +#ifdef HAVE_PNG + register_png_reader(); +#endif +#ifdef HAVE_TIFF + register_tiff_reader(); +#endif +#ifdef HAVE_WEBP + register_webp_reader(); +#endif +} +} // namespace mapnik diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index eee058be6..605f36ec6 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -35,10 +35,15 @@ using mapnik::datasource; using mapnik::parameters; -DATASOURCE_PLUGIN(mapnik::memory_datasource) + +DATASOURCE_PLUGIN_EXPORT(mapnik::memory_datasource_plugin) namespace mapnik { +DATASOURCE_PLUGIN_IMPL(memory_datasource_plugin, memory_datasource); +DATASOURCE_PLUGIN_EMPTY_AFTER_LOAD(memory_datasource_plugin); +DATASOURCE_PLUGIN_EMPTY_BEFORE_UNLOAD(memory_datasource_plugin); + struct accumulate_extent { accumulate_extent(box2d& ext) @@ -67,7 +72,7 @@ struct accumulate_extent const char* memory_datasource::name() { - return "memory"; + return mapnik::memory_datasource_plugin::kName; } memory_datasource::memory_datasource(parameters const& _params) diff --git a/src/plugin.cpp b/src/plugin.cpp index e268fd999..f16f46499 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -47,51 +47,13 @@ namespace mapnik { struct _mapnik_lib_t { + std::string name; handle dl; -}; - -PluginInfo::PluginInfo(std::string const& filename, std::string const& library_name) - : filename_(filename) - , name_() - , module_(new mapnik_lib_t) -{ -#ifdef _WIN32 - if (module_) - module_->dl = LoadLibraryA(filename.c_str()); - if (module_ && module_->dl) - { - datasource_plugin* plugin = reinterpret_cast(dlsym(module_->dl, "plugin")); - if (!plugin) - throw std::runtime_error("plugin has a false interface"); //! todo: better error text - name_ = plugin->name(); - plugin->init_once(); - } -#else -#ifdef MAPNIK_HAS_DLCFN - if (module_) - module_->dl = dlopen(filename.c_str(), RTLD_LAZY); - if (module_ && module_->dl) - { - callable_returning_string name_call = - reinterpret_cast(dlsym(module_->dl, library_name.c_str())); - if (name_call) - name_ = name_call(); - callable_returning_void init_once = - reinterpret_cast(dlsym(module_->dl, "on_plugin_load")); - if (init_once) - { - init_once(); - } - } -#else - throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)"); -#endif -#endif -} - -PluginInfo::~PluginInfo() -{ - if (module_) + _mapnik_lib_t() + : name{"unknown"} + , dl{0} + {} + ~_mapnik_lib_t() { #ifdef MAPNIK_SUPPORTS_DLOPEN /* @@ -105,17 +67,46 @@ PluginInfo::~PluginInfo() in the case that gdal is linked as a shared library. This workaround therefore prevents crashes with gdal 1.11.x and gdal 2.x when using a static libgdal. */ - if (module_->dl && name_ != "gdal" && name_ != "ogr") + if (dl /*&& name_ != "gdal" && name_ != "ogr"*/) // is the gdal issue sill present? We are now + // unregister all drivers for ogal and gdal (todo: + // before_unload call) { #ifndef MAPNIK_NO_DLCLOSE - dlclose(module_->dl), module_->dl = 0; + dlclose(dl); + dl = 0; #endif } #endif - delete module_; } +}; + +PluginInfo::PluginInfo(std::string const& filename, std::string const& library_name) + : filename_(filename) + , module_{std::make_unique()} +{ +#if defined(_WIN32) + if (module_) + module_->dl = LoadLibraryA(filename.c_str()); +#elif defined(MAPNIK_HAS_DLCFN) + if (module_) + module_->dl = dlopen(filename.c_str(), RTLD_LAZY); +#else + throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)"); +#endif +#if defined(MAPNIK_HAS_DLCFN) || defined(_WIN32) + if (module_ && module_->dl) + { + datasource_plugin* plugin{reinterpret_cast(get_symbol("plugin"))}; + if (!plugin) + throw std::runtime_error("plugin has a false interface"); //! todo: better error text + module_->name = plugin->name(); + plugin->after_load(); + } +#endif } +PluginInfo::~PluginInfo() {} + void* PluginInfo::get_symbol(std::string const& sym_name) const { #ifdef MAPNIK_SUPPORTS_DLOPEN @@ -127,13 +118,13 @@ void* PluginInfo::get_symbol(std::string const& sym_name) const std::string const& PluginInfo::name() const { - return name_; + return module_->name; } bool PluginInfo::valid() const { #ifdef MAPNIK_SUPPORTS_DLOPEN - if (module_ && module_->dl && !name_.empty()) + if (module_ && module_->dl && !module_->name.empty()) return true; #endif return false; @@ -141,7 +132,7 @@ bool PluginInfo::valid() const std::string PluginInfo::get_error() const { - return std::string("could not open: '") + name_ + "'"; + return std::string("could not open: '") + module_->name + "'"; } void PluginInfo::init() diff --git a/src/png_reader.cpp b/src/png_reader.cpp index 746705b21..799cdeda5 100644 --- a/src/png_reader.cpp +++ b/src/png_reader.cpp @@ -80,8 +80,6 @@ class png_reader : public image_reader static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length); }; -namespace { - image_reader* create_png_reader(std::string const& filename) { return new png_reader(filename); @@ -92,9 +90,11 @@ image_reader* create_png_reader2(char const* data, std::size_t size) return new png_reader(data, size); } -const bool registered = register_image_reader("png", create_png_reader); -const bool registered2 = register_image_reader("png", create_png_reader2); -} // namespace +void register_png_reader() +{ + const bool registered = register_image_reader("png", create_png_reader); + const bool registered2 = register_image_reader("png", create_png_reader2); +} void user_error_fn(png_structp /*png_ptr*/, png_const_charp error_msg) { diff --git a/src/tiff_reader.cpp b/src/tiff_reader.cpp index fb8b243a8..4446add71 100644 --- a/src/tiff_reader.cpp +++ b/src/tiff_reader.cpp @@ -104,8 +104,6 @@ int tiff_map_proc(thandle_t, tdata_t*, toff_t*) } } // namespace detail -namespace { - image_reader* create_tiff_reader(std::string const& filename) { #if defined(MAPNIK_MEMORY_MAPPED_FILE) @@ -120,9 +118,10 @@ image_reader* create_tiff_reader2(char const* data, std::size_t size) return new tiff_reader(data, size); } -const bool registered = register_image_reader("tiff", create_tiff_reader); -const bool registered2 = register_image_reader("tiff", create_tiff_reader2); - -} // namespace +void register_tiff_reader() +{ + const bool registered = register_image_reader("tiff", create_tiff_reader); + const bool registered2 = register_image_reader("tiff", create_tiff_reader2); +} } // namespace mapnik diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index fa85d6dfc..24b942525 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -110,7 +110,6 @@ class webp_reader : public image_reader void init(); }; -namespace { image_reader* create_webp_reader(char const* data, std::size_t size) { return new webp_reader(data, size); @@ -121,10 +120,11 @@ image_reader* create_webp_reader2(std::string const& filename) return new webp_reader(filename); } -const bool registered = register_image_reader("webp", create_webp_reader); -const bool registered2 = register_image_reader("webp", create_webp_reader2); - -} // namespace +void register_webp_reader() +{ + const bool registered = register_image_reader("webp", create_webp_reader); + const bool registered2 = register_image_reader("webp", create_webp_reader2); +} // ctor template diff --git a/test/standalone/agg_rasterizer_integer_overflow_test.cpp b/test/standalone/agg_rasterizer_integer_overflow_test.cpp index 9ab9cfd95..05d3556f0 100644 --- a/test/standalone/agg_rasterizer_integer_overflow_test.cpp +++ b/test/standalone/agg_rasterizer_integer_overflow_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -22,6 +23,7 @@ const std::string TEST_CASE("agg_rasterizer_integer_overflow") { + mapnik::setup(); SECTION("coordinates_do_not_overflow_and_polygon_is_rendered") { auto expected_color = mapnik::color("white"); diff --git a/test/standalone/datasource_registration_test.cpp b/test/standalone/datasource_registration_test.cpp index b93fb03df..c5226e5bb 100644 --- a/test/standalone/datasource_registration_test.cpp +++ b/test/standalone/datasource_registration_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -11,6 +12,7 @@ TEST_CASE("datasource_cache") { + mapnik::setup(); SECTION("registration") { try diff --git a/test/standalone/font_registration_test.cpp b/test/standalone/font_registration_test.cpp index 5197f57ac..0e88711d0 100644 --- a/test/standalone/font_registration_test.cpp +++ b/test/standalone/font_registration_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -13,6 +14,7 @@ TEST_CASE("font") { + mapnik::setup(); SECTION("registration") { try diff --git a/test/standalone/map_xml_test.cpp b/test/standalone/map_xml_test.cpp index b9755588e..c2aa6893e 100644 --- a/test/standalone/map_xml_test.cpp +++ b/test/standalone/map_xml_test.cpp @@ -1,6 +1,7 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" +#include #include #include #include @@ -142,6 +143,7 @@ const bool registered = TEST_CASE("map xml I/O") { + mapnik::setup(); // make sure plugins are loaded REQUIRE(registered); diff --git a/test/unit/run.cpp b/test/unit/run.cpp index 8bf68870c..94836d7ed 100644 --- a/test/unit/run.cpp +++ b/test/unit/run.cpp @@ -2,6 +2,7 @@ #include "catch.hpp" #include +#include #include #include #include @@ -20,6 +21,7 @@ int main(int argc, char** argv) session.cli(cli); int result = session.applyCommandLine(argc, argv); + mapnik::setup(); if (!plugin_path.empty()) { if (!mapnik::util::exists(plugin_path)) diff --git a/test/visual/run.cpp b/test/visual/run.cpp index d25da763d..4ea3473d4 100644 --- a/test/visual/run.cpp +++ b/test/visual/run.cpp @@ -23,6 +23,7 @@ #include "runner.hpp" #include "config.hpp" +#include #include #include @@ -166,6 +167,7 @@ int main(int argc, char** argv) return 1; } + mapnik::setup(); #ifdef MAPNIK_LOG std::string log_level(vm["log"].as()); log_levels_map::const_iterator level_iter = log_levels.find(log_level); diff --git a/utils/geometry_to_wkb/main.cpp b/utils/geometry_to_wkb/main.cpp index 74d4aa0b6..46f289162 100644 --- a/utils/geometry_to_wkb/main.cpp +++ b/utils/geometry_to_wkb/main.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,7 @@ int main(int argc, char** argv) std::cerr << "Geometry to WKB converter\n"; + mapnik::setup(); mapnik::datasource_cache::instance().register_datasources("/opt/mapnik/lib/mapnik/input/"); std::string filename(argv[1]); diff --git a/utils/mapnik-index/mapnik-index.cpp b/utils/mapnik-index/mapnik-index.cpp index 895db2714..a56f48a7c 100644 --- a/utils/mapnik-index/mapnik-index.cpp +++ b/utils/mapnik-index/mapnik-index.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ int main(int argc, char** argv) { // using namespace mapnik; namespace po = boost::program_options; + mapnik::setup(); bool verbose = false; bool validate_features = false; unsigned int depth = DEFAULT_DEPTH; diff --git a/utils/mapnik-render/mapnik-render.cpp b/utils/mapnik-render/mapnik-render.cpp index 608dea754..f4fd96d33 100644 --- a/utils/mapnik-render/mapnik-render.cpp +++ b/utils/mapnik-render/mapnik-render.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -21,6 +22,8 @@ int main(int argc, char** argv) { namespace po = boost::program_options; + mapnik::setup(); + bool verbose = false; bool auto_open = false; int return_value = 0; diff --git a/utils/ogrindex/ogrindex.cpp b/utils/ogrindex/ogrindex.cpp index f4b39d8fe..d6bf7a38d 100644 --- a/utils/ogrindex/ogrindex.cpp +++ b/utils/ogrindex/ogrindex.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -60,6 +61,7 @@ int main(int argc, char** argv) double ratio = DEFAULT_RATIO; vector ogr_files; + mapnik::setup(); try { po::options_description desc("ogrindex utility"); diff --git a/utils/pgsql2sqlite/main.cpp b/utils/pgsql2sqlite/main.cpp index 14a698124..25b51bc94 100644 --- a/utils/pgsql2sqlite/main.cpp +++ b/utils/pgsql2sqlite/main.cpp @@ -24,6 +24,7 @@ #include "pgsql2sqlite.hpp" #include #include +#include #include "connection_manager.hpp" #include @@ -46,6 +47,7 @@ int main(int argc, char** argv) po::options_description desc("Postgresql/PostGIS to SQLite3 converter\n Options"); std::string usage = "usage: pgsql2sqlite --dbname db --table planet_osm_line --file osm.sqlite --query \"select * " "from planet_osm_line\""; + mapnik::setup(); try { // clang-format off diff --git a/utils/shapeindex/shapeindex.cpp b/utils/shapeindex/shapeindex.cpp index 914d122d4..d205603c5 100644 --- a/utils/shapeindex/shapeindex.cpp +++ b/utils/shapeindex/shapeindex.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,7 @@ int main(int argc, char** argv) double ratio = DEFAULT_RATIO; std::vector shape_files; + mapnik::setup(); try { po::options_description desc("shapeindex utility"); diff --git a/utils/svg2png/svg2png.cpp b/utils/svg2png/svg2png.cpp index 2307781be..7a78b7dde 100644 --- a/utils/svg2png/svg2png.cpp +++ b/utils/svg2png/svg2png.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -160,6 +161,7 @@ int main(int argc, char** argv) bool strict = false; int status = 0; std::vector svg_files; + mapnik::setup(); mapnik::logger::instance().set_severity(mapnik::logger::error); double scale_factor = 1.0; std::string usage = "Usage: svg2png [options] ";