Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Refactor how dependencies are handled #323

Merged
merged 1 commit into from
Jun 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ include(iDynTreeOptions)

if(NOT IDYNTREE_ONLY_DOCS)
# Find dependecies

# Eigen is compulsory
find_package(Eigen3 REQUIRED)
include(iDynTreeDependencies)

if(IDYNTREE_USES_YARP)
find_package(YARP REQUIRED)
Expand All @@ -47,26 +45,6 @@ if(NOT IDYNTREE_ONLY_DOCS)
endif()
endif()

if(IDYNTREE_USES_ICUB_MAIN)
find_package(ICUB REQUIRED)
endif()

if(IDYNTREE_USES_KDL)
include(OrocosKDLFindLogic)
find_package(orocos_kdl REQUIRED)
find_package(TinyXML REQUIRED)
else()
# If KDL is not used, an external TinyXML is not compulsory
# (because no public headers contain TinyXML includes)
# and so we can use the internal copy of TinyXML, see logic
# in extern/CMakeLists.txt
find_package(TinyXML)
endif()

if(IDYNTREE_USES_IPOPT)
find_package(IPOPT REQUIRED)
endif()

# Add external libraries that are embedded in iDynTree
# source tree, if necessary (by default does not adds
# anything) feel free to check teh logic inside
Expand Down
54 changes: 54 additions & 0 deletions cmake/iDynTreeDependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright: (C) 2017 Fondazione Istituto Italiano di Tecnologia
# Authors: Silvio Traversaro
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

#########################################################################
# Enable/disable dependencies
macro(idyntree_handle_dependency package)
set(multiValueArgs COMPONENTS)
cmake_parse_arguments(IHD "" "" "${multiValueArgs}" ${ARGN})
if (IHD_COMPONENTS)
find_package(${package} COMPONENTS ${IHD_COMPONENTS})
else ()
find_package(${package})
endif ()
string(TOUPPER ${package} PKG)
option(IDYNTREE_USES_${PKG} "Build the part of iDynTree that depends on package ${package}" ${${package}_FOUND})
if (IDYNTREE_USES_${PKG})
if (IHD_COMPONENTS)
find_package(${package} COMPONENTS ${IHD_COMPONENTS} REQUIRED)
else ()
find_package(${package} REQUIRED)
endif ()
endif ()
endmacro ()

# Eigen is compulsory
find_package(Eigen3 REQUIRED)

# For orocos_kdl we have custom logic, because we want to set it to FALSE by default
option(IDYNTREE_USES_KDL "Build the part of iDynTree that depends on package orocos_kdl" FALSE)
if (IDYNTREE_USES_KDL)
include(OrocosKDLFindLogic)
find_package(orocos_kdl REQUIRED)
find_package(TinyXML REQUIRED)
endif ()

find_package(ICUB)
option(IDYNTREE_USES_ICUB_MAIN "Build the part of iDynTree that depends on package ICUB" ${ICUB_FOUND})
if (IDYNTREE_USES_ICUB)
find_package(ICUB REQUIRED)
endif ()

idyntree_handle_dependency(YARP)
idyntree_handle_dependency(IPOPT)
idyntree_handle_dependency(Irrlicht)
idyntree_handle_dependency(Qt5 COMPONENTS Qml Quick Widgets)

# If KDL is not used, an external TinyXML is not compulsory
# (because no public headers contain TinyXML includes)
# and so we can use the internal copy of TinyXML, see logic
# in extern/CMakeLists.txt . For this reason we just check
# the system if a local copy of TinyXML exists, and otherwise
# we use the copy in extern/CMakeLists.txt
find_package(TinyXML)
11 changes: 0 additions & 11 deletions cmake/iDynTreeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,6 @@ option(IDYNTREE_USES_SEMANTICS "Compile iDynTree semantics check" FALSE)
option(IDYNTREE_ENABLE_RPATH "Enable RPATH for the library" TRUE)
mark_as_advanced(IDYNTREE_ENABLE_RPATH)

#########################################################################
# Enable/disable dependencies
option(IDYNTREE_ENABLE_SYMORO_PAR "Enable support for SyMoRo par format" TRUE)
option(IDYNTREE_USES_KDL "Compile iDynTree with KDL dependency" FALSE)
option(IDYNTREE_USES_YARP "Compile iDynTree with YARP dependency" TRUE)
option(IDYNTREE_USES_ICUB_MAIN "Compile iDynTree with icub-main dependencies (for iKin and skinDynLib helper functions and tools)" TRUE)
option(IDYNTREE_USES_IPOPT "Compile iDynTree with Ipopt dependency (for inverse-kinematics)" TRUE)
option(IDYNTREE_USES_IRRLICHT "Compile iDynTree with Irrlicht dependency (for visualizer)" FALSE)
option(IDYNTREE_USES_QT5 "Compile iDynTree with Qt5 dependency (for visualization tools)" FALSE)


if( MSVC )
option(IDYNTREE_USES_INTERNAL_URDFDOM "Compile iDynTree with an internal copy of urdfdom patched to avoid Boost dependencies" TRUE)
else()
Expand Down
1 change: 1 addition & 0 deletions src/model_io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if(IDYNTREE_USES_KDL)
add_subdirectory(urdf-kdl)
endif()

option(IDYNTREE_ENABLE_SYMORO_PAR "Enable support for SyMoRo par format" TRUE)
if(IDYNTREE_ENABLE_SYMORO_PAR AND IDYNTREE_USES_KDL)
add_subdirectory(symoro)
endif()
Expand Down