From 16c740a6f95c9f795441bc985f94113c62a0cdcc Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Mon, 22 Jun 2015 00:33:53 +0200 Subject: [PATCH] Add ability to have external orocos-kdl library instead of the suplied in FreeCAD, used in Robot and Path workbenches cmake switch: FREECAD_USE_EXTERNAL_KDL Makes Robot workbench and Path compilable on OS X 10.9 --- CMakeLists.txt | 1 + src/Mod/Robot/App/CMakeLists.txt | 46 ++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2334155f..3216dc016 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,7 @@ OPTION(FREECAD_MAINTAINERS_BUILD "Build FreeCAD for Maintainers, with Docu and 3 OPTION(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF) OPTION(FREECAD_USE_EXTERNAL_PIVY "Use system installed python-pivy instead of the bundled." OFF) OPTION(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF) +OPTION(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF) OPTION(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF) if(APPLE) diff --git a/src/Mod/Robot/App/CMakeLists.txt b/src/Mod/Robot/App/CMakeLists.txt index f4290bf2f..7729d5d03 100644 --- a/src/Mod/Robot/App/CMakeLists.txt +++ b/src/Mod/Robot/App/CMakeLists.txt @@ -26,12 +26,6 @@ set(Robot_LIBS FreeCADApp ) -FILE( GLOB KDL_SRCS kdl_cp/[^.]*.cpp ) -FILE( GLOB KDL_HPPS kdl_cp/[^.]*.hpp kdl_cp/[^.]*.inl) - -FILE( GLOB UTIL_SRCS kdl_cp/utilities/[^.]*.cpp kdl_cp/utilities/[^.]*.cxx) -FILE( GLOB UTIL_HPPS kdl_cp/utilities/[^.]*.h kdl_cp/utilities/[^.]*.hpp) - generate_from_xml(Robot6AxisPy) generate_from_xml(TrajectoryPy) generate_from_xml(WaypointPy) @@ -79,16 +73,46 @@ SET(Robot_SRCS Simulation.h Waypoint.cpp Waypoint.h - ${KDL_SRCS} - ${KDL_HPPS} - ${UTIL_SRCS} - ${UTIL_HPPS} ${Mod_SRCS} ${Python_SRCS} ) +# use external kdl +if (FREECAD_USE_EXTERNAL_KDL) + find_library(KDL_LIBRARY orocos-kdl) + find_path(KDL_INCLUDES kdl/kdl.hpp) + if(KDL_LIBRARY) + message(STATUS "Found orocos-kdl: ${KDL_LIBRARY}") + endif() + if(KDL_INCLUDES) + message(STATUS "Found orocus_kdl headers: ${KDL_INCLUDES}") + endif() + if(KDL_LIBRARY AND KDL_INCLUDES) + list(APPEND Robot_LIBS ${KDL_LIBRARY}) + include_directories(${KDL_INCLUDES}) + else() + message(FATAL_ERROR "Using external orocos-kdl was specified but was not found.") + endif() -SOURCE_GROUP("KDL" FILES ${KDL_SRCS} ${KDL_HPPS} ${UTIL_SRCS} ${UTIL_HPPS} ) +else(FREECAD_USE_EXTERNAL_KDL) + # here we use the internal supplied kdl + FILE( GLOB KDL_SRCS kdl_cp/[^.]*.cpp ) + FILE( GLOB KDL_HPPS kdl_cp/[^.]*.hpp kdl_cp/[^.]*.inl) + + FILE( GLOB UTIL_SRCS kdl_cp/utilities/[^.]*.cpp kdl_cp/utilities/[^.]*.cxx) + FILE( GLOB UTIL_HPPS kdl_cp/utilities/[^.]*.h kdl_cp/utilities/[^.]*.hpp) + + SET(Robot_SRCS + ${Robot_SRCS} + ${KDL_SRCS} + ${KDL_HPPS} + ${UTIL_SRCS} + ${UTIL_HPPS} + ) + + SOURCE_GROUP("KDL" FILES ${KDL_SRCS} ${KDL_HPPS} ${UTIL_SRCS} ${UTIL_HPPS} ) + +endif(FREECAD_USE_EXTERNAL_KDL) SOURCE_GROUP("Python" FILES ${Python_SRCS}) SOURCE_GROUP("Module" FILES ${Mod_SRCS})