From 492db7232fdf258ec8af6d46035e2a97563e9573 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 15 Oct 2013 09:11:08 +0100 Subject: [PATCH] == std::regex don't link to boost_regex lib --- SConstruct | 37 --------------------- include/mapnik/expression_node.hpp | 20 ----------- src/build.py | 9 +---- src/expression_node.cpp | 18 ++-------- tests/cpp_tests/svg_renderer_tests/build.py | 6 +--- 5 files changed, 4 insertions(+), 86 deletions(-) diff --git a/SConstruct b/SConstruct index f5f5a6dbd..af2bd4e86 100644 --- a/SConstruct +++ b/SConstruct @@ -87,7 +87,6 @@ pretty_dep_names = { 'freetype-config':'freetype-config program | try setting FREETYPE_CONFIG SCons option', 'osm':'more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin', 'curl':'libcurl is required for the "osm" plugin - more info: https://github.com/mapnik/mapnik/wiki/OsmPlugin', - 'boost_regex_icu':'libboost_regex built with optional ICU unicode support is needed for unicode regex support in mapnik.', 'sqlite_rtree':'The SQLite plugin requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)', 'pgsql2sqlite_rtree':'The pgsql2sqlite program requires libsqlite3 built with RTREE support (-DSQLITE_ENABLE_RTREE=1)' } @@ -919,35 +918,6 @@ int main() color_print(1,'\nFound insufficient icu version... %s' % result) return False -def boost_regex_has_icu(context): - if env['RUNTIME_LINK'] == 'static': - context.env.AppendUnique(LIBS='icudata') - ret = context.TryRun(""" - -#include -#include - -int main() -{ - U_NAMESPACE_QUALIFIER UnicodeString ustr; - try { - boost::u32regex pattern = boost::make_u32regex(ustr); - } - // an exception is fine, still indicates support is - // likely compiled into regex - catch (...) { - return 0; - } - return 0; -} - -""", '.cpp') - context.Message('Checking if boost_regex was built with ICU unicode support... ') - context.Result(ret[0]) - if ret[0]: - return True - return False - def sqlite_has_rtree(context, silent=False): """ check an sqlite3 install has rtree support. @@ -1009,7 +979,6 @@ conf_tests = { 'prioritize_paths' : prioritize_paths, 'get_pkg_lib' : get_pkg_lib, 'rollback_option' : rollback_option, 'icu_at_least_four_two' : icu_at_least_four_two, - 'boost_regex_has_icu' : boost_regex_has_icu, 'sqlite_has_rtree' : sqlite_has_rtree, } @@ -1299,7 +1268,6 @@ if not preconfigured: BOOST_LIBSHEADERS = [ ['system', 'boost/system/system_error.hpp', True], ['filesystem', 'boost/filesystem/operations.hpp', True], - ['regex', 'boost/regex.hpp', True], ['program_options', 'boost/program_options.hpp', False] ] @@ -1342,11 +1310,6 @@ if not preconfigured: # we need libicui18n if using static boost libraries, so it is # important to try this check with the library linked env.AppendUnique(LIBS='icui18n') - if conf.boost_regex_has_icu(): - # TODO - should avoid having this be globally defined... - env.Append(CPPDEFINES = '-DBOOST_REGEX_HAS_ICU') - else: - env['SKIPPED_DEPS'].append('boost_regex_icu') for libname, headers, required, lang, define in OPTIONAL_LIBSHEADERS: if not env['HOST']: diff --git a/include/mapnik/expression_node.hpp b/include/mapnik/expression_node.hpp index 8720e991d..2282809b1 100644 --- a/include/mapnik/expression_node.hpp +++ b/include/mapnik/expression_node.hpp @@ -81,25 +81,6 @@ struct binary_node expr_node left,right; }; -#if defined(BOOST_REGEX_HAS_ICU) - -struct regex_match_node -{ - regex_match_node (expr_node const& a, mapnik::value_unicode_string const& ustr); - expr_node expr; - std::regex pattern; -}; - - -struct regex_replace_node -{ - regex_replace_node (expr_node const& a, mapnik::value_unicode_string const& ustr, mapnik::value_unicode_string const& f); - expr_node expr; - std::regex pattern; - mapnik::value_unicode_string format; -}; - -#else struct regex_match_node { @@ -116,7 +97,6 @@ struct regex_replace_node std::regex pattern; std::string format; }; -#endif struct function_call { diff --git a/src/build.py b/src/build.py index 54dc1e348..2d84cb0b7 100644 --- a/src/build.py +++ b/src/build.py @@ -53,11 +53,10 @@ libmapnik_defines = copy(lib_env['CPPDEFINES']) ABI_VERSION = env['ABI_VERSION'] filesystem = 'boost_filesystem%s' % env['BOOST_APPEND'] -regex = 'boost_regex%s' % env['BOOST_APPEND'] system = 'boost_system%s' % env['BOOST_APPEND'] # clear out and re-set libs for this env -lib_env['LIBS'] = ['freetype',env['ICU_LIB_NAME'],filesystem,system,regex] +lib_env['LIBS'] = ['freetype',env['ICU_LIB_NAME'],filesystem,system] if '-DMAPNIK_USE_PROJ4' in env['CPPDEFINES']: lib_env['LIBS'].append('proj') @@ -86,12 +85,6 @@ if len(env['EXTRA_FREETYPE_LIBS']): lib_env['LIBS'].append('xml2') lib_env['LIBS'].append('z') -#if env['THREADING'] == 'multi': -# lib_env['LIBS'].append('boost_thread%s' % env['BOOST_APPEND']) - -if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']: - lib_env['LIBS'].append('icui18n') - if env['RUNTIME_LINK'] == 'static': if 'icuuc' in env['ICU_LIB_NAME']: lib_env['LIBS'].append('icudata') diff --git a/src/expression_node.cpp b/src/expression_node.cpp index 27858b33a..acc169844 100644 --- a/src/expression_node.cpp +++ b/src/expression_node.cpp @@ -26,27 +26,13 @@ namespace mapnik { -#if defined(BOOST_REGEX_HAS_ICU) - -regex_match_node::regex_match_node (expr_node const& a, mapnik::value_unicode_string const& ustr) - : expr(a), - pattern(ustr) {} - -regex_replace_node::regex_replace_node (expr_node const& a, mapnik::value_unicode_string const& ustr, mapnik::value_unicode_string const& f) - : expr(a), - pattern(ustr), - format(f) {} - -#else - regex_match_node::regex_match_node (expr_node const& a, std::string const& str) : expr(a), - pattern(str) {} + pattern(str, std::regex::extended | std::regex::optimize) {} regex_replace_node::regex_replace_node (expr_node const& a, std::string const& str, std::string const& f) : expr(a), - pattern(str), + pattern(str, std::regex::extended | std::regex::optimize), format(f) {} -#endif } diff --git a/tests/cpp_tests/svg_renderer_tests/build.py b/tests/cpp_tests/svg_renderer_tests/build.py index ff4278b31..1203c85af 100644 --- a/tests/cpp_tests/svg_renderer_tests/build.py +++ b/tests/cpp_tests/svg_renderer_tests/build.py @@ -4,11 +4,7 @@ from copy import copy Import ('env') -headers = env['CPPPATH'] - -filesystem = 'boost_filesystem%s' % env['BOOST_APPEND'] -system = 'boost_system%s' % env['BOOST_APPEND'] -regex = 'boost_regex%s' % env['BOOST_APPEND'] +headers = env['CPPPATH'] libraries = copy(env['LIBMAPNIK_LIBS']) libraries.append('mapnik')