Skip to content

Commit

Permalink
[build] Remove support for CMake < 3.22.1 and Eigen < 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Mar 22, 2024
1 parent 7bc91d9 commit 952e30b
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 303 deletions.
11 changes: 2 additions & 9 deletions cmake/DARTFindBullet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ find_package(Bullet COMPONENTS BulletMath BulletCollision MODULE QUIET)

if((BULLET_FOUND OR Bullet_FOUND) AND NOT TARGET Bullet)
add_library(Bullet INTERFACE IMPORTED)
if(CMAKE_VERSION VERSION_LESS 3.11)
set_target_properties(Bullet PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BULLET_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${BULLET_LIBRARIES}"
)
else()
target_include_directories(Bullet INTERFACE ${BULLET_INCLUDE_DIRS})
target_link_libraries(Bullet INTERFACE ${BULLET_LIBRARIES})
endif()
target_include_directories(Bullet INTERFACE ${BULLET_INCLUDE_DIRS})
target_link_libraries(Bullet INTERFACE ${BULLET_LIBRARIES})
endif()
20 changes: 2 additions & 18 deletions cmake/DARTFindOpenSceneGraph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,10 @@
#
# This file is provided under the "BSD-style" License

if (CMAKE_VERSION VERSION_LESS 3.12)
get_property(old_find_library_use_lib64_paths GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
endif()

find_package(OpenSceneGraph 3.0 QUIET
COMPONENTS osg osgViewer osgManipulator osgGA osgDB osgShadow osgUtil
)

if (CMAKE_VERSION VERSION_LESS 3.12)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${old_find_library_use_lib64_paths})
endif()

# It seems that OPENSCENEGRAPH_FOUND will inadvertently get set to true when
# OpenThreads is found, even if OpenSceneGraph is not installed. This is quite
# possibly a bug in OSG's cmake configuration file. For now, it seems that
Expand Down Expand Up @@ -56,13 +47,6 @@ endif()
# where the system that DART is built and where the system that consumes DART.
if((OPENSCENEGRAPH_FOUND OR OpenSceneGraph_FOUND) AND NOT TARGET osg::osg)
add_library(osg::osg INTERFACE IMPORTED)
if(CMAKE_VERSION VERSION_LESS 3.11)
set_target_properties(osg::osg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENSCENEGRAPH_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${OPENSCENEGRAPH_LIBRARIES}"
)
else()
target_include_directories(osg::osg INTERFACE ${OPENSCENEGRAPH_INCLUDE_DIRS})
target_link_libraries(osg::osg INTERFACE ${OPENSCENEGRAPH_LIBRARIES})
endif()
target_include_directories(osg::osg INTERFACE ${OPENSCENEGRAPH_INCLUDE_DIRS})
target_link_libraries(osg::osg INTERFACE ${OPENSCENEGRAPH_LIBRARIES})
endif()
3 changes: 0 additions & 3 deletions dart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ endif()

# C++ standard settings
target_compile_features(dart PUBLIC cxx_std_17)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
target_link_libraries(dart PUBLIC "stdc++fs")
endif()

# Build DART with all available SIMD instructions
if(DART_ENABLE_SIMD)
Expand Down
18 changes: 0 additions & 18 deletions dart/common/Memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <dart/config.hpp>

#include <dart/common/Deprecated.hpp>
#include <dart/common/detail/AlignedAllocator.hpp>

#include <map>
#include <memory>
Expand All @@ -53,21 +52,6 @@ template <typename T, typename... Args>
DART_DEPRECATED(6.9)
std::unique_ptr<T> make_unique(Args&&... args);

#if EIGEN_VERSION_AT_LEAST(3, 2, 1) && EIGEN_VERSION_AT_MOST(3, 2, 8)

template <typename _Tp>
using aligned_vector
= std::vector<_Tp, dart::common::detail::aligned_allocator_cpp11<_Tp>>;

template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>>
using aligned_map = std::map<
_Key,
_Tp,
_Compare,
dart::common::detail::aligned_allocator_cpp11<std::pair<const _Key, _Tp>>>;

#else

template <typename _Tp>
using aligned_vector = std::vector<_Tp, Eigen::aligned_allocator<_Tp>>;

Expand All @@ -78,8 +62,6 @@ using aligned_map = std::map<
_Compare,
Eigen::aligned_allocator<std::pair<const _Key, _Tp>>>;

#endif

} // namespace common
} // namespace dart

Expand Down
106 changes: 0 additions & 106 deletions dart/common/detail/AlignedAllocator.hpp

This file was deleted.

13 changes: 1 addition & 12 deletions dart/common/detail/Memory-impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@
#include <dart/config.hpp>

#include <Eigen/Core>
#include <Eigen/StdVector>

#include <memory>

#if EIGEN_VERSION_AT_LEAST(3, 2, 1) && EIGEN_VERSION_AT_MOST(3, 2, 8)
#include <dart/common/detail/AlignedAllocator.hpp>
#else
#include <Eigen/StdVector>
#endif

namespace dart {
namespace common {

Expand All @@ -54,14 +49,8 @@ std::shared_ptr<_Tp> make_aligned_shared(_Args&&... __args)
{
using _Tp_nc = typename std::remove_const<_Tp>::type;

#if EIGEN_VERSION_AT_LEAST(3, 2, 1) && EIGEN_VERSION_AT_MOST(3, 2, 8)
return std::allocate_shared<_Tp>(
detail::aligned_allocator_cpp11<_Tp_nc>(),
std::forward<_Args>(__args)...);
#else
return std::allocate_shared<_Tp>(
Eigen::aligned_allocator<_Tp_nc>(), std::forward<_Args>(__args)...);
#endif // EIGEN_VERSION_AT_LEAST(3,2,1) && EIGEN_VERSION_AT_MOST(3,2,8)
}

//==============================================================================
Expand Down
38 changes: 27 additions & 11 deletions dart/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,50 @@
#define DART_VERSION "@DART_VERSION@"
#define DART_DESCRIPTION "@DART_PKG_DESC@"

#define DART_VERSION_AT_LEAST(x, y, z) \
#define DART_VERSION_GT(x, y, z) \
(DART_MAJOR_VERSION < x \
|| (DART_MAJOR_VERSION <= x \
&& (DART_MINOR_VERSION < y \
|| (DART_MINOR_VERSION <= y && DART_PATCH_VERSION < z))))

#define DART_VERSION_GE(x, y, z) \
(DART_MAJOR_VERSION > x \
|| (DART_MAJOR_VERSION >= x \
&& (DART_MINOR_VERSION > y \
|| (DART_MINOR_VERSION >= y && DART_PATCH_VERSION >= z))))

#define DART_MAJOR_MINOR_VERSION_AT_LEAST(x, y) \
#define DART_VERSION_LT(x, y, z) \
(DART_MAJOR_VERSION > x \
|| (DART_MAJOR_VERSION >= x \
&& (DART_MINOR_VERSION > y || (DART_MINOR_VERSION >= y))))
&& (DART_MINOR_VERSION > y \
|| (DART_MINOR_VERSION >= y && DART_PATCH_VERSION > z)))

#define DART_VERSION_AT_MOST(x, y, z) \
#define DART_VERSION_LE(x, y, z) \
(DART_MAJOR_VERSION < x \
|| (DART_MAJOR_VERSION <= x \
&& (DART_MINOR_VERSION < y \
|| (DART_MINOR_VERSION <= y && DART_PATCH_VERSION <= z))))
|| (DART_MINOR_VERSION <= y && DART_PATCH_VERSION <= z)))

// Deprecated in 6.14
#define DART_VERSION_AT_LEAST(x, y, z) \
DART_VERSION_GE(x, y, z)

// Deprecated in 6.14
#define DART_MAJOR_MINOR_VERSION_AT_LEAST(x, y) \
(DART_MAJOR_VERSION > x \
|| (DART_MAJOR_VERSION >= x \
&& (DART_MINOR_VERSION > y || (DART_MINOR_VERSION >= y))))

// Deprecated in 6.14
#define DART_VERSION_AT_MOST(x, y, z) \
DART_VERSION_LE(x, y, z)

// Deprecated in 6.14
#define DART_MAJOR_MINOR_VERSION_AT_MOST(x, y) \
(DART_MAJOR_VERSION < x \
|| (DART_MAJOR_VERSION <= x \
&& (DART_MINOR_VERSION < y || (DART_MINOR_VERSION <= y))))

#define EIGEN_VERSION_AT_MOST(x, y, z) \
(EIGEN_WORLD_VERSION < x \
|| (EIGEN_WORLD_VERSION <= x \
&& (EIGEN_MAJOR_VERSION < y \
|| (EIGEN_MAJOR_VERSION <= y && EIGEN_MINOR_VERSION <= z))))

// Detect the compiler
#if defined(__clang__)
#define DART_COMPILER_CLANG
Expand Down
19 changes: 0 additions & 19 deletions dart/math/MathTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,6 @@ using EIGEN_V_VEC3D = std::vector<Eigen::Vector3d>;
// Deprecated
using EIGEN_VV_VEC3D = std::vector<std::vector<Eigen::Vector3d>>;

#if EIGEN_VERSION_AT_LEAST(3, 2, 1) && EIGEN_VERSION_AT_MOST(3, 2, 8)

// Deprecated in favor of dart::common::aligned_vector
template <typename _Tp>
using aligned_vector
= std::vector<_Tp, dart::common::detail::aligned_allocator_cpp11<_Tp>>;

// Deprecated in favor of dart::common::aligned_map
template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>>
using aligned_map = std::map<
_Key,
_Tp,
_Compare,
dart::common::detail::aligned_allocator_cpp11<std::pair<const _Key, _Tp>>>;

#else

// Deprecated in favor of dart::common::aligned_vector
template <typename _Tp>
using aligned_vector = std::vector<_Tp, Eigen::aligned_allocator<_Tp>>;
Expand All @@ -92,8 +75,6 @@ using aligned_map = std::map<
_Compare,
Eigen::aligned_allocator<std::pair<const _Key, _Tp>>>;

#endif

// Deprecated in favor of dart::common::make_aligned_shared
template <typename _Tp, typename... _Args>
DART_DEPRECATED(6.2)
Expand Down
Loading

0 comments on commit 952e30b

Please sign in to comment.