Finalize static plugins

This commit is contained in:
Mathis Logemann 2022-11-28 08:31:25 +01:00
parent be46202511
commit bc38652079
33 changed files with 173 additions and 167 deletions

View file

@ -27,14 +27,14 @@ runs:
- name: Test visuals (windows) - name: Test visuals (windows)
continue-on-error: true continue-on-error: true
working-directory: build/${{ inputs.cmake-preset }}/out working-directory: build/out
shell: "pwsh" shell: "pwsh"
if: runner.os == 'Windows' if: runner.os == 'Windows'
run: OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --input_coverage=${{ github.workspace }}/ctest.cov --cover_children -- .\mapnik-test-visual.exe -j (Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors --output-dir ./visual-test-result run: OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --input_coverage=${{ github.workspace }}/ctest.cov --cover_children -- .\mapnik-test-visual.exe -j (Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors --output-dir ./visual-test-result
- name: Test visuals (linux & mac) - name: Test visuals (linux & mac)
continue-on-error: true continue-on-error: true
working-directory: build/${{ inputs.cmake-preset }}/out working-directory: build/out
shell: "bash" shell: "bash"
if: runner.os != 'Windows' if: runner.os != 'Windows'
run: | run: |
@ -45,7 +45,7 @@ runs:
fi fi
- name: Pack visual test results - name: Pack visual test results
working-directory: build/${{ inputs.cmake-preset }}/out working-directory: build/out
shell: "pwsh" shell: "pwsh"
run: tar cfvz visual-test-results.tar.gz ./visual-test-result run: tar cfvz visual-test-results.tar.gz ./visual-test-result
@ -60,16 +60,16 @@ runs:
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ inputs.cmake-preset }}-visual-tests-${{ steps.run-guid.outputs.GUID }} name: ${{ inputs.cmake-preset }}-visual-tests-${{ steps.run-guid.outputs.GUID }}
path: build/${{ inputs.cmake-preset }}/out/visual-test-results.tar.gz path: build/out/visual-test-results.tar.gz
- name: Run Benchmarks - name: Run Benchmarks
working-directory: build/${{ inputs.cmake-preset }}/out working-directory: build/out
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: "pwsh" shell: "pwsh"
run: ./run_benchmarks run: ./run_benchmarks
- name: Collect coverage (linux & macos) - name: Collect coverage (linux & macos)
working-directory: build/${{ inputs.cmake-preset }} working-directory: build
if: runner.os != 'Windows' if: runner.os != 'Windows'
shell: "bash" shell: "bash"
run: | run: |
@ -81,10 +81,10 @@ runs:
if: runner.os != 'Windows' if: runner.os != 'Windows'
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
with: with:
files: build/${{ inputs.cmake-preset }}/coverage.info files: build/coverage.info
- name: Upload coverage to Codecov (windows) - name: Upload coverage to Codecov (windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
with: with:
files: build/${{ inputs.cmake-preset }}/out/mapnik-test-visual.cov files: build/out/mapnik-test-visual.cov

View file

@ -32,6 +32,7 @@ jobs:
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
memory-mapped: ["OFF", "ON"] memory-mapped: ["OFF", "ON"]
static-build: ["OFF", "ON"]
include: include:
- os: ubuntu-latest - os: ubuntu-latest
mono: mono mono: mono
@ -82,7 +83,7 @@ jobs:
echo "PRESET=${{ steps.lc_platform.outputs.lowercase }}-ci" >>${GITHUB_ENV} echo "PRESET=${{ steps.lc_platform.outputs.lowercase }}-ci" >>${GITHUB_ENV}
- name: Configure CMake - name: Configure CMake
run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ matrix.memory-mapped }} --preset ${{ env.PRESET }} run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ matrix.memory-mapped }} -DBUILD_SHARED_LIBS=${{ matrix.static-build }} --preset ${{ env.PRESET }}
- name: Build - name: Build
run: cmake --build --preset ${{ env.PRESET }} run: cmake --build --preset ${{ env.PRESET }}

View file

@ -17,7 +17,7 @@ For a complete change history, see the git log.
#### Breaking Changes #### Breaking Changes
- Reworked datasource plugin system. Plugins now need to implement a class with the macros in `datasource_plugin.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291)) - Reworked datasource plugin system. Plugins now need to implement a class with the macros in `datasource_plugin.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291))
- mapnik now has a global `mapnik::setup()` method which have to be called before any other functions of mapnik. Defined in `mapnik.hpp`. Note: In order not to insert this change into every code base, it is currently still called during the dynamic initialisation time. However, if mapnik is compiled statically, this function must be called. ([#4291](https://github.com/mapnik/mapnik/pull/4291)) - mapnik now has a global `mapnik::setup()` method which have to be called before any other functions of mapnik. Defined in `mapnik.hpp`. Currently there is a auto setup functionality. It can be disabled using the cmake option `DISABLE_MAPNIK_AUTOSETUP=ON`. Note: In order not to insert this change into every code base, it is currently still called during the dynamic initialisation time. However, if mapnik is compiled statically, this function must be called. ([#4291](https://github.com/mapnik/mapnik/pull/4291))
#### Core #### Core

View file

@ -62,6 +62,8 @@ 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") 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(USE_STATS "Enable statistics reporting" OFF)
mapnik_option(DISABLE_MAPNIK_AUTOSETUP "disables the autosetup. Need to call mapnik::setup() then" OFF)
mapnik_option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON) 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_GDAL "adds plugin input gdal" ON)
mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON) mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON)
@ -361,6 +363,10 @@ if(NOT BUILD_SHARED_LIBS)
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_DEFINE) list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_DEFINE)
endif() endif()
if(DISABLE_MAPNIK_AUTOSETUP)
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_DISABLE_AUTOSETUP)
endif()
# force utf-8 source code processing # force utf-8 source code processing
# see https://docs.microsoft.com/de-de/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170 # see https://docs.microsoft.com/de-de/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170
add_compile_options( add_compile_options(

View file

@ -17,7 +17,7 @@
{ {
"name": "default-build-dir", "name": "default-build-dir",
"hidden": true, "hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}" "binaryDir": "${sourceDir}/build"
}, },
{ {
"name": "debug-build", "name": "debug-build",
@ -180,8 +180,9 @@
"cacheVariables": { "cacheVariables": {
"BUILD_TESTING": "ON", "BUILD_TESTING": "ON",
"BUILD_DEMO_VIEWER": "OFF", "BUILD_DEMO_VIEWER": "OFF",
"CMAKE_TOOLCHAIN_FILE": "vcpkg/scripts/buildsystems/vcpkg.cmake" "DISABLE_MAPNIK_AUTOSETUP": "ON"
} },
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake"
}, },
{ {
"name": "windows-ci", "name": "windows-ci",
@ -192,10 +193,10 @@
], ],
"cacheVariables": { "cacheVariables": {
"INSTALL_DEPENDENCIES": "ON", "INSTALL_DEPENDENCIES": "ON",
"ADDITIONAL_LIBARIES_PATHS": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-windows/bin" "ADDITIONAL_LIBARIES_PATHS": "${sourceDir}/build/vcpkg_installed/x64-windows/bin"
}, },
"environment": { "environment": {
"PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-windows/share/proj" "PROJ_LIB": "${sourceDir}/build/vcpkg_installed/x64-windows/share/proj"
} }
}, },
{ {
@ -210,7 +211,7 @@
"CMAKE_CXX_FLAGS": "--coverage" "CMAKE_CXX_FLAGS": "--coverage"
}, },
"environment": { "environment": {
"PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-linux/share/proj" "PROJ_LIB": "${sourceDir}/build/vcpkg_installed/x64-linux/share/proj"
} }
}, },
{ {
@ -239,7 +240,7 @@
"CMAKE_CXX_FLAGS": "-fprofile-arcs -ftest-coverage" "CMAKE_CXX_FLAGS": "-fprofile-arcs -ftest-coverage"
}, },
"environment": { "environment": {
"PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-osx/share/proj" "PROJ_LIB": "${sourceDir}/build/vcpkg_installed/x64-osx/share/proj"
} }
} }
], ],

View file

@ -31,7 +31,11 @@ function(mapnik_create_benchmark)
set(TARGET_NAME "mapnik-benchmark-${BENCHNAME}") set(TARGET_NAME "mapnik-benchmark-${BENCHNAME}")
add_executable(${TARGET_NAME} ${ARGV0}) add_executable(${TARGET_NAME} ${ARGV0})
target_include_directories(${TARGET_NAME} PRIVATE include) target_include_directories(${TARGET_NAME} PRIVATE include)
target_link_libraries(${TARGET_NAME} PRIVATE mapnik::agg mapnik::mapnik) target_link_libraries(${TARGET_NAME} PRIVATE
mapnik::agg
mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
)
set_target_properties(${TARGET_NAME} PROPERTIES set_target_properties(${TARGET_NAME} PROPERTIES
OUTPUT_NAME "${BENCHNAME}" OUTPUT_NAME "${BENCHNAME}"
) )

View file

@ -1,5 +1,6 @@
#include "bench_framework.hpp" #include "bench_framework.hpp"
#include "compare_images.hpp" #include "compare_images.hpp"
#include <memory>
class test : public benchmark::test_case class test : public benchmark::test_case
{ {

View file

@ -1,2 +1,6 @@
add_executable(mapnik-demo rundemo.cpp) add_executable(mapnik-demo rundemo.cpp)
target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik) target_link_libraries(mapnik-demo PRIVATE
mapnik::agg
mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
)

View file

@ -46,6 +46,7 @@ target_link_libraries(mapnik-viewer PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Widgets
mapnik::agg mapnik::agg
mapnik::mapnik mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini

View file

@ -48,11 +48,9 @@ namespace css_color_grammar {
using x3::attr; using x3::attr;
using x3::double_; using x3::double_;
using x3::hex;
using x3::lit; using x3::lit;
using x3::no_case; using x3::no_case;
using x3::no_skip; using x3::no_skip;
using x3::omit;
using x3::symbols; using x3::symbols;
using x3::uint_parser; using x3::uint_parser;
@ -214,11 +212,11 @@ struct named_colors_ : x3::symbols<color>
; ;
// clang-format on // clang-format on
} }
} named_colors; } const named_colors;
x3::uint_parser<std::uint8_t, 16, 2, 2> hex2; const x3::uint_parser<std::uint8_t, 16, 2, 2> hex2;
x3::uint_parser<std::uint8_t, 16, 1, 1> hex1; const x3::uint_parser<std::uint8_t, 16, 1, 1> hex1;
x3::uint_parser<std::uint16_t, 10, 1, 3> dec3; const x3::uint_parser<std::uint16_t, 10, 1, 3> dec3;
// rules // rules
x3::rule<class hex2_color, color> const hex2_color("hex2_color"); x3::rule<class hex2_color, color> const hex2_color("hex2_color");
@ -245,67 +243,67 @@ struct percent_converter
static std::uint8_t call(double val) { return safe_cast<std::uint8_t>(std::lround((255.0 * val) / 100.0)); } static std::uint8_t call(double val) { return safe_cast<std::uint8_t>(std::lround((255.0 * val) / 100.0)); }
}; };
auto dec_red = [](auto& ctx) { const auto dec_red = [](auto& ctx) {
_val(ctx).red_ = _attr(ctx); _val(ctx).red_ = _attr(ctx);
}; };
auto dec_green = [](auto& ctx) { const auto dec_green = [](auto& ctx) {
_val(ctx).green_ = _attr(ctx); _val(ctx).green_ = _attr(ctx);
}; };
auto dec_blue = [](auto& ctx) { const auto dec_blue = [](auto& ctx) {
_val(ctx).blue_ = _attr(ctx); _val(ctx).blue_ = _attr(ctx);
}; };
auto opacity = [](auto& ctx) { const auto opacity = [](auto& ctx) {
_val(ctx).alpha_ = uint8_t((255.0 * clip_opacity::call(_attr(ctx))) + 0.5); _val(ctx).alpha_ = uint8_t((255.0 * clip_opacity::call(_attr(ctx))) + 0.5);
}; };
auto percent_red = [](auto& ctx) { const auto percent_red = [](auto& ctx) {
_val(ctx).red_ = percent_converter::call(_attr(ctx)); _val(ctx).red_ = percent_converter::call(_attr(ctx));
}; };
auto percent_green = [](auto& ctx) { const auto percent_green = [](auto& ctx) {
_val(ctx).green_ = percent_converter::call(_attr(ctx)); _val(ctx).green_ = percent_converter::call(_attr(ctx));
}; };
auto percent_blue = [](auto& ctx) { const auto percent_blue = [](auto& ctx) {
_val(ctx).blue_ = percent_converter::call(_attr(ctx)); _val(ctx).blue_ = percent_converter::call(_attr(ctx));
}; };
auto hex1_red = [](auto& ctx) { const auto hex1_red = [](auto& ctx) {
_val(ctx).red_ = _attr(ctx) | _attr(ctx) << 4; _val(ctx).red_ = _attr(ctx) | _attr(ctx) << 4;
}; };
auto hex1_green = [](auto& ctx) { const auto hex1_green = [](auto& ctx) {
_val(ctx).green_ = _attr(ctx) | _attr(ctx) << 4; _val(ctx).green_ = _attr(ctx) | _attr(ctx) << 4;
}; };
auto hex1_blue = [](auto& ctx) { const auto hex1_blue = [](auto& ctx) {
_val(ctx).blue_ = _attr(ctx) | _attr(ctx) << 4; _val(ctx).blue_ = _attr(ctx) | _attr(ctx) << 4;
}; };
auto hex1_opacity = [](auto& ctx) { const auto hex1_opacity = [](auto& ctx) {
_val(ctx).alpha_ = _attr(ctx) | _attr(ctx) << 4; _val(ctx).alpha_ = _attr(ctx) | _attr(ctx) << 4;
}; };
auto hex2_red = [](auto& ctx) { const auto hex2_red = [](auto& ctx) {
_val(ctx).red_ = _attr(ctx); _val(ctx).red_ = _attr(ctx);
}; };
auto hex2_green = [](auto& ctx) { const auto hex2_green = [](auto& ctx) {
_val(ctx).green_ = _attr(ctx); _val(ctx).green_ = _attr(ctx);
}; };
auto hex2_blue = [](auto& ctx) { const auto hex2_blue = [](auto& ctx) {
_val(ctx).blue_ = _attr(ctx); _val(ctx).blue_ = _attr(ctx);
}; };
auto hex2_opacity = [](auto& ctx) { const auto hex2_opacity = [](auto& ctx) {
_val(ctx).alpha_ = _attr(ctx); _val(ctx).alpha_ = _attr(ctx);
}; };
auto hsl_to_rgba = [](auto& ctx) { const auto hsl_to_rgba = [](auto& ctx) {
double h = std::get<0>(_attr(ctx)); double h = std::get<0>(_attr(ctx));
double s = std::get<1>(_attr(ctx)); double s = std::get<1>(_attr(ctx));
double l = std::get<2>(_attr(ctx)); double l = std::get<2>(_attr(ctx));
@ -325,10 +323,10 @@ auto hsl_to_rgba = [](auto& ctx) {
} }
m1 = l * 2 - m2; m1 = l * 2 - m2;
double r = hue_to_rgb(m1, m2, h + 1.0 / 3.0); const double r = hue_to_rgb(m1, m2, h + 1.0 / 3.0);
double g = hue_to_rgb(m1, m2, h); const double g = hue_to_rgb(m1, m2, h);
double b = hue_to_rgb(m1, m2, h - 1.0 / 3.0); const double b = hue_to_rgb(m1, m2, h - 1.0 / 3.0);
uint8_t alpha = uint8_t((255.0 * clip_opacity::call(std::get<3>(_attr(ctx)))) + 0.5); const uint8_t alpha = uint8_t((255.0 * clip_opacity::call(std::get<3>(_attr(ctx)))) + 0.5);
_val(ctx) = color(safe_cast<uint8_t>(std::lround(255.0 * r)), _val(ctx) = color(safe_cast<uint8_t>(std::lround(255.0 * r)),
safe_cast<uint8_t>(std::lround(255.0 * g)), safe_cast<uint8_t>(std::lround(255.0 * g)),
safe_cast<uint8_t>(std::lround(255.0 * b)), safe_cast<uint8_t>(std::lround(255.0 * b)),

View file

@ -150,32 +150,27 @@ namespace css_grammar {
using x3::alnum; using x3::alnum;
using x3::alpha; using x3::alpha;
using x3::attr;
using x3::char_; using x3::char_;
using x3::lexeme; using x3::lexeme;
using x3::lit; using x3::lit;
using x3::no_case;
using x3::no_skip;
using x3::raw; using x3::raw;
using x3::standard::space; using x3::standard::space;
// import unicode string rule // import unicode string rule
namespace { const auto css_string = mapnik::json::grammar::unicode_string;
auto const& css_string = mapnik::json::grammar::unicode_string;
}
auto assign_def = [](auto const& ctx) { const auto assign_def = [](auto const& ctx) {
for (auto const& k : std::get<0>(_attr(ctx))) for (auto const& k : std::get<0>(_attr(ctx)))
{ {
_val(ctx).emplace(k, std::get<1>(_attr(ctx))); _val(ctx).emplace(k, std::get<1>(_attr(ctx)));
} }
}; };
auto assign_key = [](auto const& ctx) { const auto assign_key = [](auto const& ctx) {
_val(ctx).first = std::move(_attr(ctx)); _val(ctx).first = std::move(_attr(ctx));
}; };
auto assign_value = [](auto const& ctx) { const auto assign_value = [](auto const& ctx) {
_val(ctx).second = std::move(_attr(ctx)); _val(ctx).second = std::move(_attr(ctx));
}; };

View file

@ -56,7 +56,7 @@ struct unesc_char_csv_ : x3::symbols<char>
("\"\"", '\"') // double quote ("\"\"", '\"') // double quote
; ;
} }
} unesc_char_csv; } const unesc_char_csv;
template<typename T> template<typename T>
struct literal : x3::parser<literal<T>> struct literal : x3::parser<literal<T>>

View file

@ -51,23 +51,17 @@ namespace grammar {
namespace x3 = boost::spirit::x3; namespace x3 = boost::spirit::x3;
namespace ascii = boost::spirit::x3::ascii; namespace ascii = boost::spirit::x3::ascii;
using ascii::char_; using ascii::char_;
using ascii::string;
using x3::_attr; using x3::_attr;
using x3::_val; using x3::_val;
using x3::alnum; using x3::alnum;
using x3::alpha; using x3::alpha;
using x3::bool_;
using x3::double_;
using x3::int_;
using x3::lexeme; using x3::lexeme;
using x3::lit; using x3::lit;
using x3::no_case; using x3::no_case;
using x3::no_skip; using x3::no_skip;
x3::uint_parser<char, 16, 2, 2> const hex2{}; x3::uint_parser<char, 16, 2, 2> const hex2{};
namespace { const auto escaped_unicode = json::grammar::escaped_unicode;
auto const& escaped_unicode = json::grammar::escaped_unicode;
}
template<typename Context> template<typename Context>
inline mapnik::transcoder const& extract_transcoder(Context const& ctx) inline mapnik::transcoder const& extract_transcoder(Context const& ctx)
@ -75,19 +69,19 @@ inline mapnik::transcoder const& extract_transcoder(Context const& ctx)
return x3::get<transcoder_tag>(ctx); return x3::get<transcoder_tag>(ctx);
} }
auto append = [](auto const& ctx) { const auto append = [](auto const& ctx) {
_val(ctx) += _attr(ctx); _val(ctx) += _attr(ctx);
}; };
auto do_assign = [](auto const& ctx) { const auto do_assign = [](auto const& ctx) {
_val(ctx) = std::move(_attr(ctx)); _val(ctx) = std::move(_attr(ctx));
}; };
auto do_negate = [](auto const& ctx) { const auto do_negate = [](auto const& ctx) {
_val(ctx) = std::move(unary_node<mapnik::tags::negate>(_attr(ctx))); _val(ctx) = std::move(unary_node<mapnik::tags::negate>(_attr(ctx)));
}; };
auto do_attribute = [](auto const& ctx) { const auto do_attribute = [](auto const& ctx) {
auto const& attr = _attr(ctx); auto const& attr = _attr(ctx);
if (attr == "mapnik::geometry_type") if (attr == "mapnik::geometry_type")
{ {
@ -99,84 +93,84 @@ auto do_attribute = [](auto const& ctx) {
} }
}; };
auto do_global_attribute = [](auto const& ctx) { const auto do_global_attribute = [](auto const& ctx) {
_val(ctx) = std::move(global_attribute(_attr(ctx))); _val(ctx) = std::move(global_attribute(_attr(ctx)));
}; };
auto do_add = [](auto const& ctx) { const auto do_add = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::plus>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::plus>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_subt = [](auto const& ctx) { const auto do_subt = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::minus>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::minus>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_mult = [](auto const& ctx) { const auto do_mult = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::mult>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::mult>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_div = [](auto const& ctx) { const auto do_div = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::div>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::div>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_mod = [](auto const& ctx) { const auto do_mod = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::mod>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::mod>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_unicode = [](auto const& ctx) { const auto do_unicode = [](auto const& ctx) {
auto const& tr = extract_transcoder(ctx); auto const& tr = extract_transcoder(ctx);
_val(ctx) = std::move(tr.transcode(_attr(ctx).c_str())); _val(ctx) = std::move(tr.transcode(_attr(ctx).c_str()));
}; };
auto do_null = [](auto const& ctx) { const auto do_null = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::value_null()); _val(ctx) = std::move(mapnik::value_null());
}; };
auto do_not = [](auto const& ctx) { const auto do_not = [](auto const& ctx) {
mapnik::unary_node<mapnik::tags::logical_not> node(_attr(ctx)); mapnik::unary_node<mapnik::tags::logical_not> node(_attr(ctx));
_val(ctx) = std::move(node); _val(ctx) = std::move(node);
}; };
auto do_and = [](auto const& ctx) { const auto do_and = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::logical_and>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::logical_and>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_or = [](auto const& ctx) { const auto do_or = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::logical_or>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::logical_or>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_equal = [](auto const& ctx) { const auto do_equal = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::equal_to>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::equal_to>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_not_equal = [](auto const& ctx) { const auto do_not_equal = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::not_equal_to>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::not_equal_to>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_less = [](auto const& ctx) { const auto do_less = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::less>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::less>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_less_equal = [](auto const& ctx) { const auto do_less_equal = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::less_equal>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::less_equal>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_greater = [](auto const& ctx) { const auto do_greater = [](auto const& ctx) {
_val(ctx) = std::move(mapnik::binary_node<mapnik::tags::greater>(std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::binary_node<mapnik::tags::greater>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_greater_equal = [](auto const& ctx) { const auto do_greater_equal = [](auto const& ctx) {
_val(ctx) = _val(ctx) =
std::move(mapnik::binary_node<mapnik::tags::greater_equal>(std::move(_val(ctx)), std::move(_attr(ctx)))); std::move(mapnik::binary_node<mapnik::tags::greater_equal>(std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
// regex // regex
auto do_regex_match = [](auto const& ctx) { const auto do_regex_match = [](auto const& ctx) {
auto const& tr = extract_transcoder(ctx); auto const& tr = extract_transcoder(ctx);
_val(ctx) = std::move(mapnik::regex_match_node(tr, std::move(_val(ctx)), std::move(_attr(ctx)))); _val(ctx) = std::move(mapnik::regex_match_node(tr, std::move(_val(ctx)), std::move(_attr(ctx))));
}; };
auto do_regex_replace = [](auto const& ctx) { const auto do_regex_replace = [](auto const& ctx) {
auto const& tr = extract_transcoder(ctx); auto const& tr = extract_transcoder(ctx);
auto const& pair = _attr(ctx); auto const& pair = _attr(ctx);
auto const& pattern = std::get<0>(pair); auto const& pattern = std::get<0>(pair);
@ -197,7 +191,7 @@ struct boolean_ : x3::symbols<mapnik::value_bool>
("false", false) // ("false", false) //
; ;
} }
} boolean; } const boolean;
struct floating_point_constants : x3::symbols<mapnik::value_double> struct floating_point_constants : x3::symbols<mapnik::value_double>
{ {
@ -208,7 +202,7 @@ struct floating_point_constants : x3::symbols<mapnik::value_double>
("rad_to_deg", 57.295779513082320876798154814105) // ("rad_to_deg", 57.295779513082320876798154814105) //
; ;
} }
} float_const; } const float_const;
// unary functions // unary functions
struct unary_function_types_ : x3::symbols<unary_function_impl> struct unary_function_types_ : x3::symbols<unary_function_impl>
@ -225,7 +219,7 @@ struct unary_function_types_ : x3::symbols<unary_function_impl>
("length", length_impl()) // ("length", length_impl()) //
; ;
} }
} unary_func_types; } const unary_func_types;
// binary functions // binary functions
@ -238,7 +232,7 @@ struct binary_function_types_ : x3::symbols<binary_function_impl>
("pow", binary_function_impl(pow_impl)) // ("pow", binary_function_impl(pow_impl)) //
; ;
} }
} binary_func_types; } const binary_func_types;
// geometry types // geometry types
struct geometry_types_ : x3::symbols<mapnik::value_integer> struct geometry_types_ : x3::symbols<mapnik::value_integer>
@ -251,7 +245,7 @@ struct geometry_types_ : x3::symbols<mapnik::value_integer>
("collection", 4) // ("collection", 4) //
; ;
} }
} geometry_type; } const geometry_type;
struct unesc_chars_ : x3::symbols<char> struct unesc_chars_ : x3::symbols<char>
{ {
@ -269,7 +263,7 @@ struct unesc_chars_ : x3::symbols<char>
("\\\"", '\"') // ("\\\"", '\"') //
; ;
} }
} unesc_char; } const unesc_char;
// rules // rules
x3::rule<class logical_expression, mapnik::expr_node> const logical_expression("logical expression"); x3::rule<class logical_expression, mapnik::expr_node> const logical_expression("logical expression");

View file

@ -57,41 +57,35 @@ namespace x3 = boost::spirit::x3;
namespace image_filter { namespace image_filter {
using x3::attr;
using x3::char_;
using x3::double_; using x3::double_;
using x3::hex;
using x3::lit; using x3::lit;
using x3::no_case;
using x3::no_skip;
using x3::omit;
using x3::symbols; using x3::symbols;
using x3::uint_parser; using x3::uint_parser;
auto push_back = [](auto& ctx) { const auto push_back = [](auto& ctx) {
_val(ctx).push_back(_attr(ctx)); _val(ctx).push_back(_attr(ctx));
}; };
auto set_rx_ry = [](auto& ctx) { const auto set_rx_ry = [](auto& ctx) {
_val(ctx).rx = _val(ctx).ry = _attr(ctx); _val(ctx).rx = _val(ctx).ry = _attr(ctx);
}; };
auto set_ry = [](auto& ctx) { const auto set_ry = [](auto& ctx) {
_val(ctx).ry = _attr(ctx); _val(ctx).ry = _attr(ctx);
}; };
auto offset_value = [](auto& ctx) { const auto offset_value = [](auto& ctx) {
_val(ctx) = _attr(ctx); _val(ctx) = _attr(ctx);
}; };
auto percent = [](auto& ctx) { const auto percent = [](auto& ctx) {
double val = std::abs(_val(ctx) / 100.0); double val = std::abs(_val(ctx) / 100.0);
if (val > 1.0) if (val > 1.0)
val = 1.0; val = 1.0;
_val(ctx) = val; _val(ctx) = val;
}; };
x3::uint_parser<unsigned, 10, 1, 3> radius; const x3::uint_parser<unsigned, 10, 1, 3> radius;
// Import the expression rule // Import the expression rule
namespace { namespace {

View file

@ -154,14 +154,14 @@ struct geometry_type_ : x3::symbols<mapnik::geometry::geometry_types>
("\"GeometryCollection\"", mapnik::geometry::geometry_types::GeometryCollection) // ("\"GeometryCollection\"", mapnik::geometry::geometry_types::GeometryCollection) //
; ;
} }
} geometry_type_symbols; } const geometry_type_symbols;
namespace { namespace {
auto assign_name = [](auto const& ctx) { const auto assign_name = [](auto const& ctx) {
std::get<0>(_val(ctx)) = std::move(_attr(ctx)); std::get<0>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_value = [](auto const& ctx) { const auto assign_value = [](auto const& ctx) {
std::get<1>(_val(ctx)) = std::move(_attr(ctx)); std::get<1>(_val(ctx)) = std::move(_attr(ctx));
}; };
@ -207,7 +207,7 @@ auto const assign_collection = [](auto const& ctx) {
std::get<2>(_val(ctx)) = std::move(_attr(ctx)); std::get<2>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_property = [](auto const& ctx) { const auto assign_property = [](auto const& ctx) {
mapnik::feature_impl& feature = x3::get<grammar::feature_tag>(ctx); mapnik::feature_impl& feature = x3::get<grammar::feature_tag>(ctx);
mapnik::transcoder const& tr = x3::get<grammar::transcoder_tag>(ctx); mapnik::transcoder const& tr = x3::get<grammar::transcoder_tag>(ctx);
feature.put_new(std::get<0>(_attr(ctx)), feature.put_new(std::get<0>(_attr(ctx)),

View file

@ -35,39 +35,36 @@ namespace x3 = boost::spirit::x3;
namespace { namespace {
auto make_null = [](auto const& ctx) { const auto make_null = [](auto const& ctx) {
_val(ctx) = mapnik::value_null{}; _val(ctx) = mapnik::value_null{};
}; };
auto make_true = [](auto const& ctx) { const auto make_true = [](auto const& ctx) {
_val(ctx) = true; _val(ctx) = true;
}; };
auto make_false = [](auto const& ctx) { const auto make_false = [](auto const& ctx) {
_val(ctx) = false; _val(ctx) = false;
}; };
auto assign = [](auto const& ctx) { const auto assign = [](auto const& ctx) {
_val(ctx) = std::move(_attr(ctx)); _val(ctx) = std::move(_attr(ctx));
}; };
auto assign_key = [](auto const& ctx) { const auto assign_key = [](auto const& ctx) {
std::get<0>(_val(ctx)) = std::move(_attr(ctx)); std::get<0>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_value = [](auto const& ctx) { const auto assign_value = [](auto const& ctx) {
std::get<1>(_val(ctx)) = std::move(_attr(ctx)); std::get<1>(_val(ctx)) = std::move(_attr(ctx));
}; };
} // namespace } // namespace
using x3::lit; using x3::lit;
using x3::string;
// import unicode string rule // import unicode string rule
namespace { const auto json_string = mapnik::json::grammar::unicode_string;
auto const& json_string = mapnik::json::grammar::unicode_string;
}
// rules // rules
x3::rule<class json_object_tag, json_object> const object("JSON Object"); x3::rule<class json_object_tag, json_object> const object("JSON Object");

View file

@ -35,30 +35,30 @@ namespace grammar {
namespace x3 = boost::spirit::x3; namespace x3 = boost::spirit::x3;
auto make_null = [](auto const& ctx) { const auto make_null = [](auto const& ctx) {
_val(ctx) = mapnik::value_null{}; _val(ctx) = mapnik::value_null{};
}; };
auto make_true = [](auto const& ctx) { const auto make_true = [](auto const& ctx) {
_val(ctx) = true; _val(ctx) = true;
}; };
auto make_false = [](auto const& ctx) { const auto make_false = [](auto const& ctx) {
_val(ctx) = false; _val(ctx) = false;
}; };
auto assign = [](auto const& ctx) { const auto assign = [](auto const& ctx) {
_val(ctx) = std::move(_attr(ctx)); _val(ctx) = std::move(_attr(ctx));
}; };
auto assign_key = [](auto const& ctx) { const auto assign_key = [](auto const& ctx) {
std::string const& name = _attr(ctx); std::string const& name = _attr(ctx);
keys_map& keys = x3::get<keys_tag>(ctx); keys_map& keys = x3::get<keys_tag>(ctx);
auto result = keys.insert(keys_map::value_type(name, keys.size() + 1)); auto result = keys.insert(keys_map::value_type(name, keys.size() + 1));
std::get<0>(_val(ctx)) = result.first->right; std::get<0>(_val(ctx)) = result.first->right;
}; };
auto assign_value = [](auto const& ctx) { const auto assign_value = [](auto const& ctx) {
std::get<1>(_val(ctx)) = std::move(_attr(ctx)); std::get<1>(_val(ctx)) = std::move(_attr(ctx));
}; };
@ -81,7 +81,7 @@ struct geometry_type_ : x3::symbols<mapnik::geometry::geometry_types>
("\"GeometryCollection\"", mapnik::geometry::geometry_types::GeometryCollection) // ("\"GeometryCollection\"", mapnik::geometry::geometry_types::GeometryCollection) //
; ;
} }
} geometry_type_sym; } const geometry_type_sym;
// rules // rules
x3::rule<class json_object_tag, geojson_object> const object("JSON Object"); x3::rule<class json_object_tag, geojson_object> const object("JSON Object");
@ -95,13 +95,9 @@ auto const geojson_double = x3::real_parser<value_double, x3::strict_real_polici
auto const geojson_integer = x3::int_parser<value_integer, 10, 1, -1>(); auto const geojson_integer = x3::int_parser<value_integer, 10, 1, -1>();
// import unicode string rule // import unicode string rule
namespace { const auto geojson_string = unicode_string;
auto const& geojson_string = unicode_string;
}
// import positions rule // import positions rule
namespace { const auto positions_rule = positions;
auto const& positions_rule = positions;
}
// GeoJSON types // GeoJSON types
// clang-format off // clang-format off

View file

@ -33,14 +33,11 @@ namespace grammar {
namespace x3 = boost::spirit::x3; namespace x3 = boost::spirit::x3;
using x3::double_; using x3::double_;
using x3::lit; using x3::lit;
using x3::no_case;
using x3::omit; using x3::omit;
namespace { const auto assign_helper = [](auto const& ctx) {
auto assign_helper = [](auto const& ctx) {
_val(ctx) = std::move(_attr(ctx)); _val(ctx) = std::move(_attr(ctx));
}; };
} // namespace
// rules // rules
x3::rule<class point_class, point> const point("Position"); x3::rule<class point_class, point> const point("Position");

View file

@ -169,7 +169,7 @@ struct create_multi_polygon
} }
}; };
auto create_geometry = [](auto const& ctx) { const auto create_geometry = [](auto const& ctx) {
auto const geom_type = std::get<0>(_attr(ctx)); auto const geom_type = std::get<0>(_attr(ctx));
auto const& coord = std::get<1>(_attr(ctx)); auto const& coord = std::get<1>(_attr(ctx));
auto const& arcs = std::get<2>(_attr(ctx)); auto const& arcs = std::get<2>(_attr(ctx));
@ -199,27 +199,27 @@ auto create_geometry = [](auto const& ctx) {
_val(ctx) = std::move(geom); _val(ctx) = std::move(geom);
}; };
auto assign_bbox = [](auto const& ctx) { const auto assign_bbox = [](auto const& ctx) {
_val(ctx).bbox = std::move(_attr(ctx)); _val(ctx).bbox = std::move(_attr(ctx));
}; };
auto assign_transform = [](auto const& ctx) { const auto assign_transform = [](auto const& ctx) {
_val(ctx).tr = std::move(_attr(ctx)); _val(ctx).tr = std::move(_attr(ctx));
}; };
auto assign_arcs = [](auto const& ctx) { const auto assign_arcs = [](auto const& ctx) {
_val(ctx).arcs = std::move(_attr(ctx)); _val(ctx).arcs = std::move(_attr(ctx));
}; };
auto assign_objects = [](auto const& ctx) { const auto assign_objects = [](auto const& ctx) {
_val(ctx).geometries = std::move(_attr(ctx)); _val(ctx).geometries = std::move(_attr(ctx));
}; };
auto push_geometry = [](auto const& ctx) { const auto push_geometry = [](auto const& ctx) {
_val(ctx).push_back(std::move(_attr(ctx))); _val(ctx).push_back(std::move(_attr(ctx)));
}; };
auto push_collection = [](auto const& ctx) { const auto push_collection = [](auto const& ctx) {
auto& dest = _val(ctx); auto& dest = _val(ctx);
auto& src = _attr(ctx); auto& src = _attr(ctx);
if (dest.empty()) if (dest.empty())
@ -231,27 +231,27 @@ auto push_collection = [](auto const& ctx) {
} }
}; };
auto assign_geometry_type = [](auto const& ctx) { const auto assign_geometry_type = [](auto const& ctx) {
std::get<0>(_val(ctx)) = _attr(ctx); std::get<0>(_val(ctx)) = _attr(ctx);
}; };
auto assign_coordinates = [](auto const& ctx) { const auto assign_coordinates = [](auto const& ctx) {
std::get<1>(_val(ctx)) = std::move(_attr(ctx)); std::get<1>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_rings = [](auto const& ctx) { const auto assign_rings = [](auto const& ctx) {
std::get<2>(_val(ctx)) = std::move(_attr(ctx)); std::get<2>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_properties = [](auto const& ctx) { const auto assign_properties = [](auto const& ctx) {
std::get<3>(_val(ctx)) = std::move(_attr(ctx)); std::get<3>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_prop_name = [](auto const& ctx) { const auto assign_prop_name = [](auto const& ctx) {
std::get<0>(_val(ctx)) = std::move(_attr(ctx)); std::get<0>(_val(ctx)) = std::move(_attr(ctx));
}; };
auto assign_prop_value = [](auto const& ctx) { const auto assign_prop_value = [](auto const& ctx) {
std::get<1>(_val(ctx)) = std::move(_attr(ctx)); std::get<1>(_val(ctx)) = std::move(_attr(ctx));
}; };
@ -262,12 +262,10 @@ using x3::int_;
using x3::lit; using x3::lit;
using x3::omit; using x3::omit;
namespace {
// import unicode string rule // import unicode string rule
auto const& json_string = json::grammar::unicode_string; const auto json_string = json::grammar::unicode_string;
// json value // json value
auto const& json_value = json::grammar::value; const auto json_value = json::grammar::value;
} // namespace
using coordinates_type = util::variant<topojson::coordinate, std::vector<topojson::coordinate>>; using coordinates_type = util::variant<topojson::coordinate, std::vector<topojson::coordinate>>;
using arcs_type = util::variant<std::vector<index_type>, using arcs_type = util::variant<std::vector<index_type>,
@ -287,7 +285,7 @@ struct topojson_geometry_type_ : x3::symbols<int>
("\"MultiPolygon\"", 6) // ("\"MultiPolygon\"", 6) //
; ;
} }
} topojson_geometry_type; } const topojson_geometry_type;
// rules // rules
x3::rule<class transform_tag, mapnik::topojson::transform> const transform = "Transform"; x3::rule<class transform_tag, mapnik::topojson::transform> const transform = "Transform";

View file

@ -35,7 +35,7 @@ namespace x3 = boost::spirit::x3;
using uchar = std::uint32_t; // a unicode code point using uchar = std::uint32_t; // a unicode code point
auto append = [](auto const& ctx) { const auto append = [](auto const& ctx) {
_val(ctx) += _attr(ctx); _val(ctx) += _attr(ctx);
}; };
@ -50,15 +50,15 @@ static inline void push_utf8_impl(std::string& str, uchar code_point)
} }
} // namespace detail } // namespace detail
auto push_char = [](auto const& ctx) { const auto push_char = [](auto const& ctx) {
_val(ctx).push_back(_attr(ctx)); _val(ctx).push_back(_attr(ctx));
}; };
auto push_utf8 = [](auto const& ctx) { const auto push_utf8 = [](auto const& ctx) {
detail::push_utf8_impl(_val(ctx), _attr(ctx)); detail::push_utf8_impl(_val(ctx), _attr(ctx));
}; };
auto push_utf16 = [](auto const& ctx) { const auto push_utf16 = [](auto const& ctx) {
using iterator_type = std::vector<std::uint16_t>::const_iterator; using iterator_type = std::vector<std::uint16_t>::const_iterator;
auto const& utf16 = _attr(ctx); auto const& utf16 = _attr(ctx);
try try
@ -76,7 +76,7 @@ auto push_utf16 = [](auto const& ctx) {
} }
}; };
auto push_esc = [](auto const& ctx) { const auto push_esc = [](auto const& ctx) {
std::string& utf8 = _val(ctx); std::string& utf8 = _val(ctx);
char c = _attr(ctx); char c = _attr(ctx);
switch (c) switch (c)

View file

@ -32,10 +32,10 @@ namespace grammar {
namespace x3 = boost::spirit::x3; namespace x3 = boost::spirit::x3;
using x3::lexeme; using x3::lexeme;
using x3::standard_wide::char_; using x3::standard_wide::char_;
auto create_string = [](auto& ctx) { const auto create_string = [](auto& ctx) {
_val(ctx).push_back(_attr(ctx)); _val(ctx).push_back(_attr(ctx));
}; };
auto create_attribute = [](auto& ctx) { const auto create_attribute = [](auto& ctx) {
_val(ctx).push_back(mapnik::attribute(_attr(ctx))); _val(ctx).push_back(mapnik::attribute(_attr(ctx)));
}; };
// rules // rules

View file

@ -47,17 +47,16 @@ namespace mapnik {
namespace grammar { namespace grammar {
namespace x3 = boost::spirit::x3; namespace x3 = boost::spirit::x3;
namespace ascii = boost::spirit::x3::ascii;
using x3::double_; using x3::double_;
using x3::lit; using x3::lit;
using x3::no_case; using x3::no_case;
// functors // functors
auto make_empty = [](auto const& ctx) { const auto make_empty = [](auto const& ctx) {
_val(ctx) = geometry::geometry_empty(); _val(ctx) = geometry::geometry_empty();
}; };
auto add_ring = [](auto const& ctx) { const auto add_ring = [](auto const& ctx) {
auto& ring = reinterpret_cast<geometry::linear_ring<double>&>(_attr(ctx)); auto& ring = reinterpret_cast<geometry::linear_ring<double>&>(_attr(ctx));
_val(ctx).push_back(std::move(ring)); _val(ctx).push_back(std::move(ring));
}; };

View file

@ -40,7 +40,8 @@ void register_image_readers()
} }
} // namespace mapnik } // namespace mapnik
#if !defined(MAPNIK_STATIC_PLUGINS) || !defined(_WIN32) // only on other systems then windows and in shared builds
#if !defined(MAPNIK_DISABLE_AUTOSETUP) && MAPNIK_STATIC_PLUGINS == 0 && !defined(_WIN32)
namespace { namespace {
class AutoSetup final class AutoSetup final
{ {

View file

@ -108,6 +108,7 @@ target_link_libraries(mapnik-test-unit PUBLIC
mapnik::json mapnik::json
mapnik::wkt mapnik::wkt
PostgreSQL::PostgreSQL PostgreSQL::PostgreSQL
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
# workaround since the "offical" include dir would be <catch2/catch.hpp> # workaround since the "offical" include dir would be <catch2/catch.hpp>
file(COPY catch_ext.hpp DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") file(COPY catch_ext.hpp DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
@ -120,6 +121,7 @@ target_link_libraries(agg_rasterizer_integer_overflow_test PUBLIC
mapnik::mapnik mapnik::mapnik
mapnik::agg mapnik::agg
mapnik::json mapnik::json
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
target_include_directories(agg_rasterizer_integer_overflow_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(agg_rasterizer_integer_overflow_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
@ -128,6 +130,7 @@ target_link_libraries(datasource_registration_test PUBLIC
Catch2::Catch2 Catch2::Catch2
mapnik::mapnik mapnik::mapnik
mapnik::agg mapnik::agg
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
target_include_directories(datasource_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(datasource_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
@ -137,6 +140,7 @@ target_link_libraries(font_registration_test PUBLIC
mapnik::mapnik mapnik::mapnik
mapnik::agg mapnik::agg
mapnik::json mapnik::json
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
target_include_directories(font_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(font_registration_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")
@ -146,6 +150,7 @@ target_link_libraries(map_xml_test PUBLIC
mapnik::mapnik mapnik::mapnik
mapnik::agg mapnik::agg
mapnik::json mapnik::json
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
target_include_directories(map_xml_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(map_xml_test PRIVATE "${Catch2_SOURCE_DIR}/single_include/catch2" "${CMAKE_CURRENT_BINARY_DIR}")

View file

@ -138,15 +138,17 @@ void load_map(mapnik::Map& m, bfs::path const& path)
} }
} // anonymous namespace } // anonymous namespace
#ifndef MAPNIK_STATIC_PLUGINS
const bool registered = const bool registered =
mapnik::datasource_cache::instance().register_datasources((bfs::path("plugins") / "input").generic_string()); mapnik::datasource_cache::instance().register_datasources((bfs::path("plugins") / "input").generic_string());
#endif
TEST_CASE("map xml I/O") TEST_CASE("map xml I/O")
{ {
mapnik::setup(); mapnik::setup();
#ifndef MAPNIK_STATIC_PLUGINS
// make sure plugins are loaded // make sure plugins are loaded
REQUIRE(registered); REQUIRE(registered);
#endif
// make the tests silent since we intentially test error conditions that are noisy // make the tests silent since we intentially test error conditions that are noisy
auto const severity = mapnik::logger::instance().get_severity(); auto const severity = mapnik::logger::instance().get_severity();

View file

@ -10,6 +10,7 @@ target_link_libraries(mapnik-test-visual PRIVATE
Boost::filesystem Boost::filesystem
mapnik::mapnik mapnik::mapnik
mapnik::agg mapnik::agg
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
# needed for cleanup.hpp # needed for cleanup.hpp
target_include_directories(mapnik-test-visual PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(mapnik-test-visual PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")

View file

@ -1,5 +1,8 @@
add_executable(geometry_to_wkb main.cpp) add_executable(geometry_to_wkb main.cpp)
target_link_libraries(geometry_to_wkb PRIVATE mapnik::mapnik) target_link_libraries(geometry_to_wkb PRIVATE
mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
)
mapnik_install_utility(geometry_to_wkb) mapnik_install_utility(geometry_to_wkb)

View file

@ -11,6 +11,7 @@ target_link_libraries(mapnik-index PRIVATE
mapnik::json mapnik::json
mapnik::wkt mapnik::wkt
Boost::program_options Boost::program_options
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
mapnik_install_utility(mapnik-index) mapnik_install_utility(mapnik-index)

View file

@ -5,6 +5,7 @@ add_executable(mapnik-render mapnik-render.cpp)
target_link_libraries(mapnik-render PRIVATE target_link_libraries(mapnik-render PRIVATE
mapnik::mapnik mapnik::mapnik
Boost::program_options Boost::program_options
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
mapnik_install_utility(mapnik-render) mapnik_install_utility(mapnik-render)

View file

@ -1,5 +1,8 @@
add_executable(ogrindex ogrindex.cpp) add_executable(ogrindex ogrindex.cpp)
target_link_libraries(ogrindex PRIVATE mapnik::mapnik) target_link_libraries(ogrindex PRIVATE
mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
)
mapnik_install_utility(ogrindex) mapnik_install_utility(ogrindex)

View file

@ -13,6 +13,7 @@ target_link_libraries(pgsql2sqlite PRIVATE
PostgreSQL::PostgreSQL PostgreSQL::PostgreSQL
Boost::program_options Boost::program_options
mapnik::mapnik mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
mapnik_install_utility(pgsql2sqlite) mapnik_install_utility(pgsql2sqlite)

View file

@ -8,6 +8,7 @@ target_include_directories(shapeindex PRIVATE ../../plugins/input/shape)
target_link_libraries(shapeindex PRIVATE target_link_libraries(shapeindex PRIVATE
Boost::program_options Boost::program_options
mapnik::mapnik mapnik::mapnik
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
mapnik_install_utility(shapeindex) mapnik_install_utility(shapeindex)

View file

@ -8,6 +8,7 @@ target_link_libraries(svg2png PRIVATE
Boost::program_options Boost::program_options
mapnik::mapnik mapnik::mapnik
mapnik::agg mapnik::agg
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
) )
mapnik_install_utility(svg2png) mapnik_install_utility(svg2png)