Skip to content

Commit

Permalink
Remove dependency on Boost::regex (#1412)
Browse files Browse the repository at this point in the history
* Remove dependency of Boost::regex

* Keep installing Boost::regex for building API document of old DART

* Update changelog
  • Loading branch information
jslee02 authored Sep 8, 2019
1 parent e125098 commit 110269c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ install:
#-------------------------------
- sh: sudo apt-get update
- sh: sudo apt-get --yes install build-essential cmake pkg-config git
- sh: sudo apt-get --yes install libeigen3-dev libassimp-dev libccd-dev libfcl-dev libboost-regex-dev libboost-system-dev
- sh: sudo apt-get --yes install libeigen3-dev libassimp-dev libccd-dev libfcl-dev libboost-system-dev
- sh: sudo apt-get --yes install libnlopt-dev coinor-libipopt-dev libbullet-dev libflann-dev libtinyxml2-dev liburdfdom-dev libxi-dev libxmu-dev freeglut3-dev libopenscenegraph-dev
- sh: sudo apt-get --yes install clang-format-6.0

Expand Down
5 changes: 4 additions & 1 deletion .ci/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ fi
$SUDO apt-get -y install \
libassimp-dev \
libboost-filesystem-dev \
libboost-regex-dev \
libboost-system-dev \
libccd-dev \
libeigen3-dev \
libfcl-dev

# Required dependencies for building API documentation of DART < 6.10
$SUDO apt-get -y install \
libboost-regex-dev

# Optional dependencies
$SUDO apt-get -y install \
freeglut3-dev \
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
* Fixed compiler warnings from GCC 9.1: [#1366](https://github.com/dartsim/dart/pull/1366)
* Replaced M_PI with dart::math::constantsd::pi(): [#1367](https://github.com/dartsim/dart/pull/1367)
* Enabled octomap support on macOS: [#1078](https://github.com/dartsim/dart/pull/1078)
* Removed dependency on Boost::regex: [#1412](https://github.com/dartsim/dart/pull/1412)

### [DART 6.9.2 (2019-08-16)](https://github.com/dartsim/dart/milestone/60?closed=1)

Expand Down
15 changes: 1 addition & 14 deletions cmake/DARTFindBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,13 @@ endif()
add_definitions(-DBOOST_TEST_DYN_LINK)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
if(MSVC)
set(BOOST_REQUIRED_COMPONENTS system filesystem)
else()
set(BOOST_REQUIRED_COMPONENTS regex system filesystem)
endif()
set(BOOST_REQUIRED_COMPONENTS system filesystem)
if(DART_VERBOSE)
find_package(Boost ${DART_MIN_BOOST_VERSION} REQUIRED COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
else()
find_package(Boost ${DART_MIN_BOOST_VERSION} QUIET REQUIRED COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
endif()

if(NOT MSVC)
if(NOT TARGET Boost::regex)
add_library(Boost::regex INTERFACE IMPORTED)
set_target_properties(Boost::regex PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${Boost_REGEX_LIBRARY}"
)
endif()
endif()
if(NOT TARGET Boost::system)
add_library(Boost::system INTERFACE IMPORTED)
set_target_properties(Boost::system PROPERTIES
Expand Down
3 changes: 0 additions & 3 deletions dart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ target_link_libraries(dart
if (TARGET octomap)
target_link_libraries(dart PUBLIC octomap)
endif()
if(NOT MSVC)
target_link_libraries(dart PUBLIC Boost::regex)
endif()
if(CMAKE_VERSION VERSION_LESS 3.8.2)
target_compile_options(dart PUBLIC -std=c++14)
else()
Expand Down
28 changes: 3 additions & 25 deletions dart/common/Uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,12 @@
*/

#include "dart/common/Uri.hpp"

#include <cassert>
#include <sstream>
#include "dart/common/Console.hpp"

// std::regex is only implemented in GCC 4.9 and above; i.e. libstdc++ 6.0.20
// or above. In fact, it contains major bugs in GCC 4.8 [1]. There is no
// reliable way to test the version of libstdc++ when building with Clang [2],
// so we'll fall back on Boost.Regex when using libstdc++.
//
// [1] http://stackoverflow.com/a/12665408/111426
// [2] http://stackoverflow.com/q/31506594/111426
//
#ifdef __GLIBCXX__

# include <boost/regex.hpp>

using boost::regex;
using boost::regex_match;
using boost::regex_search;
using boost::smatch;
using boost::ssub_match;
using boost::regex_constants::match_continuous;

#else
#include <regex>

# include <regex>
#include "dart/common/Console.hpp"

using std::regex;
using std::regex_match;
Expand All @@ -65,8 +45,6 @@ using std::smatch;
using std::ssub_match;
using std::regex_constants::match_continuous;

#endif

static bool startsWith(const std::string& _target, const std::string& _prefix)
{
return _target.substr(0, _prefix.size()) == _prefix;
Expand Down
1 change: 1 addition & 0 deletions dart/utils/XmlHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include <iostream>
#include <vector>

#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>

Expand Down

0 comments on commit 110269c

Please sign in to comment.