Skip to content

Commit

Permalink
Remove Boost dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Jan 15, 2022
1 parent e914c4d commit e788e87
Show file tree
Hide file tree
Showing 27 changed files with 731 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
env:
BUILD_TYPE: ${{ matrix.build_type }}
VCPKG_ROOT: "C:/dartsim/vcpkg"
VCPKG_BUILD_TAG: v0.2.0-70f192e
VCPKG_BUILD_TAG: v6.13-c973b49-0
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ brew 'cmake'
brew 'pkg-config'

brew 'assimp'
brew 'boost'
brew 'bullet'
brew 'eigen'
brew 'fcl'
brew 'fmt'
brew 'flann'
brew 'ipopt'
brew 'libccd'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

### [DART 6.13.0 (TBD)](https://github.com/dartsim/dart/milestone/69?closed=1)

* Dependency

* Added required dependencies: fmt
* Added optional dependencies: spdlog
* Removed required dependencies: Boost

* Build

* Dropped supporting FCL < 0.5: [#1647](https://github.com/dartsim/dart/pull/1647)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ string(REGEX REPLACE "^<version>([0-9]+)\\.([0-9]+)\\.([0-9]+)</version>$" "\\3"
set(DART_VERSION "${DART_MAJOR_VERSION}.${DART_MINOR_VERSION}.${DART_PATCH_VERSION}")

set(DART_PKG_DESC "Dynamic Animation and Robotics Toolkit.")
set(DART_PKG_EXTERNAL_DEPS "eigen, ccd, fcl, assimp, boost")
set(DART_PKG_EXTERNAL_DEPS "eigen, ccd, fcl, assimp")

#===============================================================================
# Build options
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get update \
libassimp-dev \
libccd-dev \
libfcl-dev \
libboost-all-dev \
libfmt-dev \
libnlopt-cxx-dev \
coinor-libipopt-dev \
libbullet-dev \
Expand All @@ -34,6 +34,7 @@ RUN apt-get update \
libxmu-dev \
freeglut3-dev \
libopenscenegraph-dev \
libspdlog-dev \
&& rm -rf /var/lib/apt/lists/*

# Install dartpy dependencies
Expand Down
36 changes: 0 additions & 36 deletions cmake/DARTFindBoost.cmake

This file was deleted.

7 changes: 4 additions & 3 deletions cmake/DARTFindDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if(DART_VERBOSE)
message(STATUS "[ Required dependencies for DART core ]")
endif()

# fmt
dart_find_package(fmt)
dart_check_required_package(fmt "libfmt")

# Eigen
dart_find_package(Eigen3)
dart_check_required_package(EIGEN3 "eigen3")
Expand Down Expand Up @@ -85,9 +89,6 @@ if(ASSIMP_FOUND)
unset(CMAKE_REQUIRED_LIBRARIES)
endif()

# Boost
dart_find_package(Boost)

# octomap
dart_find_package(octomap)
if(MSVC)
Expand Down
9 changes: 9 additions & 0 deletions cmake/DARTFindfmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2011-2022, The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the "BSD-style" License

find_package(fmt)
10 changes: 4 additions & 6 deletions dart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${DART_BINARY_DIR}/lib")
# Targets - {dependency targets}, source directories, [external dependency libs]
#===============================================================================
# dart - common, math, integration, lcpsolver, optimizer, dynamics, collision,
# collision/dart, collision/fcl, constraint, simulation, [eigen3, libccd,
# fcl, assimp, boost]
# collision/dart, collision/fcl, constraint, simulation, [assimp, eigen3,
# fcl, fmt, libccd]
# dart-optimizer-ipopt - {dart}, optimizer/ipopt, [ipopt]
# dart-optimizer-nlopt - {dart}, optimizer/nlopt, [nlopt]
# dart-collision-bullet - {dart}, collision/bullet, [bullet]
Expand Down Expand Up @@ -131,10 +131,8 @@ target_link_libraries(dart
Eigen3::Eigen
ccd
fcl
fmt::fmt
assimp
Boost::boost
Boost::system
Boost::filesystem
)

# spdlog settings
Expand Down Expand Up @@ -207,7 +205,7 @@ endif()
add_component_targets(${PROJECT_NAME} dart dart)
add_component_dependencies(${PROJECT_NAME} dart external-odelcpsolver)
add_component_dependency_packages(${PROJECT_NAME} dart
Eigen3 ccd fcl assimp Boost
assimp Eigen3 ccd fcl fmt
)
if(TARGET octomap)
add_component_dependency_packages(${PROJECT_NAME} dart octomap)
Expand Down
106 changes: 106 additions & 0 deletions dart/common/String.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright (c) 2011-2022, The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/master/LICENSE
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/common/String.hpp"

#include <algorithm>

namespace dart::common {

//==============================================================================
std::string toUpper(std::string str)
{
toUpperInPlace(str);
return str;
}

//==============================================================================
void toUpperInPlace(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
}

//==============================================================================
std::string toLower(std::string str)
{
toLowerInPlace(str);
return str;
}

//==============================================================================
void toLowerInPlace(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
}

//==============================================================================
std::string trim(const std::string& str, const std::string& whitespaces)
{
return trimRight(trimLeft(str, whitespaces), whitespaces);
}

//==============================================================================
std::string trimLeft(const std::string& str, const std::string& whitespaces)
{
size_t startpos = str.find_first_not_of(whitespaces);
return (startpos == std::string::npos) ? "" : str.substr(startpos);
}

//==============================================================================
std::string trimRight(const std::string& str, const std::string& whitespaces)
{
size_t endpos = str.find_last_not_of(whitespaces);
return (endpos == std::string::npos) ? "" : str.substr(0, endpos + 1);
}

//==============================================================================
std::vector<std::string> split(
const std::string& str, const std::string& delimiters)
{
std::vector<std::string> tokens;
std::size_t start = str.find_first_not_of(delimiters), end = 0;

while ((end = str.find_first_of(delimiters, start)) != std::string::npos)
{
tokens.push_back(str.substr(start, end - start));
start = str.find_first_not_of(delimiters, end);
}

if (start != std::string::npos)
{
tokens.push_back(str.substr(start));
}

return tokens;
}

} // namespace dart::common
71 changes: 71 additions & 0 deletions dart/common/String.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2011-2022, The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/master/LICENSE
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef DART_COMMON_STRING_HPP_
#define DART_COMMON_STRING_HPP_

#include <string>
#include <vector>

namespace dart::common {

/// Converts string to upper cases
std::string toUpper(std::string str);

/// Converts string to upper cases in place
void toUpperInPlace(std::string& str);

/// Converts string to lower cases
std::string toLower(std::string str);

/// Converts string to lower cases in place
void toLowerInPlace(std::string& str);

/// Trims both sides of string
std::string trim(
const std::string& str, const std::string& whitespaces = " \n\r\t");

/// Trims left side of string
std::string trimLeft(
const std::string& str, const std::string& whitespaces = " \n\r\t");

/// Trims right side of string
std::string trimRight(
const std::string& str, const std::string& whitespaces = " \n\r\t");

/// Splits string given delimiters
std::vector<std::string> split(
const std::string& str, const std::string& delimiters = " \n\r\t");

} // namespace dart::common

#endif // DART_COMMON_STRING_HPP_
35 changes: 9 additions & 26 deletions dart/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,11 @@
dart_find_package(tinyxml2)
dart_check_optional_package(TINYXML2 "dart-utils" "tinyxml2" "1.0.1")

# Test whether boost algorithm and lexical_cast headers are available.
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_FLAGS "-w")
set(CMAKE_REQUIRED_INCLUDES "${Boost_INCLUDE_DIRS}")
check_cxx_source_compiles(
"
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
int main()
{
return 0;
}
"
HAS_BOOST_ALGORITHM_LEXICAL_CAST
)
if(HAS_BOOST_ALGORITHM_LEXICAL_CAST)
if(DART_VERBOSE)
message(STATUS "Looking for Boost algorithm and lexical_cast headers - found")
endif()
else()
message(WARNING "Looking for Boost algorithm and lexical_cast headers - NOT found, to use dart-utils, please install missing boost headers")
return()
endif()

# Search all header and source files
file(GLOB hdrs "*.hpp")
file(GLOB srcs "*.cpp")
file(GLOB detail_hdrs "detail/*.hpp")
file(GLOB detail_srcs "detail/*.cpp")

function(dart_add_utils_headers)
dart_property_add(DART_UTILS_HEADERS ${ARGN})
Expand All @@ -50,7 +28,7 @@ set(target_name ${PROJECT_NAME}-utils)
set(component_name utils)

# Add target
dart_add_library(${target_name} ${hdrs} ${srcs} ${dart_utils_headers} ${dart_utils_sources})
dart_add_library(${target_name} ${hdrs} ${srcs} ${detail_hdrs} ${detail_srcs} ${dart_utils_headers} ${dart_utils_sources})
target_link_libraries(${target_name} PUBLIC dart tinyxml2::tinyxml2)

# Component
Expand Down Expand Up @@ -82,8 +60,13 @@ install(
DESTINATION include/dart/utils
COMPONENT headers
)
install(
FILES ${detail_hdrs}
DESTINATION include/dart/utils/detail
COMPONENT headers
)

# Add subdirectories (components)
add_subdirectory(urdf)

dart_format_add(${hdrs} ${srcs} ${dart_utils_headers} ${dart_utils_sources})
dart_format_add(${hdrs} ${srcs} ${detail_hdrs} ${detail_srcs} ${dart_utils_headers} ${dart_utils_sources})
Loading

0 comments on commit e788e87

Please sign in to comment.