refactor datasource plugins
fix merge remove old DATASOURCE_PLUGIN call fix memory_datasource wip wip fix temp return fix install wip before_unload linux remove docker remove docker comments add windows error message if libmapnik=static and plugins=dynamic fix false plugin macro plugin default de/constructor to remove UB simplyfy plugin targets - add fpic fix makro simplyfy use unique_ptr for plugin handle rename option static plugins replace local init with fnc call call setup everywhere init datasource_static
This commit is contained in:
parent
8a1f2579e9
commit
42f465f842
74 changed files with 474 additions and 519 deletions
|
@ -1,3 +0,0 @@
|
|||
build
|
||||
.vs
|
||||
.vscode
|
55
.github/workflows/docker-image.yml
vendored
55
.github/workflows/docker-image.yml
vendored
|
@ -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 }}
|
|
@ -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()
|
||||
|
|
41
Dockerfile
41
Dockerfile
|
@ -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
|
|
@ -2,6 +2,7 @@
|
|||
#define MAPNIK_BENCH_FRAMEWORK_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/value/types.hpp>
|
||||
|
@ -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; \
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -349,6 +349,7 @@ class test7 : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
return benchmark::sequencer(argc, argv)
|
||||
.run<test4>("calloc")
|
||||
.run<test1>("malloc/memcpy")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -101,6 +101,7 @@ class test2 : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
int return_value = 0;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -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<test_static>("static_cast").run<test_numeric>("numeric_cast").done();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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/");
|
||||
|
|
|
@ -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<double> from(-180, -80, 180, 80);
|
||||
mapnik::box2d<double> to(-20037508.3427892476, -15538711.0963092316, 20037508.3427892476, 15538711.0963092316);
|
||||
std::string from_str("epsg:4326");
|
||||
|
|
|
@ -95,6 +95,7 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
int return_value = 0;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -150,6 +150,7 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
int return_value = 0;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/layer.hpp>
|
||||
#include <mapnik/rule.hpp>
|
||||
|
@ -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";
|
||||
|
|
|
@ -23,12 +23,14 @@
|
|||
#include <QSettings>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#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)
|
||||
|
|
|
@ -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
|
||||
|
|
9
include/mapnik/mapnik.hpp
Normal file
9
include/mapnik/mapnik.hpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef MAPNIK_MAPNIK_HPP
|
||||
#define MAPNIK_MAPNIK_HPP
|
||||
#include "config.hpp"
|
||||
|
||||
namespace mapnik {
|
||||
MAPNIK_DECL void setup();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -26,12 +26,14 @@
|
|||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/datasource_plugin.hpp>
|
||||
|
||||
// stl
|
||||
#include <deque>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
DATASOURCE_PLUGIN_DEF(memory_datasource_plugin, memory)
|
||||
class MAPNIK_DECL memory_datasource : public datasource
|
||||
{
|
||||
friend class memory_featureset;
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/util/noncopyable.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
@ -50,8 +50,7 @@ class PluginInfo : util::noncopyable
|
|||
|
||||
private:
|
||||
std::string filename_;
|
||||
std::string name_;
|
||||
mapnik_lib_t* module_;
|
||||
std::unique_ptr<mapnik_lib_t> module_;
|
||||
};
|
||||
} // namespace mapnik
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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}")
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
#ifndef DATASOURCE_PLUGIN_HPP
|
||||
#define DATASOURCE_PLUGIN_HPP
|
||||
#include <string>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
||||
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<pluginclassname>(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) \
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <mapnik/timer.hpp>
|
||||
#include <mapnik/util/utf_conv_win.hpp>
|
||||
#include <mapnik/util/trim.hpp>
|
||||
#include <mapnik/datasource_plugin.hpp>
|
||||
|
||||
#include <mapnik/warning.hpp>
|
||||
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
19
src/create_image_reader.hpp
Normal file
19
src/create_image_reader.hpp
Normal file
|
@ -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
|
|
@ -24,6 +24,7 @@
|
|||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/datasource_plugin.hpp>
|
||||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/plugin.hpp>
|
||||
|
@ -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<create_ds>(itr->second->get_symbol("create"));
|
||||
datasource_plugin* create_datasource = reinterpret_cast<datasource_plugin*>(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()
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
|
||||
#define REGISTER_STATIC_DATASOURCE_PLUGIN(classname) \
|
||||
{ \
|
||||
std::string{classname::kName}, std::make_shared<classname>() \
|
||||
}
|
||||
|
||||
// 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<classname>())
|
||||
namespace mapnik {
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
|
||||
template<typename T>
|
||||
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<std::string, std::shared_ptr<datasource_plugin>>;
|
||||
|
||||
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;
|
||||
|
|
|
@ -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<std::filebuf>(filename);
|
||||
|
@ -101,10 +100,11 @@ image_reader* create_jpeg_reader2(char const* data, size_t size)
|
|||
{
|
||||
return new jpeg_reader<mapnik::util::char_array_buffer>(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<typename T>
|
||||
|
|
41
src/mapnik.cpp
Normal file
41
src/mapnik.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include <mapnik/mapnik.hpp>
|
||||
#include <mutex> // 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
|
|
@ -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<double>& 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)
|
||||
|
|
|
@ -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<datasource_plugin*>(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<callable_returning_string>(dlsym(module_->dl, library_name.c_str()));
|
||||
if (name_call)
|
||||
name_ = name_call();
|
||||
callable_returning_void init_once =
|
||||
reinterpret_cast<callable_returning_void>(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<mapnik_lib_t>()}
|
||||
{
|
||||
#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<datasource_plugin*>(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()
|
||||
|
|
|
@ -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<std::filebuf>(filename);
|
||||
|
@ -92,9 +90,11 @@ image_reader* create_png_reader2(char const* data, std::size_t size)
|
|||
return new png_reader<mapnik::util::char_array_buffer>(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)
|
||||
{
|
||||
|
|
|
@ -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<mapnik::util::char_array_buffer>(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
|
||||
|
|
|
@ -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<external_buffer_policy>(data, size);
|
||||
|
@ -121,10 +120,11 @@ image_reader* create_webp_reader2(std::string const& filename)
|
|||
return new webp_reader<internal_buffer_policy>(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<typename T>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/memory_datasource.hpp>
|
||||
#include <mapnik/json/feature_parser.hpp>
|
||||
|
@ -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");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
@ -11,6 +12,7 @@
|
|||
|
||||
TEST_CASE("datasource_cache")
|
||||
{
|
||||
mapnik::setup();
|
||||
SECTION("registration")
|
||||
{
|
||||
try
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
|
@ -13,6 +14,7 @@
|
|||
|
||||
TEST_CASE("font")
|
||||
{
|
||||
mapnik::setup();
|
||||
SECTION("registration")
|
||||
{
|
||||
try
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/load_map.hpp>
|
||||
#include <mapnik/save_map.hpp>
|
||||
|
@ -142,6 +143,7 @@ const bool registered =
|
|||
|
||||
TEST_CASE("map xml I/O")
|
||||
{
|
||||
mapnik::setup();
|
||||
// make sure plugins are loaded
|
||||
REQUIRE(registered);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "catch.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
|
@ -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))
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "runner.hpp"
|
||||
#include "config.hpp"
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
|
||||
|
@ -166,6 +167,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
mapnik::setup();
|
||||
#ifdef MAPNIK_LOG
|
||||
std::string log_level(vm["log"].as<std::string>());
|
||||
log_levels_map::const_iterator level_iter = log_levels.find(log_level);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
|
@ -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]);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/version.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/quad_tree.hpp>
|
||||
|
@ -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;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/load_map.hpp>
|
||||
#include <mapnik/agg_renderer.hpp>
|
||||
|
@ -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;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/geometry/box2d.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
|
@ -60,6 +61,7 @@ int main(int argc, char** argv)
|
|||
double ratio = DEFAULT_RATIO;
|
||||
vector<string> ogr_files;
|
||||
|
||||
mapnik::setup();
|
||||
try
|
||||
{
|
||||
po::options_description desc("ogrindex utility");
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "pgsql2sqlite.hpp"
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include "connection_manager.hpp"
|
||||
|
||||
#include <mapnik/warning.hpp>
|
||||
|
@ -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
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/version.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/quad_tree.hpp>
|
||||
|
@ -58,6 +59,7 @@ int main(int argc, char** argv)
|
|||
double ratio = DEFAULT_RATIO;
|
||||
std::vector<std::string> shape_files;
|
||||
|
||||
mapnik::setup();
|
||||
try
|
||||
{
|
||||
po::options_description desc("shapeindex utility");
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/version.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/marker.hpp>
|
||||
|
@ -160,6 +161,7 @@ int main(int argc, char** argv)
|
|||
bool strict = false;
|
||||
int status = 0;
|
||||
std::vector<std::string> svg_files;
|
||||
mapnik::setup();
|
||||
mapnik::logger::instance().set_severity(mapnik::logger::error);
|
||||
double scale_factor = 1.0;
|
||||
std::string usage = "Usage: svg2png [options] <svg-file(s)>";
|
||||
|
|
Loading…
Reference in a new issue