diff --git a/.travis.yml b/.travis.yml index 2bc5872d..bad8a07e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,30 @@ matrix: - env: BOGUS_JOB=true include: + - os: linux + env: TEST_CMAKE=true # variables unused - just for identification in travis ci gui + script: + - git submodule update --init tools/cmake + - git submodule update --init libs/conversion + - git submodule update --init libs/function_types + - git submodule update --init libs/fusion + - git submodule update --init libs/typeof + - mkdir __build__ && cd __build__ + - cmake .. -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON + - cmake --build . + + - os: linux + env: TEST_CMAKE=true BUILD_SHARED_LIBS=On # variables unused - just for identification in travis ci gui + script: + - git submodule update --init tools/cmake + - git submodule update --init libs/conversion + - git submodule update --init libs/function_types + - git submodule update --init libs/fusion + - git submodule update --init libs/typeof + - mkdir __build__ && cd __build__ + - cmake .. -DBUILD_SHARED_LIBS=ON -DBOOST_ENABLE_CMAKE=ON -DBOOST_REGEX_INCLUDE_EXAMPLES=ON + - cmake --build . + - os: linux env: TOOLSET=gcc COMPILER=g++ CXXSTD=03 @@ -242,9 +266,12 @@ matrix: env: TOOLSET=clang COMPILER=clang++ CXXSTD=11 osx_image: xcode6.4 + + install: + - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true - cd .. - - git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root - cd boost-root - git submodule update --init tools/build - git submodule update --init tools/boost_install diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..d7e190be --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,113 @@ +# Copyright 2018-2019 Mike Dev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: CMake support for Boost.Regex is currently experimental at best +# and the interface is likely to change in the future + + +##### How-To: +# +# If you have a cmake project that wants to use and compile +# boost_regex, as part of a single build system run, do the following: +# 1) clone the boost project and all its sub-projects: +# +# git clone --branch develop --depth 1 --recursive --shallow-submodules https://github.com/boostorg/boost.git boost-root +# +# 2) add to your cmake script: +# +# add_subdirectory( []) +# target_link_libraries( PUBLIC Boost::regex) +# +# 3) run your cmake build as usual +# +# ## Explanation: +# +# Currently this file does not work standalone. It is expected to be +# invoked from a parent script via add_subdirectory. That parent script +# is responsible for providing targets for direct and indirect dependencies, +# such as Boost::assert, Boost::concept_check, e.g. by also adding those +# libraries via add_submodule (order doesn't matter). +# The parent script can be your own cmake script, but it is easier to just +# use add the CMakeLists in the root of the boost super project, which +# will in turn add all boost libraries usable with the add_subdirectory +# Workflow. +# +# Note: You don't need to actually clone all boost libraries. E.g. look +# into the travis ci file to see on which libraries boost_regex actually +# depends or use boostdep https://github.com/boostorg/boostdep + + +##### Current Limitations: +# +# - Doesn't compile or run tests +# - Doesn't support installation +# + +cmake_minimum_required( VERSION 3.5 ) +project( BoostRegex LANGUAGES CXX ) + +option( BOOST_REGEX_INCLUDE_EXAMPLES "Also build (some) boost regex examples" OFF ) +option( BOOST_REGEX_USE_ICU "Enable ICU support in boost regex" OFF ) + +file( GLOB BOOST_REGEX_SRC ./src/*.cpp ) + +add_library( boost_regex ${BOOST_REGEX_SRC} ) +add_library( Boost::regex ALIAS boost_regex ) + +# Currently, installation isn't supported directly, +# but someone else might install this target from the parent +# CMake script, so lets proactively differentiate between +# the include directory during regular use (BUILD_INTERFACE) +# and after installation +target_include_directories( boost_regex + PUBLIC + $ + $ +) + +target_compile_definitions( boost_regex + PUBLIC + # No need for autolink and we don't mangle library name anyway + BOOST_REGEX_NO_LIB + $<$,SHARED_LIBRARY>:BOOST_REGEX_DYN_LINK=1> + $<$,STATIC_LIBRARY>:BOOST_REGEX_STATIC_LINK=1> +) + +# Specify dependencies (including header-only libraries) +target_link_libraries( boost_regex + PUBLIC + Boost::assert + Boost::concept_check + Boost::config + Boost::container_hash + Boost::core + Boost::integer + Boost::iterator + Boost::mpl + Boost::predef + Boost::smart_ptr + Boost::static_assert + Boost::throw_exception + Boost::type_traits +) + +if( BOOST_REGEX_USE_ICU ) + # ICU Targets could be provided by parent project, + # if not, look for them ourselves + if( NOT TARGET ICU::dt ) + # components need to be listed explicitly + find_package( ICU COMPONENTS dt in uc REQUIRED ) + endif() + + target_link_libraries( boost_regex + PRIVATE + ICU::dt ICU::in ICU::uc + ) + target_compile_definitions( boost_regex PRIVATE BOOST_HAS_ICU=1 ) +endif() + +if( BOOST_REGEX_INCLUDE_EXAMPLES ) + add_subdirectory( example/snippets ) +endif() + diff --git a/doc/history.qbk b/doc/history.qbk index 026f5a30..be64bb13 100644 --- a/doc/history.qbk +++ b/doc/history.qbk @@ -8,12 +8,11 @@ [section:history History] -New issues should be submitted at [@http://svn.boost.org svn.boost.org] - don't forget to include your -email address in the ticket! +New issues should be submitted at [@https://github.com/boostorg/regex/issues https://github.com/boostorg/regex/issues] -Currently open issues can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here]. +Currently open issues can be viewed [@https://github.com/boostorg/regex/issues?q=is%3Aopen+is%3Aissue here]. -All issues including closed ones can be viewed [@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=regex&order=priority&col=id&col=summary&col=status&col=type&col=milestone&col=component here]. +All issues including closed ones can be viewed [@https://github.com/boostorg/regex/issues?q=is%3Aissue+is%3Aclosed here]. [h4 Boost.Regex-5.1.4 (Boost-172.0)] diff --git a/example/snippets/CMakeLists.txt b/example/snippets/CMakeLists.txt new file mode 100644 index 00000000..f672785b --- /dev/null +++ b/example/snippets/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright 2019 Mike Dev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: CMake support for Boost.Regex is currently experimental at best +# and we are currently only building a few examples + +set(examples + partial_regex_grep + partial_regex_iterate + partial_regex_match + regex_grep_example_1 + regex_grep_example_2 + regex_grep_example_3 + regex_grep_example_4 + regex_iterator_example + regex_match_example + regex_merge_example + regex_replace_example + regex_search_example + regex_split_example_1 + regex_split_example_2 + regex_token_iterator_eg_1 + regex_token_iterator_eg_2 +) + +foreach( example IN LISTS examples ) + add_executable( boost_regex_ex_${example} ${example}.cpp ) + target_link_libraries( boost_regex_ex_${example} Boost::regex ) +endforeach() diff --git a/include/boost/regex/v4/regex_iterator.hpp b/include/boost/regex/v4/regex_iterator.hpp index 380a9a71..bbdeed58 100644 --- a/include/boost/regex/v4/regex_iterator.hpp +++ b/include/boost/regex/v4/regex_iterator.hpp @@ -50,6 +50,8 @@ class regex_iterator_implementation public: regex_iterator_implementation(const regex_type* p, BidirectionalIterator last, match_flag_type f) : base(), end(last), re(*p), flags(f){} + regex_iterator_implementation(const regex_iterator_implementation& other) + :what(other.what), base(other.base), end(other.end), re(other.re), flags(other.flags){} bool init(BidirectionalIterator first) { base = first; diff --git a/include/boost/regex/v4/regex_traits_defaults.hpp b/include/boost/regex/v4/regex_traits_defaults.hpp index c92d484b..d08047d9 100644 --- a/include/boost/regex/v4/regex_traits_defaults.hpp +++ b/include/boost/regex/v4/regex_traits_defaults.hpp @@ -141,7 +141,7 @@ inline bool is_separator(char c) BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name); // -// get the state_id of a character clasification, the individual +// get the state_id of a character classification, the individual // traits classes then transform that state_id into a bitmask: // template diff --git a/src/regex_traits_defaults.cpp b/src/regex_traits_defaults.cpp index 0ddb01dd..5ac46d2d 100644 --- a/src/regex_traits_defaults.cpp +++ b/src/regex_traits_defaults.cpp @@ -193,7 +193,7 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_l // // these are the POSIX collating names: // -BOOST_REGEX_DECL extern const char* const def_coll_names[] = { +static const char* def_coll_names[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline", "vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark", @@ -214,7 +214,7 @@ BOOST_REGEX_DECL extern const char* const def_coll_names[] = { // little more - but this will have to do for // now: -BOOST_REGEX_DECL extern const char* const def_multi_coll[] = { +static const char* def_multi_coll[] = { "ae", "Ae", "AE",