From da62bd0295ac62f0e399825c16ae7abf88009f03 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 30 Dec 2018 11:39:35 -0800 Subject: [PATCH 01/50] Fix cmake syntax mistake --- examples/humanJointLimits/InSourceBuild.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/humanJointLimits/InSourceBuild.cmake b/examples/humanJointLimits/InSourceBuild.cmake index 909b6f5c409e5..dd9ff6f33e344 100644 --- a/examples/humanJointLimits/InSourceBuild.cmake +++ b/examples/humanJointLimits/InSourceBuild.cmake @@ -16,8 +16,11 @@ if(NOT TinyDNN_FOUND) return() endif() -find_package(Threads) -if(NOT Threads_FOUND QUIET) +find_package(Threads QUIET) +if(NOT Threads_FOUND) + if(DART_VERBOSE) + message(STATUS "Failed to find Threads. humanJointLimits is disabled.") + endif() return() endif() From 23b596d27874df6c73366f3bb68a4c331565b853 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 5 Jan 2019 04:09:45 -0800 Subject: [PATCH 02/50] Call find_package() for DART's dependency libraries when a downstream library imports DART. This is to import targets of the dependency libraries (if available) so that the dependency library is properly linked when the library is a target but not an absolute path to the library. Without this, simply linking to a dependency target will fail as #1200. --- cmake/Components.cmake | 36 ++++++++++++++++++++++++++++++++++ cmake/DARTFindurdfdom.cmake | 24 +++++++++++++++++++++++ cmake/DARTMacros.cmake | 9 +++++++++ dart/utils/urdf/CMakeLists.txt | 18 ++--------------- 4 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 cmake/DARTFindurdfdom.cmake diff --git a/cmake/Components.cmake b/cmake/Components.cmake index 7227630f4ba71..9d5996dc2be95 100644 --- a/cmake/Components.cmake +++ b/cmake/Components.cmake @@ -121,6 +121,23 @@ function(add_component_dependencies package_name component) PROPERTY "${component_prefix}DEPENDENCIES" ${dependency_components}) endfunction() +#============================================================================== +function(add_component_dependency_packages package_name component) + set(component_prefix "${package_name}_component_") + set(dependency_package ${ARGN}) + + is_component(is_valid ${package_name} "${component}") + if(NOT ${is_valid}) + message(FATAL_ERROR + "Target '${component}' is not a component of ${package_name}.") + endif() + + set(target "${component_prefix}${component}") + + set_property(TARGET "${target}" APPEND + PROPERTY "${component_prefix}dependency_package" ${dependency_package}) +endfunction() + #============================================================================== function(add_component_targets package_name component) set(component_prefix "${package_name}_component_") @@ -185,6 +202,25 @@ function(install_component_exports package_name) file(APPEND "${output_path}" "set(\"${package_name}_${component}_LIBRARIES\" ${libraries})\n") + 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 "") + 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() + endif() + endforeach() + if("${findfile_path}" STREQUAL "") + message(FATAL_ERROR "Failed to find '${findfile_path}'.") + endif() + file(APPEND "${output_path}" "include(\${CMAKE_CURRENT_LIST_DIR}/${findfile_name})\n") + install(FILES "${findfile_path}" DESTINATION "${CONFIG_INSTALL_DIR}") + endforeach() + install(FILES "${output_path}" DESTINATION "${CONFIG_INSTALL_DIR}") endforeach() diff --git a/cmake/DARTFindurdfdom.cmake b/cmake/DARTFindurdfdom.cmake new file mode 100644 index 0000000000000..710948cb99151 --- /dev/null +++ b/cmake/DARTFindurdfdom.cmake @@ -0,0 +1,24 @@ +# Copyright (c) 2011-2018, 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(urdfdom QUIET) +if(urdfdom_FOUND) + if(DART_VERBOSE) + message(STATUS "Looking for urdfdom - ${urdfdom_headers_VERSION} found") + endif() +else() + message(STATUS "Looking for urdfdom - NOT found, please install liburdfdom-dev") + return() +endif() +if(MSVC) + set(urdfdom_LIBRARIES optimized urdfdom_sensor debug urdfdom_sensord + optimized urdfdom_model_state debug urdfdom_model_stated + optimized urdfdom_model debug urdfdom_modeld + optimized urdfdom_world debug urdfdom_worldd + optimized console_bridge debug console_bridged) +endif() diff --git a/cmake/DARTMacros.cmake b/cmake/DARTMacros.cmake index 0e47590955158..7ed90da9c0346 100644 --- a/cmake/DARTMacros.cmake +++ b/cmake/DARTMacros.cmake @@ -72,6 +72,15 @@ macro(dart_generate_include_header_file file_path target_dir) endforeach() endmacro() +#=============================================================================== +# Add library and set target properties +# Usage: +# dart_add_library(_libname source1 [source2 ...]) +#=============================================================================== +function(dart_find_package _name) + include(DARTFind${_name}) +endfunction() + #=============================================================================== # Add library and set target properties # Usage: diff --git a/dart/utils/urdf/CMakeLists.txt b/dart/utils/urdf/CMakeLists.txt index 6046e244671fc..269a1439d9b03 100644 --- a/dart/utils/urdf/CMakeLists.txt +++ b/dart/utils/urdf/CMakeLists.txt @@ -1,20 +1,5 @@ # Dependency checks -find_package(urdfdom QUIET) -if(urdfdom_FOUND) - if(DART_VERBOSE) - message(STATUS "Looking for urdfdom - ${urdfdom_headers_VERSION} found") - endif() -else() - message(STATUS "Looking for urdfdom - NOT found, please install liburdfdom-dev") - return() -endif() -if(MSVC) - set(urdfdom_LIBRARIES optimized urdfdom_sensor debug urdfdom_sensord - optimized urdfdom_model_state debug urdfdom_model_stated - optimized urdfdom_model debug urdfdom_modeld - optimized urdfdom_world debug urdfdom_worldd - optimized console_bridge debug console_bridged) -endif() +dart_find_package(urdfdom) # Search all header and source files file(GLOB hdrs "*.hpp") @@ -59,6 +44,7 @@ target_link_libraries( add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} utils) +add_component_dependent_packages(${PROJECT_NAME} ${component_name} urdfdom) # Generate header for this namespace dart_get_filename_components(header_names "utils_urdf headers" ${hdrs}) From 0edd9eecee98c1beda08284c6791ea56bd359ecf Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 5 Jan 2019 04:50:20 -0800 Subject: [PATCH 03/50] Reflect function name change --- dart/utils/urdf/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dart/utils/urdf/CMakeLists.txt b/dart/utils/urdf/CMakeLists.txt index 269a1439d9b03..e2c7b13d31157 100644 --- a/dart/utils/urdf/CMakeLists.txt +++ b/dart/utils/urdf/CMakeLists.txt @@ -44,7 +44,7 @@ target_link_libraries( add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} utils) -add_component_dependent_packages(${PROJECT_NAME} ${component_name} urdfdom) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} urdfdom) # Generate header for this namespace dart_get_filename_components(header_names "utils_urdf headers" ${hdrs}) From 4ec793f016c08bd51bb11187d6a63bd2408f68af Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 5 Jan 2019 20:53:05 -0800 Subject: [PATCH 04/50] Remove unnecessary lines from DARTFind*.cmake --- cmake/DARTFindurdfdom.cmake | 15 --------------- dart/utils/urdf/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cmake/DARTFindurdfdom.cmake b/cmake/DARTFindurdfdom.cmake index 710948cb99151..309857ee6daaa 100644 --- a/cmake/DARTFindurdfdom.cmake +++ b/cmake/DARTFindurdfdom.cmake @@ -7,18 +7,3 @@ # This file is provided under the "BSD-style" License find_package(urdfdom QUIET) -if(urdfdom_FOUND) - if(DART_VERBOSE) - message(STATUS "Looking for urdfdom - ${urdfdom_headers_VERSION} found") - endif() -else() - message(STATUS "Looking for urdfdom - NOT found, please install liburdfdom-dev") - return() -endif() -if(MSVC) - set(urdfdom_LIBRARIES optimized urdfdom_sensor debug urdfdom_sensord - optimized urdfdom_model_state debug urdfdom_model_stated - optimized urdfdom_model debug urdfdom_modeld - optimized urdfdom_world debug urdfdom_worldd - optimized console_bridge debug console_bridged) -endif() diff --git a/dart/utils/urdf/CMakeLists.txt b/dart/utils/urdf/CMakeLists.txt index e2c7b13d31157..6c4e0f1f6c7c6 100644 --- a/dart/utils/urdf/CMakeLists.txt +++ b/dart/utils/urdf/CMakeLists.txt @@ -1,5 +1,20 @@ # Dependency checks dart_find_package(urdfdom) +if(urdfdom_FOUND) + if(DART_VERBOSE) + message(STATUS "Looking for urdfdom - ${urdfdom_headers_VERSION} found") + endif() +else() + message(STATUS "Looking for urdfdom - NOT found, please install liburdfdom-dev") + return() +endif() +if(MSVC) + set(urdfdom_LIBRARIES optimized urdfdom_sensor debug urdfdom_sensord + optimized urdfdom_model_state debug urdfdom_model_stated + optimized urdfdom_model debug urdfdom_modeld + optimized urdfdom_world debug urdfdom_worldd + optimized console_bridge debug console_bridged) +endif() # Search all header and source files file(GLOB hdrs "*.hpp") From 74037fab0b9fcc874ebcf8839ce653acf37b7990 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sat, 5 Jan 2019 21:06:24 -0800 Subject: [PATCH 05/50] Change dart_find_package() from function to macro --- cmake/DARTMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/DARTMacros.cmake b/cmake/DARTMacros.cmake index 7ed90da9c0346..ddbef06cc3409 100644 --- a/cmake/DARTMacros.cmake +++ b/cmake/DARTMacros.cmake @@ -77,9 +77,9 @@ endmacro() # Usage: # dart_add_library(_libname source1 [source2 ...]) #=============================================================================== -function(dart_find_package _name) +macro(dart_find_package _name) include(DARTFind${_name}) -endfunction() +endmacro() #=============================================================================== # Add library and set target properties From 70c234b48b91b293db85436dedd9c22ddfe3a4bc Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 17:46:50 -0800 Subject: [PATCH 06/50] Increase minimum required cmake version to 3.5.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ad57ed0ef846..c65e561cc34fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ 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) From a9858af3c9281f754dc0023cb9ae895a7d081008 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 18:14:57 -0800 Subject: [PATCH 07/50] Use target of Eigen3 instead of variables --- cmake/DARTFindDependencies.cmake | 2 +- cmake/DARTFindEigen3.cmake | 17 +++++++++++++++ cmake/FindEIGEN3.cmake | 36 -------------------------------- dart/CMakeLists.txt | 2 +- 4 files changed, 19 insertions(+), 38 deletions(-) create mode 100644 cmake/DARTFindEigen3.cmake delete mode 100644 cmake/FindEIGEN3.cmake diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index aff6b8990fb2a..58557aa21ace2 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -10,7 +10,7 @@ if(DART_VERBOSE) endif() # Eigen -find_package(EIGEN3 3.0.5 REQUIRED) +dart_find_package(Eigen3) dart_check_required_package(EIGEN3 "eigen3") # CCD diff --git a/cmake/DARTFindEigen3.cmake b/cmake/DARTFindEigen3.cmake new file mode 100644 index 0000000000000..77d03b6641c5b --- /dev/null +++ b/cmake/DARTFindEigen3.cmake @@ -0,0 +1,17 @@ +# Copyright (c) 2011-2018, 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(Eigen3 3.0.5 REQUIRED) + +# Set target Eigen3::Eigen if not set +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() diff --git a/cmake/FindEIGEN3.cmake b/cmake/FindEIGEN3.cmake deleted file mode 100644 index 10aa9b2f4a354..0000000000000 --- a/cmake/FindEIGEN3.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2011-2018, 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 Eigen -# -# This sets the following variables: -# EIGEN3_FOUND -# EIGEN3_INCLUDE_DIRS -# EIGEN3_VERSION - -find_package(PkgConfig QUIET) - -# Check to see if pkgconfig is installed. -pkg_check_modules(PC_EIGEN3 eigen3 QUIET) - -# Include directories -find_path(EIGEN3_INCLUDE_DIRS - NAMES Eigen/Core - PATHS "${CMAKE_INSTALL_PREFIX}/include" - PATH_SUFFIXES eigen3 eigen) - -# Version -set(EIGEN3_VERSION ${PC_EIGEN3_VERSION}) - -# Set (NAME)_FOUND if all the variables and the version are satisfied. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(EIGEN3 - FAIL_MESSAGE DEFAULT_MSG - REQUIRED_VARS EIGEN3_INCLUDE_DIRS - VERSION_VAR EIGEN3_VERSION) - diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 99114ac9de668..4f82fc7a810ea 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -121,7 +121,6 @@ dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) target_include_directories( dart SYSTEM PUBLIC - ${EIGEN3_INCLUDE_DIRS} ${CCD_INCLUDE_DIRS} ${FCL_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIRS} @@ -132,6 +131,7 @@ target_link_libraries( dart PUBLIC ${CMAKE_DL_LIBS} + Eigen3::Eigen ${CCD_LIBRARIES} ${FCL_LIBRARIES} ${ASSIMP_LIBRARIES} From da717b4f81bde947eae315a2b3eb2ff94cfc6deb Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 20:10:27 -0800 Subject: [PATCH 08/50] Add Eigen3 to dependency package list of dart component --- dart/CMakeLists.txt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 4f82fc7a810ea..233dc6efe06ca 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -160,16 +160,9 @@ if(DART_ENABLE_SIMD) endif() # Default component -add_component_targets( - ${PROJECT_NAME} - dart # component name - dart # target name -) -add_component_dependencies( - ${PROJECT_NAME} - dart - external-odelcpsolver -) +add_component_targets(${PROJECT_NAME} dart dart) +add_component_dependencies(${PROJECT_NAME} dart external-odelcpsolver) +add_component_dependency_packages(${PROJECT_NAME} dart Eigen3) if(MSVC) set_target_properties( From 4f42b71cde5fc69d6e6846c3d8282c5c52bce063 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 20:16:56 -0800 Subject: [PATCH 09/50] Drop testing DART on Trusty --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 23d49ee7f7ea5..590eb88c3a0a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 From 04b5f8d3da2c4394509677cf060c6a39b3ef70ba Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 20:39:20 -0800 Subject: [PATCH 10/50] Update finding Eigen3 logic --- cmake/DARTFindEigen3.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/DARTFindEigen3.cmake b/cmake/DARTFindEigen3.cmake index 77d03b6641c5b..a7062721ea37f 100644 --- a/cmake/DARTFindEigen3.cmake +++ b/cmake/DARTFindEigen3.cmake @@ -6,9 +6,18 @@ # # This file is provided under the "BSD-style" License -find_package(Eigen3 3.0.5 REQUIRED) +# 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 VERSION_LESS 3.2.92) # requires Eigen3 3.3~beta1 + message(FATAL_ERROR + "Eigen3 ${EIGEN3_VERSION} 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 From a33ebe026fa06360b585493ec9cc70b00bcd3c18 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 20:48:54 -0800 Subject: [PATCH 11/50] Fix variable name --- cmake/DARTFindEigen3.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/DARTFindEigen3.cmake b/cmake/DARTFindEigen3.cmake index a7062721ea37f..400053aa10160 100644 --- a/cmake/DARTFindEigen3.cmake +++ b/cmake/DARTFindEigen3.cmake @@ -10,9 +10,9 @@ # 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 VERSION_LESS 3.2.92) # requires Eigen3 3.3~beta1 - message(FATAL_ERROR - "Eigen3 ${EIGEN3_VERSION} is found but >= 3.2.92 (3.3~beta1) is 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() From 3d282f6c58cffd3a0ffe5905dd67cb12859d2ffc Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 21:16:03 -0800 Subject: [PATCH 12/50] Remove distinguishing Clang and AppleClang in config --- CMakeLists.txt | 2 +- dart/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c65e561cc34fd..d32468e19df75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,7 +212,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") diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 233dc6efe06ca..180157eaec0d5 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -154,7 +154,7 @@ if(DART_ENABLE_SIMD) if(GCC_VERSION VERSION_GREATER 7.0) target_compile_options(dart PUBLIC -faligned-new) endif() - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") target_compile_options(dart PUBLIC -march=native -faligned-new) endif() endif() From 686c85aa10456ec4452925f36a8bfd24494cf23e Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 6 Jan 2019 23:23:21 -0800 Subject: [PATCH 13/50] Use CCD target instead of variables --- cmake/Components.cmake | 29 ++++++++---- cmake/DARTConfig.cmake.in | 4 ++ cmake/DARTFindCCD.cmake | 9 ++++ cmake/DARTFindEigen3.cmake | 2 +- cmake/DARTMacros.cmake | 2 + cmake/FindCCD.cmake | 94 ++++++++++++++++++++++---------------- dart/CMakeLists.txt | 7 +-- 7 files changed, 94 insertions(+), 53 deletions(-) create mode 100644 cmake/DARTFindCCD.cmake diff --git a/cmake/Components.cmake b/cmake/Components.cmake index 9d5996dc2be95..602e3c2793c5e 100644 --- a/cmake/Components.cmake +++ b/cmake/Components.cmake @@ -205,20 +205,29 @@ 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}" diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 5c8556dd72f87..4b2c930bcfc9f 100644 --- a/cmake/DARTConfig.cmake.in +++ b/cmake/DARTConfig.cmake.in @@ -128,6 +128,8 @@ endfunction() # Main #=============================================================================== +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + # Default component: dart list(APPEND @PROJECT_NAME_UPPERCASE@_FIND_COMPONENTS dart) @@ -142,6 +144,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. diff --git a/cmake/DARTFindCCD.cmake b/cmake/DARTFindCCD.cmake new file mode 100644 index 0000000000000..a2fc4290ded82 --- /dev/null +++ b/cmake/DARTFindCCD.cmake @@ -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(CCD 2.0 REQUIRED) diff --git a/cmake/DARTFindEigen3.cmake b/cmake/DARTFindEigen3.cmake index 400053aa10160..9eda92bff3633 100644 --- a/cmake/DARTFindEigen3.cmake +++ b/cmake/DARTFindEigen3.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2011-2018, The DART development contributors +# Copyright (c) 2011-2019, The DART development contributors # All rights reserved. # # The list of contributors can be found at: diff --git a/cmake/DARTMacros.cmake b/cmake/DARTMacros.cmake index ddbef06cc3409..cfa5410a195b1 100644 --- a/cmake/DARTMacros.cmake +++ b/cmake/DARTMacros.cmake @@ -115,6 +115,8 @@ endfunction() #=============================================================================== function(dart_check_required_package variable dependency) + # TODO: Take version for the case that the version variable is not + # _VERSION if(${${variable}_FOUND}) if(DART_VERBOSE) message(STATUS "Looking for ${dependency} - version ${${variable}_VERSION}" diff --git a/cmake/FindCCD.cmake b/cmake/FindCCD.cmake index e33890db0eb93..624b2d10831c6 100644 --- a/cmake/FindCCD.cmake +++ b/cmake/FindCCD.cmake @@ -14,49 +14,65 @@ # CCD_LIBRARIES # CCD_VERSION -find_package(PkgConfig QUIET) - -# Check to see if pkgconfig is installed. -pkg_check_modules(PC_CCD ccd QUIET) - -# Include directories -# Give explicit precedence to ${PC_CCD_INCLUDEDIR} -find_path(CCD_INCLUDE_DIRS - NAMES ccd/ccd.h - HINTS ${PC_CCD_INCLUDEDIR} - NO_DEFAULT_PATH - NO_CMAKE_PATH - NO_CMAKE_ENVIRONMENT_PATH - NO_SYSTEM_ENVIRONMENT_PATH) -find_path(CCD_INCLUDE_DIRS - NAMES ccd/ccd.h - HINTS ${PC_CCD_INCLUDEDIR} - PATHS "${CMAKE_INSTALL_PREFIX}/include") - -# Libraries -if(MSVC) - set(CCD_LIBRARIES optimized ccd debug ccdd) -else() - # Give explicit precedence to ${PC_CCD_LIBDIR} - find_library(CCD_LIBRARIES - NAMES ccd - HINTS ${PC_CCD_LIBDIR} +find_package(CCD QUIET CONFIG) +# Upstream provide ccd-config.cmake since 2.1. + +if(NOT CCD_FOUND) + + find_package(PkgConfig QUIET) + + # Check to see if pkgconfig is installed. + pkg_check_modules(PC_CCD ccd QUIET) + + # Include directories + # Give explicit precedence to ${PC_CCD_INCLUDEDIR} + find_path(CCD_INCLUDE_DIRS + NAMES ccd/ccd.h + HINTS ${PC_CCD_INCLUDEDIR} NO_DEFAULT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH) - find_library(CCD_LIBRARIES - NAMES ccd - HINTS ${PC_CCD_LIBDIR}) -endif() + find_path(CCD_INCLUDE_DIRS + NAMES ccd/ccd.h + HINTS ${PC_CCD_INCLUDEDIR} + PATHS "${CMAKE_INSTALL_PREFIX}/include") + + # Libraries + if(MSVC) + set(CCD_LIBRARIES optimized ccd debug ccdd) + else() + # Give explicit precedence to ${PC_CCD_LIBDIR} + find_library(CCD_LIBRARIES + NAMES ccd + HINTS ${PC_CCD_LIBDIR} + NO_DEFAULT_PATH + NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH) + find_library(CCD_LIBRARIES + NAMES ccd + HINTS ${PC_CCD_LIBDIR}) + endif() -# Version -set(CCD_VERSION ${PC_CCD_VERSION}) + # Version + set(CCD_VERSION ${PC_CCD_VERSION}) -# Set (NAME)_FOUND if all the variables and the version are satisfied. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(CCD - FAIL_MESSAGE DEFAULT_MSG - REQUIRED_VARS CCD_INCLUDE_DIRS CCD_LIBRARIES - VERSION_VAR CCD_VERSION) + # Set (NAME)_FOUND if all the variables and the version are satisfied. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(CCD + FAIL_MESSAGE DEFAULT_MSG + REQUIRED_VARS CCD_INCLUDE_DIRS CCD_LIBRARIES + VERSION_VAR CCD_VERSION) + # Set target ccd if not set + # Upstream provides the target since 2.1 + if(CCD_FOUND AND NOT TARGET ccd) + add_library(ccd INTERFACE IMPORTED) + set_target_properties(ccd PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CCD_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${CCD_LIBRARIES}" + ) + endif() + +endif() diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 180157eaec0d5..1d19e5f7f7b2e 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -121,7 +121,6 @@ dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) target_include_directories( dart SYSTEM PUBLIC - ${CCD_INCLUDE_DIRS} ${FCL_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} @@ -132,7 +131,7 @@ target_link_libraries( PUBLIC ${CMAKE_DL_LIBS} Eigen3::Eigen - ${CCD_LIBRARIES} + ccd ${FCL_LIBRARIES} ${ASSIMP_LIBRARIES} ${Boost_LIBRARIES} @@ -162,7 +161,9 @@ endif() # Default component add_component_targets(${PROJECT_NAME} dart dart) add_component_dependencies(${PROJECT_NAME} dart external-odelcpsolver) -add_component_dependency_packages(${PROJECT_NAME} dart Eigen3) +add_component_dependency_packages(${PROJECT_NAME} dart + Eigen3 CCD +) if(MSVC) set_target_properties( From 4816efe73f771e8131adf552f5fe2d1192017699 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 19:09:54 -0800 Subject: [PATCH 14/50] Rename CCD to ccd --- cmake/DARTFindDependencies.cmake | 4 ++-- cmake/DARTFindccd.cmake | 9 +++++++++ cmake/{FindCCD.cmake => Findccd.cmake} | 2 +- dart/CMakeLists.txt | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 cmake/DARTFindccd.cmake rename cmake/{FindCCD.cmake => Findccd.cmake} (98%) diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index 58557aa21ace2..2af9372f8b9f8 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -14,8 +14,8 @@ dart_find_package(Eigen3) dart_check_required_package(EIGEN3 "eigen3") # CCD -find_package(CCD 1.4.0 REQUIRED) -dart_check_required_package(CCD "libccd") +find_package(ccd 1.4.0 REQUIRED) +dart_check_required_package(ccd "libccd") # FCL find_package(FCL 0.2.9 REQUIRED) diff --git a/cmake/DARTFindccd.cmake b/cmake/DARTFindccd.cmake new file mode 100644 index 0000000000000..c2c1eb40effa5 --- /dev/null +++ b/cmake/DARTFindccd.cmake @@ -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(ccd 2.0 REQUIRED) diff --git a/cmake/FindCCD.cmake b/cmake/Findccd.cmake similarity index 98% rename from cmake/FindCCD.cmake rename to cmake/Findccd.cmake index 624b2d10831c6..79856f7506d4e 100644 --- a/cmake/FindCCD.cmake +++ b/cmake/Findccd.cmake @@ -14,7 +14,7 @@ # CCD_LIBRARIES # CCD_VERSION -find_package(CCD QUIET CONFIG) +find_package(ccd QUIET CONFIG) # Upstream provide ccd-config.cmake since 2.1. if(NOT CCD_FOUND) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 1d19e5f7f7b2e..4ae2205a52bb2 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -162,7 +162,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 + Eigen3 ccd ) if(MSVC) From 73c28e20f5d598bd5b105d6ea6df69e0086bdecc Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 19:16:31 -0800 Subject: [PATCH 15/50] Use fcl target instead of variables --- cmake/DARTFindDependencies.cmake | 6 +++--- cmake/{DARTFindCCD.cmake => DARTFindfcl.cmake} | 2 +- cmake/{FindFCL.cmake => Findfcl.cmake} | 10 ++++++++++ dart/CMakeLists.txt | 3 +-- 4 files changed, 15 insertions(+), 6 deletions(-) rename cmake/{DARTFindCCD.cmake => DARTFindfcl.cmake} (88%) rename cmake/{FindFCL.cmake => Findfcl.cmake} (80%) diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index 2af9372f8b9f8..13b5684ce952c 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -14,12 +14,12 @@ dart_find_package(Eigen3) dart_check_required_package(EIGEN3 "eigen3") # CCD -find_package(ccd 1.4.0 REQUIRED) +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) diff --git a/cmake/DARTFindCCD.cmake b/cmake/DARTFindfcl.cmake similarity index 88% rename from cmake/DARTFindCCD.cmake rename to cmake/DARTFindfcl.cmake index a2fc4290ded82..ccd957ee01973 100644 --- a/cmake/DARTFindCCD.cmake +++ b/cmake/DARTFindfcl.cmake @@ -6,4 +6,4 @@ # # This file is provided under the "BSD-style" License -find_package(CCD 2.0 REQUIRED) +find_package(fcl 0.3.2 REQUIRED) diff --git a/cmake/FindFCL.cmake b/cmake/Findfcl.cmake similarity index 80% rename from cmake/FindFCL.cmake rename to cmake/Findfcl.cmake index f50b01edef657..491f070588763 100644 --- a/cmake/FindFCL.cmake +++ b/cmake/Findfcl.cmake @@ -59,3 +59,13 @@ find_package_handle_standard_args(FCL REQUIRED_VARS FCL_INCLUDE_DIRS FCL_LIBRARIES VERSION_VAR FCL_VERSION) +# Set target fcl if not set +# Upstream provides the target since 0.5.0 but some package managers don't +# install the config file, which defines the target. +if(FCL_FOUND AND NOT TARGET fcl) +add_library(fcl INTERFACE IMPORTED) +set_target_properties(ccd PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FCL_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FCL_LIBRARIES}" +) +endif() diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 4ae2205a52bb2..c157c7346bcaf 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -121,7 +121,6 @@ dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) target_include_directories( dart SYSTEM PUBLIC - ${FCL_INCLUDE_DIRS} ${ASSIMP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} @@ -132,7 +131,7 @@ target_link_libraries( ${CMAKE_DL_LIBS} Eigen3::Eigen ccd - ${FCL_LIBRARIES} + fcl ${ASSIMP_LIBRARIES} ${Boost_LIBRARIES} ${PROJECT_NAME}-external-odelcpsolver From c669b1e450a45be641b10a9922b00d139d01ffdf Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 19:35:49 -0800 Subject: [PATCH 16/50] Use assimp target instead of variables --- cmake/DARTFindDependencies.cmake | 4 +-- cmake/DARTFindassimp.cmake | 19 ++++++++++++++ cmake/FindASSIMP.cmake | 45 -------------------------------- dart/CMakeLists.txt | 5 ++-- 4 files changed, 23 insertions(+), 50 deletions(-) create mode 100644 cmake/DARTFindassimp.cmake delete mode 100644 cmake/FindASSIMP.cmake diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index 13b5684ce952c..cd7d60044cb6c 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -22,8 +22,8 @@ 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) diff --git a/cmake/DARTFindassimp.cmake b/cmake/DARTFindassimp.cmake new file mode 100644 index 0000000000000..6b25c5d8f47f7 --- /dev/null +++ b/cmake/DARTFindassimp.cmake @@ -0,0 +1,19 @@ +# 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 3.2 REQUIRED) + +# Set target assimp if not set +# The target is not imported by upstream until 4.1 +if(ASSIMP_FOUND AND NOT TARGET assimp) + add_library(assimp INTERFACE IMPORTED) + set_target_properties(assimp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES}" + ) +endif() diff --git a/cmake/FindASSIMP.cmake b/cmake/FindASSIMP.cmake deleted file mode 100644 index f1249837904fd..0000000000000 --- a/cmake/FindASSIMP.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) 2011-2018, 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 ASSIMP -# -# This sets the following variables: -# ASSIMP_FOUND -# ASSIMP_INCLUDE_DIRS -# ASSIMP_LIBRARIES -# ASSIMP_VERSION - -find_package(PkgConfig QUIET) - -# Check to see if pkgconfig is installed. -pkg_check_modules(PC_ASSIMP assimp QUIET) - -# Include directories -find_path(ASSIMP_INCLUDE_DIRS assimp/scene.h - HINTS ${PC_ASSIMP_INCLUDEDIR} - PATHS "${CMAKE_INSTALL_PREFIX}/include") - -# Libraries -if(MSVC) - set(ASSIMP_LIBRARIES optimized assimp debug assimpd) -else() - find_library(ASSIMP_LIBRARIES - NAMES assimp - HINTS ${PC_ASSIMP_LIBDIR}) -endif() - -# Version -set(ASSIMP_VERSION ${PC_ASSIMP_VERSION}) - -# Set (NAME)_FOUND if all the variables and the version are satisfied. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ASSIMP - FAIL_MESSAGE DEFAULT_MSG - REQUIRED_VARS ASSIMP_INCLUDE_DIRS ASSIMP_LIBRARIES - VERSION_VAR ASSIMP_VERSION) - diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index c157c7346bcaf..9fc8767a40bed 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -121,7 +121,6 @@ dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) target_include_directories( dart SYSTEM PUBLIC - ${ASSIMP_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} ) @@ -132,7 +131,7 @@ target_link_libraries( Eigen3::Eigen ccd fcl - ${ASSIMP_LIBRARIES} + assimp ${Boost_LIBRARIES} ${PROJECT_NAME}-external-odelcpsolver ${OCTOMAP_LIBRARIES} @@ -161,7 +160,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 + Eigen3 ccd fcl assimp ) if(MSVC) From 22d23189073c0a44be200bd5407f7434050322c8 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 19:47:16 -0800 Subject: [PATCH 17/50] Manual version check for Assimp --- cmake/DARTFindassimp.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/DARTFindassimp.cmake b/cmake/DARTFindassimp.cmake index 6b25c5d8f47f7..de75e31ae7c8a 100644 --- a/cmake/DARTFindassimp.cmake +++ b/cmake/DARTFindassimp.cmake @@ -6,7 +6,16 @@ # # This file is provided under the "BSD-style" License -find_package(assimp 3.2 REQUIRED) +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() # Set target assimp if not set # The target is not imported by upstream until 4.1 From 89397ec3b8b37483b72c46f858f950e09d394e2c Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 19:55:32 -0800 Subject: [PATCH 18/50] Use Boost targets instead of variables --- cmake/DARTFindBoost.cmake | 25 +++++++++++++++++++++++++ cmake/DARTFindDependencies.cmake | 18 +----------------- dart/CMakeLists.txt | 12 +++++++----- 3 files changed, 33 insertions(+), 22 deletions(-) create mode 100644 cmake/DARTFindBoost.cmake diff --git a/cmake/DARTFindBoost.cmake b/cmake/DARTFindBoost.cmake new file mode 100644 index 0000000000000..aca8f63bd5917 --- /dev/null +++ b/cmake/DARTFindBoost.cmake @@ -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() diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index cd7d60044cb6c..acadc710d671e 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -86,23 +86,7 @@ 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) if (octomap_FOUND AND NOT MSVC) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 9fc8767a40bed..8660567f8fc7c 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -121,21 +121,23 @@ dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) target_include_directories( dart SYSTEM PUBLIC - ${Boost_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} ) -target_link_libraries( - dart +target_link_libraries(dart PUBLIC ${CMAKE_DL_LIBS} Eigen3::Eigen ccd fcl assimp - ${Boost_LIBRARIES} + Boost::system + Boost::filesystem ${PROJECT_NAME}-external-odelcpsolver ${OCTOMAP_LIBRARIES} ) +if(NOT MSVC) + target_link_libraries(dart PUBLIC Boost::regex) +endif() # Build DART with all available SIMD instructions if(DART_ENABLE_SIMD) @@ -160,7 +162,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 + Eigen3 ccd fcl assimp Boost ) if(MSVC) From 9e9779fcf854524e348b17d50266a1e7931478d8 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 20:07:44 -0800 Subject: [PATCH 19/50] Read Assimp version from the PC file --- cmake/DARTFindassimp.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/DARTFindassimp.cmake b/cmake/DARTFindassimp.cmake index de75e31ae7c8a..7a2f628883cac 100644 --- a/cmake/DARTFindassimp.cmake +++ b/cmake/DARTFindassimp.cmake @@ -8,13 +8,18 @@ find_package(assimp REQUIRED) +# Read version from PC file +find_package(PkgConfig QUIET) +pkg_check_modules(PC_ASSIMP assimp QUIET) +set(ASSIMP_VERSION ${PC_ASSIMP_VERSION}) + # 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" - ) + message(STATUS "Found Assimp ${ASSIMP_VERSION}, but Assimp >= 3.2 is + required" + ) endif() # Set target assimp if not set @@ -22,7 +27,7 @@ endif() if(ASSIMP_FOUND AND NOT TARGET assimp) add_library(assimp INTERFACE IMPORTED) set_target_properties(assimp PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES}" ) endif() From a5ce5d355c8be6869b72528f2789484cdce198a1 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 20:32:49 -0800 Subject: [PATCH 20/50] Use octomap target instead of variables --- cmake/DARTFindDependencies.cmake | 3 ++- cmake/DARTFindoctomap.cmake | 17 +++++++++++++++++ dart/CMakeLists.txt | 11 +++++------ 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 cmake/DARTFindoctomap.cmake diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index acadc710d671e..725877ef721a8 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -88,7 +88,8 @@ endif() # Boost 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: diff --git a/cmake/DARTFindoctomap.cmake b/cmake/DARTFindoctomap.cmake new file mode 100644 index 0000000000000..dbd4292b6fa56 --- /dev/null +++ b/cmake/DARTFindoctomap.cmake @@ -0,0 +1,17 @@ +# 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(octomap 1.6.8 QUIET) + +if(OCTOMAP_FOUND AND NOT TARGET octomap) +add_library(octomap INTERFACE IMPORTED) +set_target_properties(octomap PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OCTOMAP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${OCTOMAP_LIBRARIES}" +) +endif() diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 8660567f8fc7c..5b849a5c944f1 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -118,11 +118,10 @@ get_property(dart_core_sources GLOBAL PROPERTY DART_CORE_SOURCES) # Add target dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) -target_include_directories( - dart SYSTEM - PUBLIC - ${OCTOMAP_INCLUDE_DIRS} -) +#target_include_directories( +# dart SYSTEM +# PUBLIC +#) target_link_libraries(dart PUBLIC ${CMAKE_DL_LIBS} @@ -133,7 +132,7 @@ target_link_libraries(dart Boost::system Boost::filesystem ${PROJECT_NAME}-external-odelcpsolver - ${OCTOMAP_LIBRARIES} + octomap ) if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) From 691a7bdc78eb3e50b7cd88d84880d023c6e46d4a Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 20:57:03 -0800 Subject: [PATCH 21/50] Use octomap target instead of variables --- cmake/DARTFindEigen3.cmake | 2 +- cmake/DARTFindassimp.cmake | 5 +---- cmake/DARTFindoctomap.cmake | 18 ++++++++++++------ dart/CMakeLists.txt | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cmake/DARTFindEigen3.cmake b/cmake/DARTFindEigen3.cmake index 9eda92bff3633..bddca0621b00a 100644 --- a/cmake/DARTFindEigen3.cmake +++ b/cmake/DARTFindEigen3.cmake @@ -18,7 +18,7 @@ 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) +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}" diff --git a/cmake/DARTFindassimp.cmake b/cmake/DARTFindassimp.cmake index 7a2f628883cac..20a8287152839 100644 --- a/cmake/DARTFindassimp.cmake +++ b/cmake/DARTFindassimp.cmake @@ -8,10 +8,7 @@ find_package(assimp REQUIRED) -# Read version from PC file -find_package(PkgConfig QUIET) -pkg_check_modules(PC_ASSIMP assimp QUIET) -set(ASSIMP_VERSION ${PC_ASSIMP_VERSION}) +set(ASSIMP_VERSION ${assimp_VERSION}) # Manually check version because the upstream version compatibility policy # doesn't allow different major number while DART is compatible any version diff --git a/cmake/DARTFindoctomap.cmake b/cmake/DARTFindoctomap.cmake index dbd4292b6fa56..00b81676ca890 100644 --- a/cmake/DARTFindoctomap.cmake +++ b/cmake/DARTFindoctomap.cmake @@ -8,10 +8,16 @@ find_package(octomap 1.6.8 QUIET) -if(OCTOMAP_FOUND AND NOT TARGET octomap) -add_library(octomap INTERFACE IMPORTED) -set_target_properties(octomap PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OCTOMAP_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${OCTOMAP_LIBRARIES}" -) +if(octomap_FOUND AND NOT TARGET octomap) + add_library(octomap INTERFACE IMPORTED) + set_target_properties(octomap PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OCTOMAP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${OCTOMAP_LIBRARIES}" + ) endif() + +get_target_property(octomap_INTERFACE_INCLUDE_DIRECTORIES octomap INTERFACE_INCLUDE_DIRECTORIES) +get_target_property(octomap_INTERFACE_LINK_LIBRARIES octomap INTERFACE_LINK_LIBRARIES) + +message(STATUS "octomap_INTERFACE_INCLUDE_DIRECTORIES: ${octomap_INTERFACE_INCLUDE_DIRECTORIES}") +message(STATUS "octomap_INTERFACE_LINK_LIBRARIES: ${octomap_INTERFACE_LINK_LIBRARIES}") diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 5b849a5c944f1..ee84928dbf2e6 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -161,7 +161,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 + Eigen3 ccd fcl assimp Boost octomap ) if(MSVC) From e2ab1d5ca4735a09ae15304ca4dc6db30aa7300f Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 21:08:50 -0800 Subject: [PATCH 22/50] Remove use of include_directories() in favor of target_include_directories() --- CMakeLists.txt | 4 ++-- cmake/DARTFindoctomap.cmake | 6 ------ dart/CMakeLists.txt | 12 +++++++----- dart/external/odelcpsolver/CMakeLists.txt | 7 ++++--- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d32468e19df75..94405fb0e7760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,8 +146,8 @@ include(DARTFindDependencies) #=============================================================================== # Include directories #=============================================================================== -include_directories(BEFORE ${PROJECT_SOURCE_DIR}) -include_directories("${CMAKE_BINARY_DIR}") +#include_directories(BEFORE ${PROJECT_SOURCE_DIR}) +#include_directories("${CMAKE_BINARY_DIR}") #=============================================================================== # Check for non-case-sensitive filesystems diff --git a/cmake/DARTFindoctomap.cmake b/cmake/DARTFindoctomap.cmake index 00b81676ca890..b22743bd9e20d 100644 --- a/cmake/DARTFindoctomap.cmake +++ b/cmake/DARTFindoctomap.cmake @@ -15,9 +15,3 @@ if(octomap_FOUND AND NOT TARGET octomap) INTERFACE_LINK_LIBRARIES "${OCTOMAP_LIBRARIES}" ) endif() - -get_target_property(octomap_INTERFACE_INCLUDE_DIRECTORIES octomap INTERFACE_INCLUDE_DIRECTORIES) -get_target_property(octomap_INTERFACE_LINK_LIBRARIES octomap INTERFACE_LINK_LIBRARIES) - -message(STATUS "octomap_INTERFACE_INCLUDE_DIRECTORIES: ${octomap_INTERFACE_INCLUDE_DIRECTORIES}") -message(STATUS "octomap_INTERFACE_LINK_LIBRARIES: ${octomap_INTERFACE_LINK_LIBRARIES}") diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index ee84928dbf2e6..d8404799077a2 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -118,20 +118,22 @@ get_property(dart_core_sources GLOBAL PROPERTY DART_CORE_SOURCES) # Add target dart_add_library(dart ${dart_core_headers} ${dart_core_sources}) -#target_include_directories( -# dart SYSTEM -# PUBLIC -#) +target_include_directories(dart BEFORE + PUBLIC + $ + $ + $ +) target_link_libraries(dart PUBLIC ${CMAKE_DL_LIBS} + ${PROJECT_NAME}-external-odelcpsolver Eigen3::Eigen ccd fcl assimp Boost::system Boost::filesystem - ${PROJECT_NAME}-external-odelcpsolver octomap ) if(NOT MSVC) diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 158dd0bfbcd86..9697799ea87f6 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -7,9 +7,10 @@ set(target_name ${PROJECT_NAME}-external-odelcpsolver) set(component_name external-odelcpsolver) dart_add_library(${target_name} ${hdrs} ${srcs}) -include_directories( - ${target_name} - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" +target_include_directories(${target_name} + PUBLIC + $ + $ ) # Component From 541a810228fd38770f4ec35d99742b934373ad0b Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 21:22:20 -0800 Subject: [PATCH 23/50] Use flann target instead of variables --- CMakeLists.txt | 6 ------ cmake/DARTFindflann.cmake | 9 +++++++++ cmake/Findccd.cmake | 11 +++++++---- cmake/Findfcl.cmake | 21 ++++++++++++--------- cmake/{FindFLANN.cmake => Findflann.cmake} | 19 +++++++++++++++---- dart/planning/CMakeLists.txt | 15 ++++----------- 6 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 cmake/DARTFindflann.cmake rename cmake/{FindFLANN.cmake => Findflann.cmake} (72%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94405fb0e7760..d206f346d1064 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,12 +143,6 @@ endif() #=============================================================================== include(DARTFindDependencies) -#=============================================================================== -# Include directories -#=============================================================================== -#include_directories(BEFORE ${PROJECT_SOURCE_DIR}) -#include_directories("${CMAKE_BINARY_DIR}") - #=============================================================================== # Check for non-case-sensitive filesystems #=============================================================================== diff --git a/cmake/DARTFindflann.cmake b/cmake/DARTFindflann.cmake new file mode 100644 index 0000000000000..b5079b170a7bf --- /dev/null +++ b/cmake/DARTFindflann.cmake @@ -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(flann 1.8.4 QUIET) diff --git a/cmake/Findccd.cmake b/cmake/Findccd.cmake index 79856f7506d4e..66f50061d6ca2 100644 --- a/cmake/Findccd.cmake +++ b/cmake/Findccd.cmake @@ -9,10 +9,13 @@ # Find CCD # # This sets the following variables: -# CCD_FOUND -# CCD_INCLUDE_DIRS -# CCD_LIBRARIES -# CCD_VERSION +# CCD_FOUND +# CCD_INCLUDE_DIRS +# CCD_LIBRARIES +# CCD_VERSION +# +# and the following targets: +# ccd find_package(ccd QUIET CONFIG) # Upstream provide ccd-config.cmake since 2.1. diff --git a/cmake/Findfcl.cmake b/cmake/Findfcl.cmake index 491f070588763..f0ca771d5f6af 100644 --- a/cmake/Findfcl.cmake +++ b/cmake/Findfcl.cmake @@ -9,10 +9,13 @@ # Find FCL # # This sets the following variables: -# FCL_FOUND -# FCL_INCLUDE_DIRS -# FCL_LIBRARIES -# FCL_VERSION +# FCL_FOUND +# FCL_INCLUDE_DIRS +# FCL_LIBRARIES +# FCL_VERSION +# +# and the following targets: +# fcl find_package(PkgConfig QUIET) @@ -63,9 +66,9 @@ find_package_handle_standard_args(FCL # Upstream provides the target since 0.5.0 but some package managers don't # install the config file, which defines the target. if(FCL_FOUND AND NOT TARGET fcl) -add_library(fcl INTERFACE IMPORTED) -set_target_properties(ccd PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${FCL_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${FCL_LIBRARIES}" -) + add_library(fcl INTERFACE IMPORTED) + set_target_properties(ccd PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FCL_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FCL_LIBRARIES}" + ) endif() diff --git a/cmake/FindFLANN.cmake b/cmake/Findflann.cmake similarity index 72% rename from cmake/FindFLANN.cmake rename to cmake/Findflann.cmake index d1410096f0fc9..c3978b9f09cdf 100644 --- a/cmake/FindFLANN.cmake +++ b/cmake/Findflann.cmake @@ -9,10 +9,13 @@ # Find FLANN # # This sets the following variables: -# FLANN_FOUND -# FLANN_INCLUDE_DIRS -# FLANN_LIBRARIES -# FLANN_VERSION +# FLANN_FOUND +# FLANN_INCLUDE_DIRS +# FLANN_LIBRARIES +# FLANN_VERSION +# +# and the following targets: +# flann find_package(PkgConfig QUIET) @@ -38,3 +41,11 @@ find_package_handle_standard_args(FLANN FAIL_MESSAGE DEFAULT_MSG REQUIRED_VARS FLANN_INCLUDE_DIRS FLANN_LIBRARIES VERSION_VAR FLANN_VERSION) + +if(FLANN_FOUND AND NOT TARGET flann) + add_library(flann INTERFACE IMPORTED) + set_target_properties(flann PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FLANN_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FLANN_LIBRARIES}" + ) +endif() diff --git a/dart/planning/CMakeLists.txt b/dart/planning/CMakeLists.txt index 33c932afb9413..ad673d999810a 100644 --- a/dart/planning/CMakeLists.txt +++ b/dart/planning/CMakeLists.txt @@ -1,6 +1,6 @@ # Dependency checks -find_package(FLANN 1.8.4 QUIET) -dart_check_optional_package(FLANN "dart-planning" "flann" "1.8.4") +dart_find_package(flann) +dart_check_optional_package(flann "dart-planning" "flann" "1.8.4") # Search all header and source files file(GLOB hdrs "*.hpp") @@ -12,20 +12,13 @@ set(component_name planning) # Add target dart_add_library(${target_name} ${hdrs} ${srcs}) -target_include_directories( - ${target_name} SYSTEM - PUBLIC ${FLANN_INCLUDE_DIRS} -) -target_link_libraries( - ${target_name} - dart - ${FLANN_LIBRARIES} -) +target_link_libraries(${target_name} PUBLIC dart flann) # Component add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} flann) ## Generate header for this namespace dart_get_filename_components(header_names "planning headers" ${hdrs}) From ba6b5d91f4e5ff4f20a4878e74e5ebae285e670a Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 21:30:50 -0800 Subject: [PATCH 24/50] Use Bullet target instead of variables --- cmake/DARTFindBullet.cmake | 20 ++++++++++++++++++++ dart/collision/bullet/CMakeLists.txt | 13 +++---------- dart/planning/CMakeLists.txt | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 cmake/DARTFindBullet.cmake diff --git a/cmake/DARTFindBullet.cmake b/cmake/DARTFindBullet.cmake new file mode 100644 index 0000000000000..9cbed1c382a53 --- /dev/null +++ b/cmake/DARTFindBullet.cmake @@ -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() diff --git a/dart/collision/bullet/CMakeLists.txt b/dart/collision/bullet/CMakeLists.txt index 09287c8365c04..fc58c7f561c47 100644 --- a/dart/collision/bullet/CMakeLists.txt +++ b/dart/collision/bullet/CMakeLists.txt @@ -3,7 +3,7 @@ # 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) +dart_find_package(Bullet) if(BULLET_FOUND) # Test whether Bullet was built with double precision. If so, we need to # define the BT_USE_DOUBLE_PRECISION pre-processor directive before including @@ -54,20 +54,13 @@ set(component_name collision-bullet) # Add target dart_add_library(${target_name} ${hdrs} ${srcs} ${detail_hdrs} ${detail_srcs}) -target_include_directories( - ${target_name} SYSTEM - PUBLIC ${BULLET_INCLUDE_DIRS} -) -target_link_libraries( - ${target_name} - dart - ${BULLET_LIBRARIES} -) +target_link_libraries(${target_name} PUBLIC dart Bullet) # Component add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} Bullet) # Generate header for this namespace dart_get_filename_components(header_names "collision_bullet headers" ${hdrs}) diff --git a/dart/planning/CMakeLists.txt b/dart/planning/CMakeLists.txt index ad673d999810a..42cdc04d8eda2 100644 --- a/dart/planning/CMakeLists.txt +++ b/dart/planning/CMakeLists.txt @@ -1,6 +1,6 @@ # Dependency checks dart_find_package(flann) -dart_check_optional_package(flann "dart-planning" "flann" "1.8.4") +dart_check_optional_package(FLANN "dart-planning" "flann" "1.8.4") # Search all header and source files file(GLOB hdrs "*.hpp") From 79ed35f3996f4e8e11775b5e27c07af045d9b7f9 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Mon, 7 Jan 2019 21:46:18 -0800 Subject: [PATCH 25/50] Use tinyxml2 target instead of variables --- cmake/DARTFindtinyxml2.cmake | 9 +++++++++ .../{FindTINYXML2.cmake => Findtinyxml2.cmake} | 18 ++++++++++++++---- dart/utils/CMakeLists.txt | 14 +++----------- 3 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 cmake/DARTFindtinyxml2.cmake rename cmake/{FindTINYXML2.cmake => Findtinyxml2.cmake} (71%) diff --git a/cmake/DARTFindtinyxml2.cmake b/cmake/DARTFindtinyxml2.cmake new file mode 100644 index 0000000000000..4895104ff46e0 --- /dev/null +++ b/cmake/DARTFindtinyxml2.cmake @@ -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(tinyxml2 QUIET) diff --git a/cmake/FindTINYXML2.cmake b/cmake/Findtinyxml2.cmake similarity index 71% rename from cmake/FindTINYXML2.cmake rename to cmake/Findtinyxml2.cmake index 579b2d2ed448f..73674d4c0094e 100644 --- a/cmake/FindTINYXML2.cmake +++ b/cmake/Findtinyxml2.cmake @@ -9,10 +9,13 @@ # Find TINYXML2 # # This sets the following variables: -# TINYXML2_FOUND -# TINYXML2_INCLUDE_DIRS -# TINYXML2_LIBRARIES -# TINYXML2_VERSION +# TINYXML2_FOUND +# TINYXML2_INCLUDE_DIRS +# TINYXML2_LIBRARIES +# TINYXML2_VERSION +# +# and the following targets: +# tinyxml2::tinyxml2 find_package(PkgConfig QUIET) @@ -44,3 +47,10 @@ find_package_handle_standard_args(TINYXML2 REQUIRED_VARS TINYXML2_INCLUDE_DIRS TINYXML2_LIBRARIES VERSION_VAR TINYXML2_VERSION) +if(TINYXML2_FOUND AND NOT TARGET tinyxml2::tinyxml2) + add_library(tinyxml2::tinyxml2 INTERFACE IMPORTED) + set_target_properties(tinyxml2::tinyxml2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TINYXML2_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${TINYXML2_LIBRARIES}" + ) +endif() diff --git a/dart/utils/CMakeLists.txt b/dart/utils/CMakeLists.txt index 6393c6db6da12..27e92c442c8c3 100644 --- a/dart/utils/CMakeLists.txt +++ b/dart/utils/CMakeLists.txt @@ -1,5 +1,5 @@ # Dependency checks -find_package(TINYXML2 QUIET) +dart_find_package(tinyxml2) dart_check_optional_package(TINYXML2 "dart-utils" "tinyxml2" "1.0.1") # Search all header and source files @@ -26,21 +26,13 @@ set(component_name utils) # Add target dart_add_library(${target_name} ${hdrs} ${srcs} ${dart_utils_headers} ${dart_utils_sources}) -target_include_directories( - ${target_name} SYSTEM - PUBLIC - ${TINYXML2_INCLUDE_DIRS} -) -target_link_libraries( - ${target_name} - dart - ${TINYXML2_LIBRARIES} -) +target_link_libraries(${target_name} PUBLIC dart tinyxml2::tinyxml2) # Component add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} tinyxml2) # Generate header for this namespace dart_get_filename_components(header_names "utils headers" ${hdrs}) From 9bc9a37ef28deeea392baa1be4ea4417c6ee0be1 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 00:28:23 -0800 Subject: [PATCH 26/50] Use ODE target instead of variables --- cmake/DARTFindODE.cmake | 9 +++++++++ cmake/FindODE.cmake | 18 ++++++++++++++---- dart/collision/ode/CMakeLists.txt | 13 +++---------- 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 cmake/DARTFindODE.cmake diff --git a/cmake/DARTFindODE.cmake b/cmake/DARTFindODE.cmake new file mode 100644 index 0000000000000..c0726c953d938 --- /dev/null +++ b/cmake/DARTFindODE.cmake @@ -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) diff --git a/cmake/FindODE.cmake b/cmake/FindODE.cmake index 21542abd1f03d..3e9f20c9d09b9 100644 --- a/cmake/FindODE.cmake +++ b/cmake/FindODE.cmake @@ -9,10 +9,13 @@ # Find ODE # # This sets the following variables: -# ODE_FOUND -# ODE_INCLUDE_DIRS -# ODE_LIBRARIES -# ODE_VERSION +# ODE_FOUND +# ODE_INCLUDE_DIRS +# ODE_LIBRARIES +# ODE_VERSION +# +# and the following targets: +# ODE::ODE find_package(PkgConfig QUIET) @@ -44,3 +47,10 @@ find_package_handle_standard_args(ODE REQUIRED_VARS ODE_INCLUDE_DIRS ODE_LIBRARIES VERSION_VAR ODE_VERSION) +if(ODE_FOUND AND NOT TARGET ODE::ODE) + add_library(ODE::ODE INTERFACE IMPORTED) + set_target_properties(ODE::ODE PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ODE_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${ODE_LIBRARIES}" + ) +endif() diff --git a/dart/collision/ode/CMakeLists.txt b/dart/collision/ode/CMakeLists.txt index d1f2b5ceb291b..24b59ed8bcc1b 100644 --- a/dart/collision/ode/CMakeLists.txt +++ b/dart/collision/ode/CMakeLists.txt @@ -1,5 +1,5 @@ # Dependency checks -find_package(ODE 0.13 QUIET) +dart_find_package(ODE) dart_check_optional_package(ODE "dart-collision-ode" "ode" "0.13") # Search all header and source files @@ -14,20 +14,13 @@ set(component_name collision-ode) # Add target dart_add_library(${target_name} ${hdrs} ${srcs} ${detail_hdrs} ${detail_srcs}) -target_include_directories( - ${target_name} SYSTEM - PUBLIC ${ODE_INCLUDE_DIRS} -) -target_link_libraries( - ${target_name} - dart - ${ODE_LIBRARIES} -) +target_link_libraries(${target_name} PUBLIC dart ODE::ODE) # Component add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} ODE) # Generate header for this namespace dart_get_filename_components(header_names "collision_ode headers" ${hdrs}) From cb085ed98e0c6a97720611e8b34015c4361c22ab Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 00:32:57 -0800 Subject: [PATCH 27/50] Use OpenGL/GLUT targets instead of variables --- dart/gui/CMakeLists.txt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/dart/gui/CMakeLists.txt b/dart/gui/CMakeLists.txt index 04ead726db648..a7f1e4349e186 100644 --- a/dart/gui/CMakeLists.txt +++ b/dart/gui/CMakeLists.txt @@ -46,18 +46,11 @@ set(component_name gui) dart_add_library(${target_name} ${hdrs} ${srcs} ${dart_gui_headers} ${dart_gui_sources} ) -target_include_directories( - ${target_name} SYSTEM - PUBLIC - ${OPENGL_INCLUDE_DIR} - ${GLUT_INCLUDE_DIR} -) -target_link_libraries( - ${target_name} +target_link_libraries(${target_name} PUBLIC dart-utils - ${GLUT_LIBRARIES} - ${OPENGL_LIBRARIES} + GLUT::GLUT + OpenGL::GL ${PROJECT_NAME}-external-lodepng ${PROJECT_NAME}-external-imgui ) From 3ec1c8a65020a9104bfcf59b61bc2d67f03e8748 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 00:50:31 -0800 Subject: [PATCH 28/50] Add missing target, OpenGL::GLU --- dart/gui/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dart/gui/CMakeLists.txt b/dart/gui/CMakeLists.txt index a7f1e4349e186..98f68765f809a 100644 --- a/dart/gui/CMakeLists.txt +++ b/dart/gui/CMakeLists.txt @@ -50,6 +50,7 @@ target_link_libraries(${target_name} PUBLIC dart-utils GLUT::GLUT + OpenGL::GLU OpenGL::GL ${PROJECT_NAME}-external-lodepng ${PROJECT_NAME}-external-imgui From 062f2604a8664dfc14529750346f092cd0470ff3 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 01:50:53 -0800 Subject: [PATCH 29/50] Use targets of optimizers instead of variables --- cmake/DARTFindGLUT.cmake | 9 +++++++++ cmake/DARTFindIPOPT.cmake | 9 +++++++++ cmake/DARTFindNLOPT.cmake | 9 +++++++++ cmake/DARTFindOpenGL.cmake | 9 +++++++++ cmake/DARTFindpagmo.cmake | 11 +++++++++++ cmake/FindIPOPT.cmake | 20 +++++++++++++++----- cmake/FindNLOPT.cmake | 20 +++++++++++++++----- cmake/FindPAGMO.cmake | 26 -------------------------- dart/gui/CMakeLists.txt | 8 ++++++-- dart/optimizer/ipopt/CMakeLists.txt | 6 +++--- dart/optimizer/nlopt/CMakeLists.txt | 6 +++--- dart/optimizer/pagmo/CMakeLists.txt | 10 ++++------ 12 files changed, 93 insertions(+), 50 deletions(-) create mode 100644 cmake/DARTFindGLUT.cmake create mode 100644 cmake/DARTFindIPOPT.cmake create mode 100644 cmake/DARTFindNLOPT.cmake create mode 100644 cmake/DARTFindOpenGL.cmake create mode 100644 cmake/DARTFindpagmo.cmake delete mode 100644 cmake/FindPAGMO.cmake diff --git a/cmake/DARTFindGLUT.cmake b/cmake/DARTFindGLUT.cmake new file mode 100644 index 0000000000000..ee4a77590c9f1 --- /dev/null +++ b/cmake/DARTFindGLUT.cmake @@ -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) diff --git a/cmake/DARTFindIPOPT.cmake b/cmake/DARTFindIPOPT.cmake new file mode 100644 index 0000000000000..e49f50ff8c93b --- /dev/null +++ b/cmake/DARTFindIPOPT.cmake @@ -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) diff --git a/cmake/DARTFindNLOPT.cmake b/cmake/DARTFindNLOPT.cmake new file mode 100644 index 0000000000000..6009490cf26e0 --- /dev/null +++ b/cmake/DARTFindNLOPT.cmake @@ -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) diff --git a/cmake/DARTFindOpenGL.cmake b/cmake/DARTFindOpenGL.cmake new file mode 100644 index 0000000000000..d17a1a9374276 --- /dev/null +++ b/cmake/DARTFindOpenGL.cmake @@ -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(OpenGL QUIET) diff --git a/cmake/DARTFindpagmo.cmake b/cmake/DARTFindpagmo.cmake new file mode 100644 index 0000000000000..a24d3ae7b7a99 --- /dev/null +++ b/cmake/DARTFindpagmo.cmake @@ -0,0 +1,11 @@ +# 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(pagmo) + +message(STATUS "pagmo_VERSION: ${pagmo_VERSION}") diff --git a/cmake/FindIPOPT.cmake b/cmake/FindIPOPT.cmake index 3f38bbe0bc16e..5f81cd33b3ca0 100644 --- a/cmake/FindIPOPT.cmake +++ b/cmake/FindIPOPT.cmake @@ -9,11 +9,14 @@ # Find IPOPT # # This sets the following variables: -# IPOPT_FOUND -# IPOPT_INCLUDE_DIRS -# IPOPT_LIBRARIES -# IPOPT_DEFINITIONS -# IPOPT_VERSION +# IPOPT_FOUND +# IPOPT_INCLUDE_DIRS +# IPOPT_LIBRARIES +# IPOPT_DEFINITIONS +# IPOPT_VERSION +# +# and the following targets: +# IPOPT::ipopt find_package(PkgConfig QUIET) @@ -44,3 +47,10 @@ find_package_handle_standard_args(IPOPT REQUIRED_VARS IPOPT_INCLUDE_DIRS IPOPT_LIBRARIES VERSION_VAR IPOPT_VERSION) +if(IPOPT_FOUND AND NOT TARGET IPOPT::ipopt) + add_library(IPOPT::ipopt INTERFACE IMPORTED) + set_target_properties(IPOPT::ipopt PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${IPOPT_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${IPOPT_LIBRARIES}" + ) +endif() diff --git a/cmake/FindNLOPT.cmake b/cmake/FindNLOPT.cmake index cb79dc85c02ea..95ba6cb46fd52 100644 --- a/cmake/FindNLOPT.cmake +++ b/cmake/FindNLOPT.cmake @@ -9,11 +9,14 @@ # Find NLOPT # # This sets the following variables: -# NLOPT_FOUND -# NLOPT_INCLUDE_DIRS -# NLOPT_LIBRARIES -# NLOPT_DEFINITIONS -# NLOPT_VERSION +# NLOPT_FOUND +# NLOPT_INCLUDE_DIRS +# NLOPT_LIBRARIES +# NLOPT_DEFINITIONS +# NLOPT_VERSION +# +# and the following targets: +# NLOPT::nlopt find_package(PkgConfig QUIET) @@ -44,3 +47,10 @@ find_package_handle_standard_args(NLOPT REQUIRED_VARS NLOPT_INCLUDE_DIRS NLOPT_LIBRARIES VERSION_VAR NLOPT_VERSION) +if(NLOPT_FOUND AND NOT TARGET NLOPT::nlopt) + add_library(NLOPT::nlopt INTERFACE IMPORTED) + set_target_properties(NLOPT::nlopt PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${NLOPT_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${NLOPT_LIBRARIES}" + ) +endif() diff --git a/cmake/FindPAGMO.cmake b/cmake/FindPAGMO.cmake deleted file mode 100644 index f2d0b0b36e8b7..0000000000000 --- a/cmake/FindPAGMO.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2011-2018, 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 PAGMO -# -# This sets the following variables: -# PAGMO_FOUND -# PAGMO_INCLUDE_DIRS - -# Include directories -find_path(PAGMO_INCLUDE_DIRS - NAMES pagmo/pagmo.hpp - PATHS "${CMAKE_INSTALL_PREFIX}/include" -) - -# Set (NAME)_FOUND if all the variables and the version are satisfied. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PAGMO - FAIL_MESSAGE DEFAULT_MSG - REQUIRED_VARS PAGMO_INCLUDE_DIRS -) diff --git a/dart/gui/CMakeLists.txt b/dart/gui/CMakeLists.txt index 98f68765f809a..6dbe0dffb4e9e 100644 --- a/dart/gui/CMakeLists.txt +++ b/dart/gui/CMakeLists.txt @@ -3,7 +3,7 @@ if (NOT TARGET dart-utils) return() endif() -find_package(OpenGL QUIET) +dart_find_package(OpenGL) dart_check_optional_package(OPENGL "dart-gui" "OpenGL") if(WIN32 AND NOT CYGWIN) @@ -11,7 +11,7 @@ if(WIN32 AND NOT CYGWIN) set(GLUT_LIBRARIES glut32) set(HAVE_GLUT TRUE) else() - find_package(GLUT QUIET) + dart_find_package(GLUT) dart_check_optional_package(GLUT "dart-gui" "freeglut3") if(GLUT_FOUND) set(HAVE_GLUT TRUE) @@ -66,6 +66,10 @@ add_component_dependencies( external-lodepng external-imgui ) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} OpenGL) +if(NOT WIN32 OR CYGWIN) + add_component_dependency_packages(${PROJECT_NAME} ${component_name} GLUT) +endif() # Add subdirectories add_subdirectory(osg) diff --git a/dart/optimizer/ipopt/CMakeLists.txt b/dart/optimizer/ipopt/CMakeLists.txt index 393612a0ebee8..9892b23da7259 100644 --- a/dart/optimizer/ipopt/CMakeLists.txt +++ b/dart/optimizer/ipopt/CMakeLists.txt @@ -1,5 +1,5 @@ # Dependency checks -find_package(IPOPT 3.11.9 QUIET) +dart_find_package(IPOPT) dart_check_optional_package(IPOPT "dart-optimizer-ipopt" "ipopt" "3.11.9") # Search all header and source files @@ -12,13 +12,13 @@ set(component_name optimizer-ipopt) # Add target dart_add_library(${target_name} ${hdrs} ${srcs}) -target_include_directories(${target_name} SYSTEM PUBLIC ${IPOPT_INCLUDE_DIRS}) -target_link_libraries(${target_name} PUBLIC dart ${IPOPT_LIBRARIES}) +target_link_libraries(${target_name} PUBLIC dart IPOPT::ipopt) # Component add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} IPOPT) # Generate header for this namespace dart_get_filename_components(header_names "optimizer_ipopt headers" ${hdrs}) diff --git a/dart/optimizer/nlopt/CMakeLists.txt b/dart/optimizer/nlopt/CMakeLists.txt index 022a529c90871..c588c90a4b5ca 100644 --- a/dart/optimizer/nlopt/CMakeLists.txt +++ b/dart/optimizer/nlopt/CMakeLists.txt @@ -1,5 +1,5 @@ # Dependency checks -find_package(NLOPT 2.4.1 QUIET) +dart_find_package(NLOPT) dart_check_optional_package(NLOPT "dart-optimizer-nlopt" "nlopt" "2.4.1") # Search all header and source files @@ -12,13 +12,13 @@ set(component_name optimizer-nlopt) # Add target dart_add_library(${target_name} ${hdrs} ${srcs}) -target_include_directories(${target_name} SYSTEM PUBLIC ${NLOPT_INCLUDE_DIRS}) -target_link_libraries(${target_name} PUBLIC dart ${NLOPT_LIBRARIES}) +target_link_libraries(${target_name} PUBLIC dart NLOPT::nlopt) # Component add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} NLOPT) # Generate header for this namespace dart_get_filename_components(header_names "optimizer_nlopt headers" ${hdrs}) diff --git a/dart/optimizer/pagmo/CMakeLists.txt b/dart/optimizer/pagmo/CMakeLists.txt index dd5441a25c589..8212827c5a9e6 100644 --- a/dart/optimizer/pagmo/CMakeLists.txt +++ b/dart/optimizer/pagmo/CMakeLists.txt @@ -1,13 +1,10 @@ # Dependency checks -find_package(PAGMO 2.8 QUIET) -dart_check_optional_package(PAGMO "dart-optimizer-pagmo" "pagmo" "2.8") +dart_find_package(pagmo) +dart_check_optional_package(pagmo "dart-optimizer-pagmo" "pagmo" "2.8") find_package(Threads REQUIRED) dart_check_optional_package(Threads "dart-optimizer-pagmo" "Threads" "") -find_package(NLOPT 2.4.1 QUIET) -dart_check_optional_package(NLOPT "dart-optimizer-pagmo" "nlopt" "2.4.1") - # Search all header and source files file(GLOB hdrs "*.hpp") file(GLOB srcs "*.cpp") @@ -18,7 +15,7 @@ set(component_name optimizer-pagmo) # Add target dart_add_library(${target_name} ${hdrs} ${srcs}) -target_link_libraries(${target_name} PUBLIC dart ${NLOPT_LIBRARIES}) +target_link_libraries(${target_name} PUBLIC dart Pagmo::pagmo) # Thread if(THREADS_HAVE_PTHREAD_ARG) @@ -32,6 +29,7 @@ endif() add_component(${PROJECT_NAME} ${component_name}) add_component_targets(${PROJECT_NAME} ${component_name} ${target_name}) add_component_dependencies(${PROJECT_NAME} ${component_name} dart) +add_component_dependency_packages(${PROJECT_NAME} ${component_name} pagmo) # Generate header for this namespace dart_get_filename_components(header_names "optimizer_pagmo headers" ${hdrs}) From a176eb67d0353373b2ab883d19f52181287fab02 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 02:11:21 -0800 Subject: [PATCH 30/50] Fix defining HAVE_PAGMO --- dart/optimizer/pagmo/CMakeLists.txt | 5 +++++ unittests/comprehensive/test_MultiObjectiveOptimization.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dart/optimizer/pagmo/CMakeLists.txt b/dart/optimizer/pagmo/CMakeLists.txt index 8212827c5a9e6..467744d5ffc4f 100644 --- a/dart/optimizer/pagmo/CMakeLists.txt +++ b/dart/optimizer/pagmo/CMakeLists.txt @@ -1,6 +1,11 @@ # Dependency checks dart_find_package(pagmo) dart_check_optional_package(pagmo "dart-optimizer-pagmo" "pagmo" "2.8") +if(pagmo_FOUND) + set(HAVE_PAGMO TRUE CACHE BOOL "Check if pagmo found." FORCE) +else() + set(HAVE_PAGMO FALSE CACHE BOOL "Check if pagmo found." FORCE) +endif() find_package(Threads REQUIRED) dart_check_optional_package(Threads "dart-optimizer-pagmo" "Threads" "") diff --git a/unittests/comprehensive/test_MultiObjectiveOptimization.cpp b/unittests/comprehensive/test_MultiObjectiveOptimization.cpp index 70cf641fea67d..841a3ed6f06bc 100644 --- a/unittests/comprehensive/test_MultiObjectiveOptimization.cpp +++ b/unittests/comprehensive/test_MultiObjectiveOptimization.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #if HAVE_PAGMO #include @@ -164,7 +165,7 @@ void testZDT1Generic(MultiObjectiveSolver& solver) TEST(ZDT1, Basic) { #if HAVE_PAGMO - optimizer::PagmoMultiObjectiveSolver pagmoSolver; + PagmoMultiObjectiveSolver pagmoSolver; testZDT1(pagmoSolver); testZDT1Generic(pagmoSolver); #endif From 072584364a0df676722346208a7cbbc3050556f5 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 02:28:24 -0800 Subject: [PATCH 31/50] Define OpenGL targets if not defined --- cmake/DARTFindOpenGL.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmake/DARTFindOpenGL.cmake b/cmake/DARTFindOpenGL.cmake index d17a1a9374276..f7895c11b58fc 100644 --- a/cmake/DARTFindOpenGL.cmake +++ b/cmake/DARTFindOpenGL.cmake @@ -7,3 +7,19 @@ # This file is provided under the "BSD-style" License find_package(OpenGL QUIET) + +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() From ef729fc3fa996aa2d270c1421d8ce81944bc29ed Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 14:39:46 -0800 Subject: [PATCH 32/50] Add documentation about targets in DARTConfig.cmake --- cmake/DARTConfig.cmake.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 4b2c930bcfc9f..48cba94c312ac 100644 --- a/cmake/DARTConfig.cmake.in +++ b/cmake/DARTConfig.cmake.in @@ -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- - Target for specific component (e.g., dart-collision-bullet). #=============================================================================== # Helper Function Definitions From e6bd19c8011f641dbf8bfdedc8b5f23a407358af Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 14:39:52 -0800 Subject: [PATCH 33/50] Fix typo --- cmake/Findfcl.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Findfcl.cmake b/cmake/Findfcl.cmake index f0ca771d5f6af..d7eb46e54d446 100644 --- a/cmake/Findfcl.cmake +++ b/cmake/Findfcl.cmake @@ -67,7 +67,7 @@ find_package_handle_standard_args(FCL # install the config file, which defines the target. if(FCL_FOUND AND NOT TARGET fcl) add_library(fcl INTERFACE IMPORTED) - set_target_properties(ccd PROPERTIES + set_target_properties(fcl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FCL_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${FCL_LIBRARIES}" ) From c164f3ce33b99a11ec359abb8cca85289a5f7663 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 15:47:05 -0800 Subject: [PATCH 34/50] Set the language standard to dart target --- CMakeLists.txt | 4 ---- dart/CMakeLists.txt | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d206f346d1064..caa849ffe65a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,8 +194,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") @@ -219,8 +217,6 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "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++") diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index d8404799077a2..7b3b9eb0107ba 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -139,6 +139,7 @@ target_link_libraries(dart if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) endif() +target_compile_features(dart PUBLIC cxx_std_11) # Build DART with all available SIMD instructions if(DART_ENABLE_SIMD) From 32a36aa56502196f44bccc2b81f98a302e7a6f57 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 15:59:48 -0800 Subject: [PATCH 35/50] Set CMP0053 only for finding OpenGL --- CMakeLists.txt | 6 ------ cmake/DARTFindOpenGL.cmake | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index caa849ffe65a3..d8a567cc35500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,12 +24,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") diff --git a/cmake/DARTFindOpenGL.cmake b/cmake/DARTFindOpenGL.cmake index f7895c11b58fc..539faea9c9c2b 100644 --- a/cmake/DARTFindOpenGL.cmake +++ b/cmake/DARTFindOpenGL.cmake @@ -6,8 +6,18 @@ # # 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 From 10377554e0a2b0245e4f0d74ee16fa01ccc405ed Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 16:00:54 -0800 Subject: [PATCH 36/50] Remove debug print --- cmake/DARTFindpagmo.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/DARTFindpagmo.cmake b/cmake/DARTFindpagmo.cmake index a24d3ae7b7a99..b38fad9378f8a 100644 --- a/cmake/DARTFindpagmo.cmake +++ b/cmake/DARTFindpagmo.cmake @@ -7,5 +7,3 @@ # This file is provided under the "BSD-style" License find_package(pagmo) - -message(STATUS "pagmo_VERSION: ${pagmo_VERSION}") From 1dfb9c5c6bcc38c7f20f7c119ec5fcfd09b066a3 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 16:08:17 -0800 Subject: [PATCH 37/50] Use targets in examples and tutorials --- examples/addDeleteSkels/CMakeLists.txt | 9 ++------- examples/atlasSimbicon/CMakeLists.txt | 9 ++------- examples/bipedStand/CMakeLists.txt | 7 +------ examples/hardcodedDesign/CMakeLists.txt | 7 +------ examples/hybridDynamics/CMakeLists.txt | 7 +------ examples/jointConstraints/CMakeLists.txt | 7 +------ examples/mixedChain/CMakeLists.txt | 7 +------ examples/operationalSpaceControl/CMakeLists.txt | 7 +------ examples/osgExamples/osgAtlasPuppet/CMakeLists.txt | 7 +------ examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt | 7 +------ examples/osgExamples/osgBoxStacking/CMakeLists.txt | 7 +------ examples/osgExamples/osgDragAndDrop/CMakeLists.txt | 7 +------ examples/osgExamples/osgEmpty/CMakeLists.txt | 7 +------ examples/osgExamples/osgHuboPuppet/CMakeLists.txt | 7 +------ examples/osgExamples/osgImGui/CMakeLists.txt | 7 +------ .../osgOperationalSpaceControl/CMakeLists.txt | 7 +------ examples/osgExamples/osgSoftBodies/CMakeLists.txt | 7 +------ examples/osgExamples/osgTinkertoy/CMakeLists.txt | 7 +------ examples/osgExamples/osgWamIkFast/CMakeLists.txt | 4 ---- examples/rigidChain/CMakeLists.txt | 7 +------ examples/rigidCubes/CMakeLists.txt | 7 +------ examples/rigidLoop/CMakeLists.txt | 7 +------ examples/rigidShapes/CMakeLists.txt | 7 +------ examples/simpleFrames/CMakeLists.txt | 7 +------ examples/softBodies/CMakeLists.txt | 7 +------ examples/speedTest/CMakeLists.txt | 7 +------ examples/vehicle/CMakeLists.txt | 7 +------ tutorials/tutorialBiped-Finished/CMakeLists.txt | 10 ++++------ tutorials/tutorialBiped/CMakeLists.txt | 10 ++++------ tutorials/tutorialCollisions-Finished/CMakeLists.txt | 7 +------ tutorials/tutorialCollisions/CMakeLists.txt | 8 +------- tutorials/tutorialDominoes-Finished/CMakeLists.txt | 8 +------- tutorials/tutorialDominoes/CMakeLists.txt | 8 +------- .../tutorialMultiPendulum-Finished/CMakeLists.txt | 8 +------- tutorials/tutorialMultiPendulum/CMakeLists.txt | 8 +------- 35 files changed, 42 insertions(+), 215 deletions(-) diff --git a/examples/addDeleteSkels/CMakeLists.txt b/examples/addDeleteSkels/CMakeLists.txt index 27eaa0b80a988..38c846e8a60cf 100644 --- a/examples/addDeleteSkels/CMakeLists.txt +++ b/examples/addDeleteSkels/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) @@ -9,11 +9,6 @@ project(addDeleteSkels) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/atlasSimbicon/CMakeLists.txt b/examples/atlasSimbicon/CMakeLists.txt index 5e056b26b6d15..fa67b6be686c0 100644 --- a/examples/atlasSimbicon/CMakeLists.txt +++ b/examples/atlasSimbicon/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) @@ -9,11 +9,6 @@ project(atlasSimbicon) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/bipedStand/CMakeLists.txt b/examples/bipedStand/CMakeLists.txt index 941f4e605549a..9685a5ae81a76 100644 --- a/examples/bipedStand/CMakeLists.txt +++ b/examples/bipedStand/CMakeLists.txt @@ -9,11 +9,6 @@ project(bipedStand) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/hardcodedDesign/CMakeLists.txt b/examples/hardcodedDesign/CMakeLists.txt index a133251b59756..b6bf9bb648d1e 100644 --- a/examples/hardcodedDesign/CMakeLists.txt +++ b/examples/hardcodedDesign/CMakeLists.txt @@ -9,11 +9,6 @@ project(hardcodedDesign) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/hybridDynamics/CMakeLists.txt b/examples/hybridDynamics/CMakeLists.txt index fb9a103f855cf..9b5decdd0412e 100644 --- a/examples/hybridDynamics/CMakeLists.txt +++ b/examples/hybridDynamics/CMakeLists.txt @@ -9,11 +9,6 @@ project(hybridDynamics) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/jointConstraints/CMakeLists.txt b/examples/jointConstraints/CMakeLists.txt index e6501a200a3b1..bb105a18b8882 100644 --- a/examples/jointConstraints/CMakeLists.txt +++ b/examples/jointConstraints/CMakeLists.txt @@ -9,11 +9,6 @@ project(jointConstraints) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/mixedChain/CMakeLists.txt b/examples/mixedChain/CMakeLists.txt index 5f694dd9dcbb7..2f385396352f7 100644 --- a/examples/mixedChain/CMakeLists.txt +++ b/examples/mixedChain/CMakeLists.txt @@ -9,11 +9,6 @@ project(mixedChain) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/operationalSpaceControl/CMakeLists.txt b/examples/operationalSpaceControl/CMakeLists.txt index b2a3eeec4114b..82ee9b52175ed 100644 --- a/examples/operationalSpaceControl/CMakeLists.txt +++ b/examples/operationalSpaceControl/CMakeLists.txt @@ -9,11 +9,6 @@ project(operationalSpaceControl) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt b/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt index bdd5e77939af2..2d68bd4413cc2 100644 --- a/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt +++ b/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgAtlasPuppet) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt b/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt index 0e33a5700da7e..b896f31679f83 100644 --- a/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt +++ b/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgAtlasSimbicon) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgBoxStacking/CMakeLists.txt b/examples/osgExamples/osgBoxStacking/CMakeLists.txt index cfbaddd0703ee..963301676cf50 100644 --- a/examples/osgExamples/osgBoxStacking/CMakeLists.txt +++ b/examples/osgExamples/osgBoxStacking/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgBoxStacking) find_package(DART 6.5.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgDragAndDrop/CMakeLists.txt b/examples/osgExamples/osgDragAndDrop/CMakeLists.txt index caf080c3b4119..82cd718ad4992 100644 --- a/examples/osgExamples/osgDragAndDrop/CMakeLists.txt +++ b/examples/osgExamples/osgDragAndDrop/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgDragAndDrop) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgEmpty/CMakeLists.txt b/examples/osgExamples/osgEmpty/CMakeLists.txt index 2a6ad797e25b8..7765deda23649 100644 --- a/examples/osgExamples/osgEmpty/CMakeLists.txt +++ b/examples/osgExamples/osgEmpty/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgEmpty) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgHuboPuppet/CMakeLists.txt b/examples/osgExamples/osgHuboPuppet/CMakeLists.txt index 9e8f41cd60547..ec0bced6830e0 100644 --- a/examples/osgExamples/osgHuboPuppet/CMakeLists.txt +++ b/examples/osgExamples/osgHuboPuppet/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgHubuPuppet) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgImGui/CMakeLists.txt b/examples/osgExamples/osgImGui/CMakeLists.txt index d260c398b0e9c..7ba9458e8807d 100644 --- a/examples/osgExamples/osgImGui/CMakeLists.txt +++ b/examples/osgExamples/osgImGui/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgImGui) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt b/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt index 161ab4216729a..021608247149a 100644 --- a/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt +++ b/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgOperationalSpaceControl) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgSoftBodies/CMakeLists.txt b/examples/osgExamples/osgSoftBodies/CMakeLists.txt index b2d530a632495..307420165f3f1 100644 --- a/examples/osgExamples/osgSoftBodies/CMakeLists.txt +++ b/examples/osgExamples/osgSoftBodies/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgSoftBodies) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgTinkertoy/CMakeLists.txt b/examples/osgExamples/osgTinkertoy/CMakeLists.txt index abf7cde02327e..f9068b033a810 100644 --- a/examples/osgExamples/osgTinkertoy/CMakeLists.txt +++ b/examples/osgExamples/osgTinkertoy/CMakeLists.txt @@ -9,11 +9,6 @@ project(osgTinkertoy) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui-osg) diff --git a/examples/osgExamples/osgWamIkFast/CMakeLists.txt b/examples/osgExamples/osgWamIkFast/CMakeLists.txt index 30a59484df994..757c838f994ff 100644 --- a/examples/osgExamples/osgWamIkFast/CMakeLists.txt +++ b/examples/osgExamples/osgWamIkFast/CMakeLists.txt @@ -9,10 +9,6 @@ project(osgWamIkfast) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui-osg) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - add_subdirectory(ikfast) file(GLOB srcs "*.cpp" "*.hpp") diff --git a/examples/rigidChain/CMakeLists.txt b/examples/rigidChain/CMakeLists.txt index a268f4cb89f4c..58fa9c7a46d77 100644 --- a/examples/rigidChain/CMakeLists.txt +++ b/examples/rigidChain/CMakeLists.txt @@ -9,11 +9,6 @@ project(rigidChain) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/rigidCubes/CMakeLists.txt b/examples/rigidCubes/CMakeLists.txt index c3ea6561b7a9c..d60eae18b8d75 100644 --- a/examples/rigidCubes/CMakeLists.txt +++ b/examples/rigidCubes/CMakeLists.txt @@ -9,11 +9,6 @@ project(rigidCubes) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/rigidLoop/CMakeLists.txt b/examples/rigidLoop/CMakeLists.txt index cf8ad5dc49f89..bd03286818885 100644 --- a/examples/rigidLoop/CMakeLists.txt +++ b/examples/rigidLoop/CMakeLists.txt @@ -9,11 +9,6 @@ project(rigidLoop) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/rigidShapes/CMakeLists.txt b/examples/rigidShapes/CMakeLists.txt index bd6c760ef8383..2602a689e3ad8 100644 --- a/examples/rigidShapes/CMakeLists.txt +++ b/examples/rigidShapes/CMakeLists.txt @@ -9,11 +9,6 @@ project(rigidShapes) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/simpleFrames/CMakeLists.txt b/examples/simpleFrames/CMakeLists.txt index 880d12ba6c951..0622a7462feac 100644 --- a/examples/simpleFrames/CMakeLists.txt +++ b/examples/simpleFrames/CMakeLists.txt @@ -9,11 +9,6 @@ project(simpleFrames) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/softBodies/CMakeLists.txt b/examples/softBodies/CMakeLists.txt index dd95b63127b1f..fbd7ddaa17d2a 100644 --- a/examples/softBodies/CMakeLists.txt +++ b/examples/softBodies/CMakeLists.txt @@ -9,11 +9,6 @@ project(softBodies) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/speedTest/CMakeLists.txt b/examples/speedTest/CMakeLists.txt index 811b589c4d1ae..9b8d0cf4e2b25 100644 --- a/examples/speedTest/CMakeLists.txt +++ b/examples/speedTest/CMakeLists.txt @@ -9,11 +9,6 @@ project(speedTest) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/examples/vehicle/CMakeLists.txt b/examples/vehicle/CMakeLists.txt index 779d43778aa06..b9fef074c94f5 100644 --- a/examples/vehicle/CMakeLists.txt +++ b/examples/vehicle/CMakeLists.txt @@ -9,11 +9,6 @@ project(vehicle) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/tutorials/tutorialBiped-Finished/CMakeLists.txt b/tutorials/tutorialBiped-Finished/CMakeLists.txt index 396ad873d5374..5e21c7ec9cfb0 100644 --- a/tutorials/tutorialBiped-Finished/CMakeLists.txt +++ b/tutorials/tutorialBiped-Finished/CMakeLists.txt @@ -12,11 +12,9 @@ find_package(DART 6.6.0 REQUIRED CONFIG ) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} + PUBLIC + dart dart-collision-bullet dart-utils-urdf dart-gui +) diff --git a/tutorials/tutorialBiped/CMakeLists.txt b/tutorials/tutorialBiped/CMakeLists.txt index cb1cee44032ff..cf14583347771 100644 --- a/tutorials/tutorialBiped/CMakeLists.txt +++ b/tutorials/tutorialBiped/CMakeLists.txt @@ -12,11 +12,9 @@ find_package(DART 6.6.0 REQUIRED CONFIG ) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} + PUBLIC + dart dart-collision-bullet dart-utils-urdf dart-gui +) diff --git a/tutorials/tutorialCollisions-Finished/CMakeLists.txt b/tutorials/tutorialCollisions-Finished/CMakeLists.txt index bd9d01338728d..9d60ed2cc5698 100644 --- a/tutorials/tutorialCollisions-Finished/CMakeLists.txt +++ b/tutorials/tutorialCollisions-Finished/CMakeLists.txt @@ -9,12 +9,7 @@ project(tutorialCollisions-Finished) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/tutorials/tutorialCollisions/CMakeLists.txt b/tutorials/tutorialCollisions/CMakeLists.txt index a7b10b54fcad5..65fbcadd0d7d0 100644 --- a/tutorials/tutorialCollisions/CMakeLists.txt +++ b/tutorials/tutorialCollisions/CMakeLists.txt @@ -9,12 +9,6 @@ project(tutorialCollisions) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) - +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/tutorials/tutorialDominoes-Finished/CMakeLists.txt b/tutorials/tutorialDominoes-Finished/CMakeLists.txt index a4a8c8672da3a..007a8022286e2 100644 --- a/tutorials/tutorialDominoes-Finished/CMakeLists.txt +++ b/tutorials/tutorialDominoes-Finished/CMakeLists.txt @@ -9,12 +9,6 @@ project(tutorialDominoes-Finished) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) - +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/tutorials/tutorialDominoes/CMakeLists.txt b/tutorials/tutorialDominoes/CMakeLists.txt index ee34125bcd87b..234caef4abb82 100644 --- a/tutorials/tutorialDominoes/CMakeLists.txt +++ b/tutorials/tutorialDominoes/CMakeLists.txt @@ -9,12 +9,6 @@ project(tutorialDominoes) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) - +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt b/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt index ab636da1d7795..d5419bdd3081a 100644 --- a/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt +++ b/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt @@ -9,12 +9,6 @@ project(tutorialMultiPendulum-Finished) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) - +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) diff --git a/tutorials/tutorialMultiPendulum/CMakeLists.txt b/tutorials/tutorialMultiPendulum/CMakeLists.txt index 14911f0d702f6..ae31b47856c98 100644 --- a/tutorials/tutorialMultiPendulum/CMakeLists.txt +++ b/tutorials/tutorialMultiPendulum/CMakeLists.txt @@ -9,12 +9,6 @@ project(tutorialMultiPendulum) find_package(DART 6.6.0 REQUIRED COMPONENTS utils-urdf gui CONFIG) -add_compile_options(-std=c++11) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES}) - +target_link_libraries(${PROJECT_NAME} PUBLIC dart dart-utils-urdf dart-gui) From e2ddb453b587cf96d95b147a3e54eb2b4ccf7dde Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 16:19:32 -0800 Subject: [PATCH 38/50] Add cxx_std_11 compile feature to odelcpsolver target --- dart/external/odelcpsolver/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 9697799ea87f6..90bb416fc00cc 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -12,6 +12,7 @@ target_include_directories(${target_name} $ $ ) +target_compile_features(${target_name} PUBLIC cxx_std_11) # Component add_component(${PROJECT_NAME} ${component_name}) From c8de175a3675b0684c395d487eab5e7f3437466d Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 16:56:52 -0800 Subject: [PATCH 39/50] Remove use of include_directories() --- dart/external/imgui/CMakeLists.txt | 5 ++--- dart/external/lodepng/CMakeLists.txt | 5 ++--- examples/humanJointLimits/CMakeLists.txt | 16 ++++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/dart/external/imgui/CMakeLists.txt b/dart/external/imgui/CMakeLists.txt index 150e6cd308d67..51184e6a09f6f 100644 --- a/dart/external/imgui/CMakeLists.txt +++ b/dart/external/imgui/CMakeLists.txt @@ -7,9 +7,8 @@ set(target_name ${PROJECT_NAME}-external-imgui) set(component_name external-imgui) dart_add_library(${target_name} ${hdrs} ${srcs}) -include_directories( - ${target_name} - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" +target_include_directories(${target_name} + PUBLIC $ ) if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/dart/external/lodepng/CMakeLists.txt b/dart/external/lodepng/CMakeLists.txt index 0cc8698020fee..93b4e73a24297 100644 --- a/dart/external/lodepng/CMakeLists.txt +++ b/dart/external/lodepng/CMakeLists.txt @@ -7,9 +7,8 @@ set(target_name ${PROJECT_NAME}-external-lodepng) set(component_name external-lodepng) dart_add_library(${target_name} ${hdrs} ${srcs}) -include_directories( - ${target_name} - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" +target_include_directories(${target_name} + PUBLIC $ ) # Component diff --git a/examples/humanJointLimits/CMakeLists.txt b/examples/humanJointLimits/CMakeLists.txt index 5d53467259551..9730976aa83b7 100644 --- a/examples/humanJointLimits/CMakeLists.txt +++ b/examples/humanJointLimits/CMakeLists.txt @@ -18,14 +18,18 @@ find_package(TinyDNN REQUIRED) find_package(Threads REQUIRED) -target_compile_options(${PROJECT_NAME} PUBLIC -std=c++14) - -include_directories(${DART_INCLUDE_DIRS}) - file(GLOB srcs "*.cpp" "*.hpp") add_executable(${PROJECT_NAME} ${srcs}) - -target_link_libraries(${PROJECT_NAME} ${DART_LIBRARIES} ${TinyDNN_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} + PUBLIC + dart + dart-utils-urdf + dart-gui + dart-collision-ode + dart-collision-bullet + ${TinyDNN_LIBRARIES} +) +target_compile_features(dart PUBLIC cxx_std_14) # Thread if(THREADS_HAVE_PTHREAD_ARG) From 240201dd40352666859d8fabeeff7fa6cd7ff4e0 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 16:57:07 -0800 Subject: [PATCH 40/50] Use urdfdom target instead of variables --- cmake/DARTFindurdfdom.cmake | 9 +++++++++ dart/utils/urdf/CMakeLists.txt | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/DARTFindurdfdom.cmake b/cmake/DARTFindurdfdom.cmake index 309857ee6daaa..9259479a65a08 100644 --- a/cmake/DARTFindurdfdom.cmake +++ b/cmake/DARTFindurdfdom.cmake @@ -7,3 +7,12 @@ # This file is provided under the "BSD-style" License find_package(urdfdom QUIET) + +if(urdfdom_FOUND AND NOT TARGET urdfdom) + add_library(urdfdom INTERFACE IMPORTED) + set_target_properties(urdfdom PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${urdfdom_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${urdfdom_LIBRARIES}" + ) +endif() + diff --git a/dart/utils/urdf/CMakeLists.txt b/dart/utils/urdf/CMakeLists.txt index 6c4e0f1f6c7c6..a46a7d0f2d75b 100644 --- a/dart/utils/urdf/CMakeLists.txt +++ b/dart/utils/urdf/CMakeLists.txt @@ -41,19 +41,10 @@ configure_file( install(FILES ${DART_UTILS_BACKWARDCOMPATIBILITY_HPP_OUT} DESTINATION include/dart/utils/urdf ) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Add target dart_add_library(${target_name} ${hdrs} ${srcs}) -target_include_directories( - ${target_name} SYSTEM - PUBLIC ${urdfdom_INCLUDE_DIRS} -) -target_link_libraries( - ${target_name} - dart-utils - ${urdfdom_LIBRARIES} -) +target_link_libraries(${target_name} PUBLIC dart-utils urdfdom) # Component add_component(${PROJECT_NAME} ${component_name}) From ab745c051bbd1c890012143db0b7315415409f5e Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 16:59:03 -0800 Subject: [PATCH 41/50] Increase minimum required CMake version to 3.5.1 --- CMakeLists.txt | 1 - cmake/Components.cmake | 3 +-- examples/CMakeLists.txt | 2 +- examples/bipedStand/CMakeLists.txt | 2 +- examples/hardcodedDesign/CMakeLists.txt | 2 +- examples/humanJointLimits/CMakeLists.txt | 2 +- examples/hybridDynamics/CMakeLists.txt | 2 +- examples/jointConstraints/CMakeLists.txt | 2 +- examples/mixedChain/CMakeLists.txt | 2 +- examples/operationalSpaceControl/CMakeLists.txt | 2 +- examples/osgExamples/osgAtlasPuppet/CMakeLists.txt | 2 +- examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt | 2 +- examples/osgExamples/osgBoxStacking/CMakeLists.txt | 2 +- examples/osgExamples/osgDragAndDrop/CMakeLists.txt | 2 +- examples/osgExamples/osgEmpty/CMakeLists.txt | 2 +- examples/osgExamples/osgHuboPuppet/CMakeLists.txt | 2 +- examples/osgExamples/osgImGui/CMakeLists.txt | 2 +- examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt | 2 +- examples/osgExamples/osgSoftBodies/CMakeLists.txt | 2 +- examples/osgExamples/osgTinkertoy/CMakeLists.txt | 2 +- examples/osgExamples/osgWamIkFast/CMakeLists.txt | 2 +- examples/rigidChain/CMakeLists.txt | 2 +- examples/rigidCubes/CMakeLists.txt | 2 +- examples/rigidLoop/CMakeLists.txt | 2 +- examples/rigidShapes/CMakeLists.txt | 2 +- examples/simpleFrames/CMakeLists.txt | 2 +- examples/softBodies/CMakeLists.txt | 2 +- examples/speedTest/CMakeLists.txt | 2 +- examples/vehicle/CMakeLists.txt | 2 +- tutorials/CMakeLists.txt | 2 +- tutorials/tutorialBiped-Finished/CMakeLists.txt | 2 +- tutorials/tutorialBiped/CMakeLists.txt | 2 +- tutorials/tutorialCollisions-Finished/CMakeLists.txt | 2 +- tutorials/tutorialCollisions/CMakeLists.txt | 2 +- tutorials/tutorialDominoes-Finished/CMakeLists.txt | 2 +- tutorials/tutorialDominoes/CMakeLists.txt | 2 +- tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt | 2 +- tutorials/tutorialMultiPendulum/CMakeLists.txt | 2 +- 38 files changed, 37 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8a567cc35500..9ce015e314172 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ #=============================================================================== # CMake settings #=============================================================================== -# CMake 2.8.12 or above is required for CMakeParseArguments. if(MSVC) cmake_minimum_required(VERSION 3.8.0) else() diff --git a/cmake/Components.cmake b/cmake/Components.cmake index 472f4190c5a5b..46cb161d19b2e 100644 --- a/cmake/Components.cmake +++ b/cmake/Components.cmake @@ -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) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index f7d0dea3d99af..d89958deff129 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) project(dart-examples) diff --git a/examples/bipedStand/CMakeLists.txt b/examples/bipedStand/CMakeLists.txt index 9685a5ae81a76..2a4c7aafe3d44 100644 --- a/examples/bipedStand/CMakeLists.txt +++ b/examples/bipedStand/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/hardcodedDesign/CMakeLists.txt b/examples/hardcodedDesign/CMakeLists.txt index b6bf9bb648d1e..fbc9978afca17 100644 --- a/examples/hardcodedDesign/CMakeLists.txt +++ b/examples/hardcodedDesign/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/humanJointLimits/CMakeLists.txt b/examples/humanJointLimits/CMakeLists.txt index 9730976aa83b7..9f8d9c8769fd4 100644 --- a/examples/humanJointLimits/CMakeLists.txt +++ b/examples/humanJointLimits/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/hybridDynamics/CMakeLists.txt b/examples/hybridDynamics/CMakeLists.txt index 9b5decdd0412e..d359229022a8e 100644 --- a/examples/hybridDynamics/CMakeLists.txt +++ b/examples/hybridDynamics/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/jointConstraints/CMakeLists.txt b/examples/jointConstraints/CMakeLists.txt index bb105a18b8882..d2f214e1ad58c 100644 --- a/examples/jointConstraints/CMakeLists.txt +++ b/examples/jointConstraints/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/mixedChain/CMakeLists.txt b/examples/mixedChain/CMakeLists.txt index 2f385396352f7..2d5fc18ea2fd3 100644 --- a/examples/mixedChain/CMakeLists.txt +++ b/examples/mixedChain/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/operationalSpaceControl/CMakeLists.txt b/examples/operationalSpaceControl/CMakeLists.txt index 82ee9b52175ed..443bae6c854c3 100644 --- a/examples/operationalSpaceControl/CMakeLists.txt +++ b/examples/operationalSpaceControl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt b/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt index 2d68bd4413cc2..25b072509f824 100644 --- a/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt +++ b/examples/osgExamples/osgAtlasPuppet/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt b/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt index b896f31679f83..33a8ccb03146a 100644 --- a/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt +++ b/examples/osgExamples/osgAtlasSimbicon/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgBoxStacking/CMakeLists.txt b/examples/osgExamples/osgBoxStacking/CMakeLists.txt index 963301676cf50..ab431637394db 100644 --- a/examples/osgExamples/osgBoxStacking/CMakeLists.txt +++ b/examples/osgExamples/osgBoxStacking/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgDragAndDrop/CMakeLists.txt b/examples/osgExamples/osgDragAndDrop/CMakeLists.txt index 82cd718ad4992..409626e2eddd9 100644 --- a/examples/osgExamples/osgDragAndDrop/CMakeLists.txt +++ b/examples/osgExamples/osgDragAndDrop/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgEmpty/CMakeLists.txt b/examples/osgExamples/osgEmpty/CMakeLists.txt index 7765deda23649..e3b5b67e8baa5 100644 --- a/examples/osgExamples/osgEmpty/CMakeLists.txt +++ b/examples/osgExamples/osgEmpty/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgHuboPuppet/CMakeLists.txt b/examples/osgExamples/osgHuboPuppet/CMakeLists.txt index ec0bced6830e0..b29daf8c586cb 100644 --- a/examples/osgExamples/osgHuboPuppet/CMakeLists.txt +++ b/examples/osgExamples/osgHuboPuppet/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgImGui/CMakeLists.txt b/examples/osgExamples/osgImGui/CMakeLists.txt index 7ba9458e8807d..c054b8fa30633 100644 --- a/examples/osgExamples/osgImGui/CMakeLists.txt +++ b/examples/osgExamples/osgImGui/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt b/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt index 021608247149a..b7eb318021231 100644 --- a/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt +++ b/examples/osgExamples/osgOperationalSpaceControl/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgSoftBodies/CMakeLists.txt b/examples/osgExamples/osgSoftBodies/CMakeLists.txt index 307420165f3f1..2daba8a5f90da 100644 --- a/examples/osgExamples/osgSoftBodies/CMakeLists.txt +++ b/examples/osgExamples/osgSoftBodies/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgTinkertoy/CMakeLists.txt b/examples/osgExamples/osgTinkertoy/CMakeLists.txt index f9068b033a810..6f4b2b1419156 100644 --- a/examples/osgExamples/osgTinkertoy/CMakeLists.txt +++ b/examples/osgExamples/osgTinkertoy/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/osgExamples/osgWamIkFast/CMakeLists.txt b/examples/osgExamples/osgWamIkFast/CMakeLists.txt index 757c838f994ff..e66f969d4724b 100644 --- a/examples/osgExamples/osgWamIkFast/CMakeLists.txt +++ b/examples/osgExamples/osgWamIkFast/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/rigidChain/CMakeLists.txt b/examples/rigidChain/CMakeLists.txt index 58fa9c7a46d77..2395d7c43b440 100644 --- a/examples/rigidChain/CMakeLists.txt +++ b/examples/rigidChain/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/rigidCubes/CMakeLists.txt b/examples/rigidCubes/CMakeLists.txt index d60eae18b8d75..d7f5bcc8414e8 100644 --- a/examples/rigidCubes/CMakeLists.txt +++ b/examples/rigidCubes/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/rigidLoop/CMakeLists.txt b/examples/rigidLoop/CMakeLists.txt index bd03286818885..ec80b1dd00608 100644 --- a/examples/rigidLoop/CMakeLists.txt +++ b/examples/rigidLoop/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/rigidShapes/CMakeLists.txt b/examples/rigidShapes/CMakeLists.txt index 2602a689e3ad8..6f0dc3342c6d5 100644 --- a/examples/rigidShapes/CMakeLists.txt +++ b/examples/rigidShapes/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/simpleFrames/CMakeLists.txt b/examples/simpleFrames/CMakeLists.txt index 0622a7462feac..04d3dd0466efc 100644 --- a/examples/simpleFrames/CMakeLists.txt +++ b/examples/simpleFrames/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/softBodies/CMakeLists.txt b/examples/softBodies/CMakeLists.txt index fbd7ddaa17d2a..66f371e726101 100644 --- a/examples/softBodies/CMakeLists.txt +++ b/examples/softBodies/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/speedTest/CMakeLists.txt b/examples/speedTest/CMakeLists.txt index 9b8d0cf4e2b25..c6631bf138d90 100644 --- a/examples/speedTest/CMakeLists.txt +++ b/examples/speedTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/examples/vehicle/CMakeLists.txt b/examples/vehicle/CMakeLists.txt index b9fef074c94f5..114ba5410c85f 100644 --- a/examples/vehicle/CMakeLists.txt +++ b/examples/vehicle/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/CMakeLists.txt b/tutorials/CMakeLists.txt index c8994a9088533..16a068a6a8f7d 100644 --- a/tutorials/CMakeLists.txt +++ b/tutorials/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) project(dart-tutorials) diff --git a/tutorials/tutorialBiped-Finished/CMakeLists.txt b/tutorials/tutorialBiped-Finished/CMakeLists.txt index 5e21c7ec9cfb0..ab14646f55b6c 100644 --- a/tutorials/tutorialBiped-Finished/CMakeLists.txt +++ b/tutorials/tutorialBiped-Finished/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialBiped/CMakeLists.txt b/tutorials/tutorialBiped/CMakeLists.txt index cf14583347771..7704379d60afe 100644 --- a/tutorials/tutorialBiped/CMakeLists.txt +++ b/tutorials/tutorialBiped/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialCollisions-Finished/CMakeLists.txt b/tutorials/tutorialCollisions-Finished/CMakeLists.txt index 9d60ed2cc5698..15cc5954973f0 100644 --- a/tutorials/tutorialCollisions-Finished/CMakeLists.txt +++ b/tutorials/tutorialCollisions-Finished/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialCollisions/CMakeLists.txt b/tutorials/tutorialCollisions/CMakeLists.txt index 65fbcadd0d7d0..153c36c47c300 100644 --- a/tutorials/tutorialCollisions/CMakeLists.txt +++ b/tutorials/tutorialCollisions/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialDominoes-Finished/CMakeLists.txt b/tutorials/tutorialDominoes-Finished/CMakeLists.txt index 007a8022286e2..356714aad342a 100644 --- a/tutorials/tutorialDominoes-Finished/CMakeLists.txt +++ b/tutorials/tutorialDominoes-Finished/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialDominoes/CMakeLists.txt b/tutorials/tutorialDominoes/CMakeLists.txt index 234caef4abb82..5990b5691f9e4 100644 --- a/tutorials/tutorialDominoes/CMakeLists.txt +++ b/tutorials/tutorialDominoes/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt b/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt index d5419bdd3081a..267963160c2a8 100644 --- a/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt +++ b/tutorials/tutorialMultiPendulum-Finished/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) diff --git a/tutorials/tutorialMultiPendulum/CMakeLists.txt b/tutorials/tutorialMultiPendulum/CMakeLists.txt index ae31b47856c98..e76f0496c31c8 100644 --- a/tutorials/tutorialMultiPendulum/CMakeLists.txt +++ b/tutorials/tutorialMultiPendulum/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5.1) if(DART_IN_SOURCE_BUILD) include(${CMAKE_CURRENT_SOURCE_DIR}/InSourceBuild.cmake) From d1c2b476367f90391c624e041ccee6556303bb8c Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 19:50:23 -0800 Subject: [PATCH 42/50] Use properties to set c++ standard --- dart/CMakeLists.txt | 2 +- dart/external/odelcpsolver/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 7b3b9eb0107ba..a8d11bbe4137d 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -139,7 +139,7 @@ target_link_libraries(dart if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) endif() -target_compile_features(dart PUBLIC cxx_std_11) +set_target_properties(dart PROPERTIES CXX_STANDARD 11) # Build DART with all available SIMD instructions if(DART_ENABLE_SIMD) diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 90bb416fc00cc..8d351d87d462e 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -12,7 +12,7 @@ target_include_directories(${target_name} $ $ ) -target_compile_features(${target_name} PUBLIC cxx_std_11) +set_target_properties(${target_name} PROPERTIES CXX_STANDARD 11) # Component add_component(${PROJECT_NAME} ${component_name}) From 843a3957c6f6e2784d7a89389cd13350aed66820 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 19:51:13 -0800 Subject: [PATCH 43/50] Find pagmo in QUIET mode --- cmake/DARTFindpagmo.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/DARTFindpagmo.cmake b/cmake/DARTFindpagmo.cmake index b38fad9378f8a..2f76e803d01d2 100644 --- a/cmake/DARTFindpagmo.cmake +++ b/cmake/DARTFindpagmo.cmake @@ -6,4 +6,4 @@ # # This file is provided under the "BSD-style" License -find_package(pagmo) +find_package(pagmo QUIET) From 21437774cb096ab9aa30714d60e952e23ba4656d Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 20:02:23 -0800 Subject: [PATCH 44/50] Set more necessary target properties --- dart/CMakeLists.txt | 6 +++++- dart/external/odelcpsolver/CMakeLists.txt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index a8d11bbe4137d..dae8d72fe766d 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -139,7 +139,11 @@ target_link_libraries(dart if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) endif() -set_target_properties(dart PROPERTIES CXX_STANDARD 11) +set_target_properties(dart PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS ON +) # Build DART with all available SIMD instructions if(DART_ENABLE_SIMD) diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 8d351d87d462e..0c24ce8147379 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -12,7 +12,11 @@ target_include_directories(${target_name} $ $ ) -set_target_properties(${target_name} PROPERTIES CXX_STANDARD 11) +set_target_properties(${target_name} PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS ON +) # Component add_component(${PROJECT_NAME} ${component_name}) From e297de1f756af5082775348a4c48762bb75168ea Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 20:19:12 -0800 Subject: [PATCH 45/50] Fix setting c++ standard --- dart/CMakeLists.txt | 14 +++++++++----- dart/external/odelcpsolver/CMakeLists.txt | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index dae8d72fe766d..bb1cc9e426061 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -139,11 +139,15 @@ target_link_libraries(dart if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) endif() -set_target_properties(dart PROPERTIES - CXX_STANDARD 11 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS ON -) +if(CMAKE_VERSION LESS 3.8.2) + set_target_properties(dart PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF # use -std=c++11 instead of -std=gnu++11 + ) +else() + target_compile_features(dart PUBLIC cxx_std_11) +endif() # Build DART with all available SIMD instructions if(DART_ENABLE_SIMD) diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 0c24ce8147379..50be4df9a2046 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -12,11 +12,15 @@ target_include_directories(${target_name} $ $ ) -set_target_properties(${target_name} PROPERTIES - CXX_STANDARD 11 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS ON -) +if(CMAKE_VERSION LESS 3.8.2) + set_target_properties(${target_name} PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF # use -std=c++11 instead of -std=gnu++11 + ) +else() + target_compile_features(${target_name} PUBLIC cxx_std_11) +endif() # Component add_component(${PROJECT_NAME} ${component_name}) From f8d411187251e1fbbaec4fd65172ebb14430cf80 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 20:28:25 -0800 Subject: [PATCH 46/50] Use VERSION_LESS for version comparison --- dart/CMakeLists.txt | 2 +- dart/external/odelcpsolver/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index bb1cc9e426061..853372a85bbc8 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -139,7 +139,7 @@ target_link_libraries(dart if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) endif() -if(CMAKE_VERSION LESS 3.8.2) +if(CMAKE_VERSION VERSION_LESS 3.8.2) set_target_properties(dart PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 50be4df9a2046..5243fdb2944e2 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -12,7 +12,7 @@ target_include_directories(${target_name} $ $ ) -if(CMAKE_VERSION LESS 3.8.2) +if(CMAKE_VERSION VERSION_LESS 3.8.2) set_target_properties(${target_name} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON From fd873ca796050d9f286f8cdca885f4310c8b84a0 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Tue, 8 Jan 2019 21:24:18 -0800 Subject: [PATCH 47/50] Give up using target properties for setting c++ standard --- dart/CMakeLists.txt | 6 +----- dart/external/odelcpsolver/CMakeLists.txt | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 853372a85bbc8..13e1882865735 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -140,11 +140,7 @@ if(NOT MSVC) target_link_libraries(dart PUBLIC Boost::regex) endif() if(CMAKE_VERSION VERSION_LESS 3.8.2) - set_target_properties(dart PROPERTIES - CXX_STANDARD 11 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF # use -std=c++11 instead of -std=gnu++11 - ) + target_compile_options(dart PUBLIC -std=c++11) else() target_compile_features(dart PUBLIC cxx_std_11) endif() diff --git a/dart/external/odelcpsolver/CMakeLists.txt b/dart/external/odelcpsolver/CMakeLists.txt index 5243fdb2944e2..4a0ef75aa7cb1 100644 --- a/dart/external/odelcpsolver/CMakeLists.txt +++ b/dart/external/odelcpsolver/CMakeLists.txt @@ -13,11 +13,7 @@ target_include_directories(${target_name} $ ) if(CMAKE_VERSION VERSION_LESS 3.8.2) - set_target_properties(${target_name} PROPERTIES - CXX_STANDARD 11 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS OFF # use -std=c++11 instead of -std=gnu++11 - ) + target_compile_options(${target_name} PUBLIC -std=c++11) else() target_compile_features(${target_name} PUBLIC cxx_std_11) endif() From df251305506bcc17aa416046ffa2610b71832565 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 9 Jan 2019 13:09:53 -0800 Subject: [PATCH 48/50] Possible fix for build on Mojave --- cmake/DARTFindDependencies.cmake | 2 +- cmake/DARTFindassimp.cmake | 2 +- dart/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index 725877ef721a8..bf990f5ee408e 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -24,7 +24,7 @@ dart_check_required_package(fcl "fcl") # ASSIMP dart_find_package(assimp) dart_check_required_package(assimp "assimp") -if(ASSIMP_FOUND) +if(assimp_FOUND) # Check for missing symbols in ASSIMP (see #451) include(CheckCXXSourceCompiles) set(CMAKE_REQUIRED_DEFINITIONS "") diff --git a/cmake/DARTFindassimp.cmake b/cmake/DARTFindassimp.cmake index 20a8287152839..104ddcd02f5cc 100644 --- a/cmake/DARTFindassimp.cmake +++ b/cmake/DARTFindassimp.cmake @@ -21,7 +21,7 @@ endif() # Set target assimp if not set # The target is not imported by upstream until 4.1 -if(ASSIMP_FOUND AND NOT TARGET assimp) +if(assimp_FOUND AND NOT TARGET assimp) add_library(assimp INTERFACE IMPORTED) set_target_properties(assimp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" diff --git a/dart/CMakeLists.txt b/dart/CMakeLists.txt index 13e1882865735..a9b7092db7ad7 100644 --- a/dart/CMakeLists.txt +++ b/dart/CMakeLists.txt @@ -132,6 +132,7 @@ target_link_libraries(dart ccd fcl assimp + Boost::boost Boost::system Boost::filesystem octomap From d7bebf325448f1bc8ca088f52733b3b52c2722ee Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 9 Jan 2019 13:22:43 -0800 Subject: [PATCH 49/50] Use own module to find assimp since one from upstream isn't compatible with macOS (at least Mojave) --- cmake/DARTFindDependencies.cmake | 2 +- cmake/DARTFindassimp.cmake | 12 -------- cmake/Findassimp.cmake | 53 ++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 cmake/Findassimp.cmake diff --git a/cmake/DARTFindDependencies.cmake b/cmake/DARTFindDependencies.cmake index bf990f5ee408e..725877ef721a8 100644 --- a/cmake/DARTFindDependencies.cmake +++ b/cmake/DARTFindDependencies.cmake @@ -24,7 +24,7 @@ dart_check_required_package(fcl "fcl") # ASSIMP dart_find_package(assimp) dart_check_required_package(assimp "assimp") -if(assimp_FOUND) +if(ASSIMP_FOUND) # Check for missing symbols in ASSIMP (see #451) include(CheckCXXSourceCompiles) set(CMAKE_REQUIRED_DEFINITIONS "") diff --git a/cmake/DARTFindassimp.cmake b/cmake/DARTFindassimp.cmake index 104ddcd02f5cc..e9c40c6c71201 100644 --- a/cmake/DARTFindassimp.cmake +++ b/cmake/DARTFindassimp.cmake @@ -8,8 +8,6 @@ find_package(assimp REQUIRED) -set(ASSIMP_VERSION ${assimp_VERSION}) - # 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. @@ -18,13 +16,3 @@ if(ASSIMP_VERSION VERSION_LESS 3.2) required" ) endif() - -# Set target assimp if not set -# The target is not imported by upstream until 4.1 -if(assimp_FOUND AND NOT TARGET assimp) - add_library(assimp INTERFACE IMPORTED) - set_target_properties(assimp PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES}" - ) -endif() diff --git a/cmake/Findassimp.cmake b/cmake/Findassimp.cmake new file mode 100644 index 0000000000000..57b62f1a8c425 --- /dev/null +++ b/cmake/Findassimp.cmake @@ -0,0 +1,53 @@ +# Copyright (c) 2011-2018, 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 ASSIMP +# +# This sets the following variables: +# ASSIMP_FOUND +# ASSIMP_INCLUDE_DIRS +# ASSIMP_LIBRARIES +# ASSIMP_VERSION + +find_package(PkgConfig QUIET) + +# Check to see if pkgconfig is installed. +pkg_check_modules(PC_ASSIMP assimp QUIET) + +# Include directories +find_path(ASSIMP_INCLUDE_DIRS assimp/scene.h + HINTS ${PC_ASSIMP_INCLUDEDIR} + PATHS "${CMAKE_INSTALL_PREFIX}/include") + +# Libraries +if(MSVC) + set(ASSIMP_LIBRARIES optimized assimp debug assimpd) +else() + find_library(ASSIMP_LIBRARIES + NAMES assimp + HINTS ${PC_ASSIMP_LIBDIR}) +endif() + +# Version +set(ASSIMP_VERSION ${PC_ASSIMP_VERSION}) + +# Set (NAME)_FOUND if all the variables and the version are satisfied. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ASSIMP + FAIL_MESSAGE DEFAULT_MSG + REQUIRED_VARS ASSIMP_INCLUDE_DIRS ASSIMP_LIBRARIES + VERSION_VAR ASSIMP_VERSION) + +# Set target assimp if not set +if(ASSIMP_FOUND AND NOT TARGET assimp) + add_library(assimp INTERFACE IMPORTED) + set_target_properties(assimp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES}" + ) +endif() \ No newline at end of file From 7c13f5d505db5552779418a52ee548359b6502cc Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 9 Jan 2019 13:42:26 -0800 Subject: [PATCH 50/50] Don't use GLUT::GLUT that doesn't work on Majave (probably even other versions) --- cmake/Findassimp.cmake | 2 +- dart/gui/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/Findassimp.cmake b/cmake/Findassimp.cmake index 57b62f1a8c425..03eca6363a08c 100644 --- a/cmake/Findassimp.cmake +++ b/cmake/Findassimp.cmake @@ -50,4 +50,4 @@ if(ASSIMP_FOUND AND NOT TARGET assimp) INTERFACE_INCLUDE_DIRECTORIES "${ASSIMP_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${ASSIMP_LIBRARIES}" ) -endif() \ No newline at end of file +endif() diff --git a/dart/gui/CMakeLists.txt b/dart/gui/CMakeLists.txt index 6dbe0dffb4e9e..e8d3f2d416993 100644 --- a/dart/gui/CMakeLists.txt +++ b/dart/gui/CMakeLists.txt @@ -46,10 +46,11 @@ set(component_name gui) dart_add_library(${target_name} ${hdrs} ${srcs} ${dart_gui_headers} ${dart_gui_sources} ) +target_include_directories(${target_name} PUBLIC ${GLUT_INCLUDE_DIRS}) target_link_libraries(${target_name} PUBLIC dart-utils - GLUT::GLUT + ${GLUT_LIBRARIES} OpenGL::GLU OpenGL::GL ${PROJECT_NAME}-external-lodepng