Skip to content
Snippets Groups Projects
Commit 1add931c authored by Peter Kaiser's avatar Peter Kaiser
Browse files

CMake: Added switch for NLOPT

parent b1d7d253
No related branches found
No related tags found
No related merge requests found
# Copyright (c) 2015, Georgia Tech Graphics Lab and Humanoid Robotics Lab
# This file is provided under the "BSD-style" License
# Find NLOPT
#
# This sets the following variables:
# NLOPT_FOUND
# NLOPT_INCLUDE_DIRS
# NLOPT_LIBRARIES
# NLOPT_DEFINITIONS
# NLOPT_VERSION
find_package(PkgConfig QUIET)
# Check to see if pkgconfig is installed.
pkg_check_modules(PC_NLOPT nlopt QUIET)
# Definitions
set(NLOPT_DEFINITIONS ${PC_NLOPT_CFLAGS_OTHER})
# Include directories
find_path(NLOPT_INCLUDE_DIRS
NAMES nlopt.h
HINTS ${PC_NLOPT_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include")
# Libraries
find_library(NLOPT_LIBRARIES
NAMES nlopt nlopt_cxx
HINTS ${PC_NLOPT_LIBDIR})
# Version
set(NLOPT_VERSION ${PC_NLOPT_VERSION})
# Set (NAME)_FOUND if all the variables and the version are satisfied.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NLOPT
FAIL_MESSAGE DEFAULT_MSG
REQUIRED_VARS NLOPT_INCLUDE_DIRS NLOPT_LIBRARIES
VERSION_VAR NLOPT_VERSION)
......@@ -19,6 +19,10 @@ if (Simox_USE_RBDL)
FIND_PACKAGE (RBDL)
endif()
if (Simox_USE_NLOPT)
FIND_PACKAGE (NLOPT)
endif()
########################### TESTING #####################################
MACRO(ADD_VR_TEST TEST_NAME)
INCLUDE_DIRECTORIES(${Simox_EXTERNAL_INCLUDE_DIRS})
......@@ -86,7 +90,6 @@ IK/FeetPosture.cpp
IK/ConstrainedIK.cpp
IK/ConstrainedHierarchicalIK.cpp
IK/ConstrainedStackedIK.cpp
IK/ConstrainedOptimizationIK.cpp
IK/Constraint.cpp
IK/constraints/BalanceConstraint.cpp
IK/constraints/PoseConstraint.cpp
......@@ -196,7 +199,6 @@ IK/FeetPosture.h
IK/ConstrainedIK.h
IK/ConstrainedHierarchicalIK.h
IK/ConstrainedStackedIK.h
IK/ConstrainedOptimizationIK.h
IK/Constraint.h
IK/constraints/BalanceConstraint.h
IK/constraints/PoseConstraint.h
......@@ -246,6 +248,16 @@ ADD_SUBDIRECTORY(Visualization/tests)
ADD_SUBDIRECTORY(Workspace/tests)
ADD_SUBDIRECTORY(Compression/tests)
if (Simox_USE_NLOPT AND NLOPT_FOUND)
SET(SOURCES ${SOURCES}
IK/ConstrainedOptimizationIK.cpp
)
SET(INCLUDES ${INCLUDES}
IK/ConstrainedOptimizationIK.h
)
endif ()
if (Simox_VISUALIZATION AND Simox_USE_COIN_VISUALIZATION)
SET(SOURCES
......
......@@ -163,6 +163,19 @@ IF (NOT Simox_CONFIGURED)
#urdf
OPTION (Simox_USE_URDF "Use URDF" OFF)
#### NLOPT
OPTION (Simox_USE_NLOPT "Use NLOPT" OFF)
if (Simox_USE_NLOPT)
FIND_PACKAGE(NLOPT)
if (NLOPT_FOUND)
MESSAGE(STATUS "NLOPT found at: ${NLOPT_INCLUDE_DIRS}")
SET (Simox_EXTERNAL_INCLUDE_DIRS ${Simox_EXTERNAL_INCLUDE_DIRS} ${NLOPT_INCLUDE_DIRS})
SET (Simox_EXTERNAL_LIBRARIES ${Simox_EXTERNAL_LIBRARIES} ${NLOPT_LIBRARIES})
else ()
MESSAGE(STATUS "NLOPT not found")
endif ()
endif ()
#### Eigen
FIND_PACKAGE (Eigen3 REQUIRED)
if (Eigen3_FOUND)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment