Skip to content

Commit 91e7f27

Browse files
authored
Merge pull request #4 from olivier-stasse/master
[cmake] Find qpoases through cmake.
2 parents c28d32a + 1611ea5 commit 91e7f27

File tree

3 files changed

+58
-3
lines changed

3 files changed

+58
-3
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
22

33
INCLUDE(cmake/base.cmake)
44
INCLUDE(cmake/eigen.cmake)
5+
INCLUDE(private_cmake/FindqpOASES.cmake)
6+
7+
IF (NOT qpOASES_FOUND)
8+
MESSAGE(ERROR " qpOASES not found. Please install it (using robotpkg for instance)")
9+
ENDIF()
510

611
SET(CXX_DISABLE_WERROR True)
712
SET(CMAKE_VERBOSE_MAKEFILE True)
@@ -13,9 +18,9 @@ SET(PROJECT_URL "https://github.com/stack-of-tasks/ddp-actuator-solver")
1318
SETUP_PROJECT()
1419

1520
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
16-
ADD_REQUIRED_DEPENDENCY("qpOASES")
1721

1822
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
23+
INCLUDE_DIRECTORIES(${qpOASES_INCLUDEDIR})
1924

2025
SET(${PROJECT_NAME}_HEADERS
2126
include/ddp-actuator-solver/costfunction.hh

examples/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ macro(_local_test_ddp)
33
set(list_var "${ARGN}")
44
foreach(loop_var IN LISTS list_var)
55
ADD_EXECUTABLE(${loop_var} ${loop_var}.cpp)
6-
TARGET_LINK_LIBRARIES(${loop_var} ${PROJECT_NAME})
7-
PKG_CONFIG_USE_DEPENDENCY(${loop_var} qpOASES)
6+
TARGET_LINK_LIBRARIES(${loop_var} ${PROJECT_NAME} ${qpOASES_LIBRARIES})
87
PKG_CONFIG_USE_DEPENDENCY(${loop_var} eigen3)
98
endforeach()
109
endmacro()

private_cmake/FindqpOASES.cmake

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#.rst:
2+
# FindqpOASES
3+
# -----------
4+
#
5+
# Try to find the qpOASES library.
6+
# Once done this will define the following variables::
7+
#
8+
# qpOASES_FOUND - System has qpOASES
9+
# qpOASES_INCLUDE_DIRS - qpOASES include directory
10+
# qpOASES_LIBRARIES - qpOASES libraries
11+
#
12+
# qpOASES does not have an "install" step, and the includes are in the source
13+
# tree, while the libraries are in the build tree.
14+
# Therefore the environment and cmake variables `qpOASES_SOURCE_DIR` and
15+
# `qpOASES_BINARY_DIR` will be used to locate the includes and libraries.
16+
17+
#=============================================================================
18+
# Copyright 2014 iCub Facility, Istituto Italiano di Tecnologia
19+
# Authors: Daniele E. Domenichelli <[email protected]>
20+
#
21+
# Distributed under the OSI-approved BSD License (the "License");
22+
# see accompanying file Copyright.txt for details.
23+
#
24+
# This software is distributed WITHOUT ANY WARRANTY; without even the
25+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26+
# See the License for more information.
27+
#=============================================================================
28+
# (To distribute this file outside of YCM, substitute the full
29+
# License text for the above reference.)
30+
31+
32+
include(FindPackageHandleStandardArgs)
33+
34+
find_path(qpOASES_INCLUDEDIR
35+
NAMES qpOASES.hpp
36+
HINTS "${qpOASES_SOURCE_DIR}"
37+
ENV qpOASES_SOURCE_DIR
38+
PATH_SUFFIXES include)
39+
find_library(qpOASES_LIB
40+
NAMES qpOASES
41+
HINTS "${qpOASES_BINARY_DIR}"
42+
ENV qpOASES_BINARY_DIR
43+
PATH_SUFFIXES lib
44+
libs)
45+
46+
set(qpOASES_INCLUDE_DIRS ${qpOASES_INCLUDEDIR})
47+
set(qpOASES_LIBRARIES ${qpOASES_LIB})
48+
49+
find_package_handle_standard_args(qpOASES DEFAULT_MSG qpOASES_LIBRARIES
50+
qpOASES_INCLUDE_DIRS)
51+
set(qpOASES_FOUND ${QPOASES_FOUND})

0 commit comments

Comments
 (0)