From 44bc5b59d6aef736368243169651df9dcd0949f4 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 13 Oct 2014 01:06:36 -0700 Subject: [PATCH] break out wkt/json grammars into separate libraries --- SConstruct | 6 +++- bindings/python/build.py | 4 +++ plugins/input/csv/build.py | 4 +++ plugins/input/csv/csv_datasource.cpp | 2 -- plugins/input/geojson/build.py | 8 ++++-- plugins/input/geojson/geojson_datasource.cpp | 3 -- ...mapnik_json_feature_collection_grammar.cpp | 28 +++++++++++++++++++ .../json}/mapnik_json_feature_grammar.cpp | 0 .../json}/mapnik_json_generator_grammar.cpp | 0 .../json}/mapnik_json_geometry_grammar.cpp | 0 .../wkt}/mapnik_wkt_generator_grammar.cpp | 0 .../python => src/wkt}/mapnik_wkt_grammar.cpp | 0 12 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 src/json/mapnik_json_feature_collection_grammar.cpp rename {bindings/python => src/json}/mapnik_json_feature_grammar.cpp (100%) rename {bindings/python => src/json}/mapnik_json_generator_grammar.cpp (100%) rename {bindings/python => src/json}/mapnik_json_geometry_grammar.cpp (100%) rename {bindings/python => src/wkt}/mapnik_wkt_generator_grammar.cpp (100%) rename {bindings/python => src/wkt}/mapnik_wkt_grammar.cpp (100%) diff --git a/SConstruct b/SConstruct index bf3812f38..7b3509ba1 100644 --- a/SConstruct +++ b/SConstruct @@ -1175,7 +1175,7 @@ if not preconfigured: # Set up for libraries and headers dependency checks env['CPPPATH'] = ['#include', '#'] - env['LIBPATH'] = ['#src'] + env['LIBPATH'] = ['#src','#src/json','#src/wkt'] # set any custom cxxflags and ldflags to come first if sys.platform == 'darwin' and not env['HOST']: @@ -1916,6 +1916,10 @@ if not HELP_REQUESTED: if env['RUNTIME_LINK'] == 'shared': SConscript('deps/agg/build.py') + # Build spirit grammars + SConscript('src/json/build.py') + SConscript('src/wkt/build.py') + # Build the core library SConscript('src/build.py') diff --git a/bindings/python/build.py b/bindings/python/build.py index 9e44b2188..b2cda4f45 100644 --- a/bindings/python/build.py +++ b/bindings/python/build.py @@ -183,9 +183,13 @@ if 'uninstall' not in COMMAND_LINE_TARGETS: py_env.Append(CPPDEFINES = '-DHAVE_PYCAIRO') py_env.Append(LINKFLAGS=python_link_flag) +py_env.AppendUnique(LIBS='mapnik_json_geometry_grammar') +py_env.AppendUnique(LIBS='mapnik_json_feature_grammar') +py_env.AppendUnique(LIBS='mapnik_json_generator_grammar') _mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LDMODULEPREFIX='', LDMODULESUFFIX='.so') Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) +Depends(_mapnik, env.subst('../../src/json/libmapnik_json_geometry_grammar${LIBSUFFIX}')) if env['PLATFORM'] == 'SunOS' and env['PYTHON_IS_64BIT']: # http://mail.python.org/pipermail/python-dev/2006-August/068528.html diff --git a/plugins/input/csv/build.py b/plugins/input/csv/build.py index 6b1aa1392..2c42bd605 100644 --- a/plugins/input/csv/build.py +++ b/plugins/input/csv/build.py @@ -37,6 +37,8 @@ plugin_sources = Split( libraries = [] libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append(env['ICU_LIB_NAME']) +libraries.append('mapnik_json_geometry_grammar') +libraries.append('mapnik_wkt_grammar') if env['PLUGIN_LINKING'] == 'shared': libraries.append(env['MAPNIK_NAME']) @@ -49,6 +51,8 @@ if env['PLUGIN_LINKING'] == 'shared': # if the plugin links to libmapnik ensure it is built first Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + Depends(TARGET, env.subst('../../../src/json/libmapnik_json_geometry_grammar${LIBSUFFIX}')) + Depends(TARGET, env.subst('../../../src/wkt/libmapnik_wkt_grammar${LIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index c02f1e20b..76b577011 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -42,8 +42,6 @@ #include #include #include -#include -#include // stl #include diff --git a/plugins/input/geojson/build.py b/plugins/input/geojson/build.py index 8e818f4bd..3405c21fc 100644 --- a/plugins/input/geojson/build.py +++ b/plugins/input/geojson/build.py @@ -38,8 +38,9 @@ plugin_sources = Split( libraries = [] libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) -#if env['THREADING'] == 'multi': -# libraries.append('boost_thread%s' % env['BOOST_APPEND']) +libraries.append('mapnik_json_geometry_grammar') +libraries.append('mapnik_json_feature_grammar') +libraries.append('mapnik_json_feature_collection_grammar') if env['PLUGIN_LINKING'] == 'shared': libraries.append(env['MAPNIK_NAME']) @@ -52,6 +53,9 @@ if env['PLUGIN_LINKING'] == 'shared': # if the plugin links to libmapnik ensure it is built first Depends(TARGET, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) + Depends(TARGET, env.subst('../../../src/json/libmapnik_json_geometry_grammar${LIBSUFFIX}')) + Depends(TARGET, env.subst('../../../src/json/libmapnik_json_feature_grammar${LIBSUFFIX}')) + Depends(TARGET, env.subst('../../../src/json/libmapnik_json_feature_collection_grammar${LIBSUFFIX}')) if 'uninstall' not in COMMAND_LINE_TARGETS: env.Install(env['MAPNIK_INPUT_PLUGINS_DEST'], TARGET) diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index 60751edc9..06a20e736 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -43,9 +43,6 @@ #include #include #include -#include -#include -#include #include diff --git a/src/json/mapnik_json_feature_collection_grammar.cpp b/src/json/mapnik_json_feature_collection_grammar.cpp new file mode 100644 index 000000000..779c2e364 --- /dev/null +++ b/src/json/mapnik_json_feature_collection_grammar.cpp @@ -0,0 +1,28 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2014 Artem Pavlenko, Jean-Francois Doyon + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *****************************************************************************/ + +#include +#include +#include + +using iterator_type = std::string::const_iterator; +template struct mapnik::json::feature_collection_grammar ; diff --git a/bindings/python/mapnik_json_feature_grammar.cpp b/src/json/mapnik_json_feature_grammar.cpp similarity index 100% rename from bindings/python/mapnik_json_feature_grammar.cpp rename to src/json/mapnik_json_feature_grammar.cpp diff --git a/bindings/python/mapnik_json_generator_grammar.cpp b/src/json/mapnik_json_generator_grammar.cpp similarity index 100% rename from bindings/python/mapnik_json_generator_grammar.cpp rename to src/json/mapnik_json_generator_grammar.cpp diff --git a/bindings/python/mapnik_json_geometry_grammar.cpp b/src/json/mapnik_json_geometry_grammar.cpp similarity index 100% rename from bindings/python/mapnik_json_geometry_grammar.cpp rename to src/json/mapnik_json_geometry_grammar.cpp diff --git a/bindings/python/mapnik_wkt_generator_grammar.cpp b/src/wkt/mapnik_wkt_generator_grammar.cpp similarity index 100% rename from bindings/python/mapnik_wkt_generator_grammar.cpp rename to src/wkt/mapnik_wkt_generator_grammar.cpp diff --git a/bindings/python/mapnik_wkt_grammar.cpp b/src/wkt/mapnik_wkt_grammar.cpp similarity index 100% rename from bindings/python/mapnik_wkt_grammar.cpp rename to src/wkt/mapnik_wkt_grammar.cpp