Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop supporting Trusty and use imported targets for dependencies #1212

Merged
merged 52 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
da62bd0
Fix cmake syntax mistake
jslee02 Dec 30, 2018
23b596d
Call find_package() for DART's dependency libraries
jslee02 Jan 5, 2019
0edd9ee
Reflect function name change
jslee02 Jan 5, 2019
b5d4a51
Merge remote-tracking branch 'origin/release-6.7' into dependency_target
jslee02 Jan 6, 2019
4ec793f
Remove unnecessary lines from DARTFind*.cmake
jslee02 Jan 6, 2019
74037fa
Change dart_find_package() from function to macro
jslee02 Jan 6, 2019
70c234b
Increase minimum required cmake version to 3.5.1
jslee02 Jan 7, 2019
a9858af
Use target of Eigen3 instead of variables
jslee02 Jan 7, 2019
da717b4
Add Eigen3 to dependency package list of dart component
jslee02 Jan 7, 2019
4f42b71
Drop testing DART on Trusty
jslee02 Jan 7, 2019
04b5f8d
Update finding Eigen3 logic
jslee02 Jan 7, 2019
a33ebe0
Fix variable name
jslee02 Jan 7, 2019
3d282f6
Remove distinguishing Clang and AppleClang in config
jslee02 Jan 7, 2019
686c85a
Use CCD target instead of variables
jslee02 Jan 7, 2019
4816efe
Rename CCD to ccd
jslee02 Jan 8, 2019
73c28e2
Use fcl target instead of variables
jslee02 Jan 8, 2019
c669b1e
Use assimp target instead of variables
jslee02 Jan 8, 2019
22d2318
Manual version check for Assimp
jslee02 Jan 8, 2019
89397ec
Use Boost targets instead of variables
jslee02 Jan 8, 2019
9e9779f
Read Assimp version from the PC file
jslee02 Jan 8, 2019
a5ce5d3
Use octomap target instead of variables
jslee02 Jan 8, 2019
691a7bd
Use octomap target instead of variables
jslee02 Jan 8, 2019
e2ab1d5
Remove use of include_directories() in favor of target_include_direct…
jslee02 Jan 8, 2019
541a810
Use flann target instead of variables
jslee02 Jan 8, 2019
ba6b5d9
Use Bullet target instead of variables
jslee02 Jan 8, 2019
79ed35f
Use tinyxml2 target instead of variables
jslee02 Jan 8, 2019
9bc9a37
Use ODE target instead of variables
jslee02 Jan 8, 2019
cb085ed
Use OpenGL/GLUT targets instead of variables
jslee02 Jan 8, 2019
3ec1c8a
Add missing target, OpenGL::GLU
jslee02 Jan 8, 2019
062f260
Use targets of optimizers instead of variables
jslee02 Jan 8, 2019
a176eb6
Fix defining HAVE_PAGMO
jslee02 Jan 8, 2019
0725843
Define OpenGL targets if not defined
jslee02 Jan 8, 2019
ef729fc
Add documentation about targets in DARTConfig.cmake
jslee02 Jan 8, 2019
e6bd19c
Fix typo
jslee02 Jan 8, 2019
03af11e
Merge branch 'release-6.7' into cmake_modernize
jslee02 Jan 8, 2019
c164f3c
Set the language standard to dart target
jslee02 Jan 8, 2019
32a36aa
Set CMP0053 only for finding OpenGL
jslee02 Jan 8, 2019
1037755
Remove debug print
jslee02 Jan 9, 2019
1dfb9c5
Use targets in examples and tutorials
jslee02 Jan 9, 2019
e2ddb45
Add cxx_std_11 compile feature to odelcpsolver target
jslee02 Jan 9, 2019
c8de175
Remove use of include_directories()
jslee02 Jan 9, 2019
240201d
Use urdfdom target instead of variables
jslee02 Jan 9, 2019
ab745c0
Increase minimum required CMake version to 3.5.1
jslee02 Jan 9, 2019
d1c2b47
Use properties to set c++ standard
jslee02 Jan 9, 2019
843a395
Find pagmo in QUIET mode
jslee02 Jan 9, 2019
2143777
Set more necessary target properties
jslee02 Jan 9, 2019
e297de1
Fix setting c++ standard
jslee02 Jan 9, 2019
f8d4111
Use VERSION_LESS for version comparison
jslee02 Jan 9, 2019
fd873ca
Give up using target properties for setting c++ standard
jslee02 Jan 9, 2019
df25130
Possible fix for build on Mojave
jslee02 Jan 9, 2019
d7bebf3
Use own module to find assimp since one from upstream isn't compatibl…
jslee02 Jan 9, 2019
7c13f5d
Don't use GLUT::GLUT that doesn't work on Majave (probably even other…
jslee02 Jan 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ env:

matrix:
include:
- os: linux
compiler: gcc
env:
- BUILD_NAME=TRUSTY_DEBUG
- SUDO=sudo
- BUILD_TYPE=Debug
- COMPILER=GCC
- BUILD_ONLY_ON_PULL_REQUEST=ON
- os: linux
compiler: gcc
env:
- BUILD_NAME=TRUSTY_RELEASE
- SUDO=sudo
- BUILD_TYPE=Release
- COMPILER=GCC
- os: linux
env:
- BUILD_NAME=XENIAL_DEBUG
Expand Down
21 changes: 2 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#===============================================================================
# CMake settings
#===============================================================================
# CMake 2.8.12 or above is required for CMakeParseArguments.
if(MSVC)
cmake_minimum_required(VERSION 3.8.0)
else()
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.5.1)
endif()

project(dart)
Expand All @@ -24,12 +23,6 @@ if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif()

# Stick to the legacy GL library until we need GLVND
# (see: https://cmake.org/cmake/help/git-stage/policy/CMP0072.html)
if(POLICY CMP0072)
cmake_policy(SET CMP0072 OLD)
endif()

# Variables used in Components.cmake
set(INCLUDE_INSTALL_DIR "include")
set(LIBRARY_INSTALL_DIR "lib")
Expand Down Expand Up @@ -143,12 +136,6 @@ endif()
#===============================================================================
include(DARTFindDependencies)

#===============================================================================
# Include directories
#===============================================================================
include_directories(BEFORE ${PROJECT_SOURCE_DIR})
include_directories("${CMAKE_BINARY_DIR}")

#===============================================================================
# Check for non-case-sensitive filesystems
#===============================================================================
Expand Down Expand Up @@ -200,8 +187,6 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
set(CXX_COMPILER_VERSION ${GCC_VERSION})
if(GCC_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "The installed g++ version is ${GCC_VERSION}. ${PROJECT_NAME} requires g++ 4.8 or greater.")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fno-omit-frame-pointer -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls")
Expand All @@ -212,7 +197,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_DEBUG} -pg")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")

elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")

if(DART_TREAT_WARNINGS_AS_ERRORS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations")
Expand All @@ -225,8 +210,6 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CXX_COMPILER_VERSION ${CLANG_VERSION})
if(CLANG_VERSION VERSION_LESS 3.3)
message(FATAL_ERROR "The installed Clang version is ${CLANG_VERSION}. ${PROJECT_NAME} requires clang 3.3 or greater.")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
Expand Down
31 changes: 19 additions & 12 deletions cmake/Components.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
# 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.

# CMake 2.8.12 or above is required for CMakeParseArguments.
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.5.1)

include(CMakeParseArguments)

Expand Down Expand Up @@ -205,20 +204,28 @@ function(install_component_exports package_name)
get_property(dependency_package TARGET "${target}"
PROPERTY "${component_prefix}dependency_package")
foreach(dependent_package ${dependency_package})
set(findfile_name "DARTFind${dependent_package}.cmake")
set(findfile_path "")
set(find_pkg_name "Find${dependent_package}.cmake")
set(find_pkg_path "")
set(dart_find_pkg_name "DARTFind${dependent_package}.cmake")
set(dart_find_pkg_path "")
foreach(module_path ${CMAKE_MODULE_PATH})
set(findfile_path_candidate "${module_path}/${findfile_name}")
if(EXISTS "${findfile_path_candidate}")
set(findfile_path ${findfile_path_candidate})
break()
set(find_pkg_path_candidate "${module_path}/${find_pkg_name}")
set(dart_find_pkg_path_candidate "${module_path}/${dart_find_pkg_name}")
if("${find_pkg_path}" STREQUAL "" AND EXISTS "${find_pkg_path_candidate}")
set(find_pkg_path ${find_pkg_path_candidate})
endif()
if("${dart_find_pkg_path}" STREQUAL "" AND EXISTS "${dart_find_pkg_path_candidate}")
set(dart_find_pkg_path ${dart_find_pkg_path_candidate})
endif()
endforeach()
if("${findfile_path}" STREQUAL "")
message(FATAL_ERROR "Failed to find '${findfile_path}'.")
if(NOT "${find_pkg_path}" STREQUAL "")
install(FILES "${find_pkg_path}" DESTINATION "${CONFIG_INSTALL_DIR}")
endif()
if("${dart_find_pkg_path}" STREQUAL "")
message(FATAL_ERROR "Failed to find '${dart_find_pkg_path}'.")
endif()
file(APPEND "${output_path}" "include(\${CMAKE_CURRENT_LIST_DIR}/${findfile_name})\n")
install(FILES "${findfile_path}" DESTINATION "${CONFIG_INSTALL_DIR}")
file(APPEND "${output_path}" "include(\${CMAKE_CURRENT_LIST_DIR}/${dart_find_pkg_name})\n")
install(FILES "${dart_find_pkg_path}" DESTINATION "${CONFIG_INSTALL_DIR}")
endforeach()

install(FILES "${output_path}"
Expand Down
14 changes: 11 additions & 3 deletions cmake/DARTConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
# CMake config file for DART
#
# This sets the following variables:
# @PROJECT_NAME_UPPERCASE@_INCLUDE_DIRS - Directories containing the DART include files.
# @PROJECT_NAME_UPPERCASE@_LIBRARIES - Libraries needed to use DART.
# @PROJECT_NAME_UPPERCASE@_VERSION - DART version.
# @PROJECT_NAME_UPPERCASE@_INCLUDE_DIRS - Directories containing the DART include files.
# @PROJECT_NAME_UPPERCASE@_LIBRARIES - Libraries needed to use DART.
# @PROJECT_NAME_UPPERCASE@_VERSION - DART version.
#
# and the following `IMPORTED` targets:
# dart - Main target.
# dart-<C> - Target for specific component (e.g., dart-collision-bullet).

#===============================================================================
# Helper Function Definitions
Expand Down Expand Up @@ -128,6 +132,8 @@ endfunction()
# Main
#===============================================================================

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})

# Default component: dart
list(APPEND @PROJECT_NAME_UPPERCASE@_FIND_COMPONENTS dart)

Expand All @@ -142,6 +148,8 @@ if(@PROJECT_NAME_UPPERCASE@_FIND_COMPONENTS)
@PROJECT_NAME@_package_init(${@PROJECT_NAME_UPPERCASE@_FIND_COMPONENTS})
endif()

list(REMOVE_AT CMAKE_MODULE_PATH -1)

# Use find_package_handle_standard_args to generate output. This handles the
# REQUIRED keyword, sets @PROJECT_NAME_UPPERCASE@_FOUND, and generates the appropriate
# STATUS and FATAL_ERROR messages.
Expand Down
25 changes: 25 additions & 0 deletions cmake/DARTFindBoost.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2011-2019, 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

set(DART_MIN_BOOST_VERSION 1.58.0 CACHE INTERNAL "Boost min version requirement" FORCE)
if(MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
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()
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()
20 changes: 20 additions & 0 deletions cmake/DARTFindBullet.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2011-2019, 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

# Bullet. Force MODULE mode to use the FindBullet.cmake file distributed with
# CMake. Otherwise, we may end up using the BulletConfig.cmake file distributed
# with Bullet, which uses relative paths and may break transitive dependencies.
find_package(Bullet COMPONENTS BulletMath BulletCollision MODULE QUIET)

if(BULLET_FOUND AND NOT TARGET Bullet)
add_library(Bullet INTERFACE IMPORTED)
set_target_properties(Bullet PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BULLET_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${BULLET_LIBRARIES}"
)
endif()
35 changes: 10 additions & 25 deletions cmake/DARTFindDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ if(DART_VERBOSE)
endif()

# Eigen
find_package(EIGEN3 3.0.5 REQUIRED)
dart_find_package(Eigen3)
dart_check_required_package(EIGEN3 "eigen3")

# CCD
find_package(CCD 1.4.0 REQUIRED)
dart_check_required_package(CCD "libccd")
dart_find_package(ccd)
dart_check_required_package(ccd "libccd")

# FCL
find_package(FCL 0.2.9 REQUIRED)
dart_check_required_package(FCL "fcl")
dart_find_package(fcl)
dart_check_required_package(fcl "fcl")

# ASSIMP
find_package(ASSIMP 3.0.0 REQUIRED)
dart_check_required_package(ASSIMP "assimp")
dart_find_package(assimp)
dart_check_required_package(assimp "assimp")
if(ASSIMP_FOUND)
# Check for missing symbols in ASSIMP (see #451)
include(CheckCXXSourceCompiles)
Expand Down Expand Up @@ -86,25 +86,10 @@ if(ASSIMP_FOUND)
endif()

# Boost
set(DART_MIN_BOOST_VERSION 1.46.0 CACHE INTERNAL "Boost min version requirement" FORCE)
if(MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
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()
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()
dart_find_package(Boost)

find_package(octomap 1.6.8 QUIET)
# octomap
dart_find_package(octomap)
if (octomap_FOUND AND NOT MSVC)
if (MSVC)
# Supporting Octomap on Windows is disabled for the following issue:
Expand Down
26 changes: 26 additions & 0 deletions cmake/DARTFindEigen3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2011-2019, 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

# We intentionally don't specify the required Eigen3 version like
# find_package(Eigen3 3.2.92) because the version file is not provided by
# upstream until 3.3.1.
find_package(Eigen3 REQUIRED)
if(EIGEN3_VERSION_STRING VERSION_LESS 3.2.92) # 3.3~beta1
message(FATAL_ERROR "Eigen3 ${EIGEN3_VERSION_STRING} is found but >= 3.2.92
(3.3~beta1) is required"
)
endif()

# Set target Eigen3::Eigen if not set
# The target is not imported by upstream until 3.3.2
if(Eigen3_FOUND AND NOT TARGET Eigen3::Eigen)
add_library(Eigen3::Eigen INTERFACE IMPORTED)
set_target_properties(Eigen3::Eigen PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EIGEN3_INCLUDE_DIRS}"
)
endif()
9 changes: 9 additions & 0 deletions cmake/DARTFindGLUT.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2011-2019, 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(GLUT QUIET)
9 changes: 9 additions & 0 deletions cmake/DARTFindIPOPT.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2011-2019, 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(IPOPT 3.11.9 QUIET)
9 changes: 9 additions & 0 deletions cmake/DARTFindNLOPT.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2011-2019, 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(NLOPT 2.4.1 QUIET)
9 changes: 9 additions & 0 deletions cmake/DARTFindODE.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2011-2019, 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(ODE 0.13 QUIET)
35 changes: 35 additions & 0 deletions cmake/DARTFindOpenGL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2011-2019, 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

cmake_policy(PUSH)

# Stick to the legacy GL library until we need GLVND
# (see: https://cmake.org/cmake/help/git-stage/policy/CMP0072.html)
if(POLICY CMP0072)
cmake_policy(SET CMP0072 OLD)
endif()

find_package(OpenGL QUIET)

cmake_policy(POP)

if(OPENGL_FOUND AND NOT TARGET OpenGL::GL)
add_library(OpenGL::GL INTERFACE IMPORTED)
set_target_properties(OpenGL::GL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${OPENGL_gl_LIBRARY}"
)
endif()

if(OPENGL_FOUND AND NOT TARGET OpenGL::GLU)
add_library(OpenGL::GLU INTERFACE IMPORTED)
set_target_properties(OpenGL::GLU PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${OPENGL_glu_LIBRARY}"
)
endif()
18 changes: 18 additions & 0 deletions cmake/DARTFindassimp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2011-2019, 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(assimp REQUIRED)

# Manually check version because the upstream version compatibility policy
# doesn't allow different major number while DART is compatible any version
# greater than or equal to 3.2.
if(ASSIMP_VERSION VERSION_LESS 3.2)
message(STATUS "Found Assimp ${ASSIMP_VERSION}, but Assimp >= 3.2 is
required"
)
endif()
Loading