Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Fix osqp_interface dependencies #66

Merged
merged 2 commits into from
Nov 2, 2020
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
20 changes: 10 additions & 10 deletions common/math/osqp_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ endif()
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)

find_package(osqp_vendor REQUIRED)

find_package(osqp REQUIRED)
get_target_property(OSQP_INCLUDE_DIR osqp::osqpstatic INTERFACE_INCLUDE_DIRECTORIES)

set(EXTERNAL_INCLUDE_DIRS
"${EIGEN3_INCLUDE_DIR}"
"${OSQP_INCLUDE_DIR}"
)

ament_auto_add_library(osqp_interface
ament_auto_add_library(osqp_interface STATIC
src/osqp_interface.cpp
src/csc_matrix_conv.cpp
include/osqp_interface/osqp_interface.h
include/osqp_interface/csc_matrix_conv.h
)
target_link_libraries(osqp_interface osqp::osqpstatic)

target_include_directories(osqp_interface PUBLIC "${EXTERNAL_INCLUDE_DIRS}")
# needed so clients of this package don't need to worry about includes of this package
ament_export_include_directories("${EXTERNAL_INCLUDE_DIRS}")
target_include_directories(osqp_interface PUBLIC "${OSQP_INCLUDE_DIR}")
ament_target_dependencies(osqp_interface Eigen3)
ament_target_dependencies(osqp_interface osqp_vendor)

# crucial so downstream package builds because osqp_interface exposes osqp.h
ament_export_include_directories("${OSQP_INCLUDE_DIR}")
# crucial so the linking order is correct in a downstream package: libosqp_interface.a should come before libosqp.a
ament_export_libraries(osqp::osqpstatic)

ament_auto_package()
6 changes: 4 additions & 2 deletions common/math/osqp_interface/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
<license>Apache 2</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>eigen3_cmake_module</buildtool_depend>
<buildtool_export_depend>eigen3_cmake_module</buildtool_export_depend>
<build_depend>eigen</build_depend>
<build_export_depend>eigen</build_export_depend>

<depend>osqp_vendor</depend>

<export>
<build_type>ament_cmake</build_type>
</export>

<depend>rclcpp</depend>
</package>