Skip to content

Commit

Permalink
Merge pull request #44 from GiulioRomualdi/feature/update_osqp_depend…
Browse files Browse the repository at this point in the history
…ency

Update osqp dependency. Close #43
  • Loading branch information
GiulioRomualdi authored Jan 28, 2020
2 parents 307f0fe + 85755a3 commit dbca942
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED 11)

project(OsqpEigen
LANGUAGES CXX
VERSION 0.5.1)
VERSION 0.5.2)

# add GNU dirs
include(GNUInstallDirs)
Expand Down Expand Up @@ -83,14 +83,19 @@ add_library(${LIBRARY_TARGET_NAME} ${${LIBRARY_TARGET_NAME}_SRC} ${${LIBRARY_TAR
target_include_directories(${LIBRARY_TARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")

target_link_libraries(${LIBRARY_TARGET_NAME} PRIVATE osqp::osqp Eigen3::Eigen)
target_link_libraries(${LIBRARY_TARGET_NAME} PRIVATE Eigen3::Eigen)
target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC osqp::osqp)

add_library(OsqpEigen::OsqpEigen ALIAS OsqpEigen)

set_target_properties(${LIBRARY_TARGET_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER "${${LIBRARY_TARGET_NAME}_HDR}")

# List exported CMake package dependencies
set(OSQP_EIGEN_EXPORTED_DEPENDENCIES "")
list(APPEND OSQP_EIGEN_EXPORTED_DEPENDENCIES osqp)

install(TARGETS ${LIBRARY_TARGET_NAME}
EXPORT ${PROJECT_NAME}
COMPONENT runtime
Expand All @@ -105,7 +110,7 @@ install_basic_package_files(${PROJECT_NAME}
COMPATIBILITY SameMajorVersion
VARS_PREFIX ${PROJECT_NAME}
NO_CHECK_REQUIRED_COMPONENTS_MACRO
CONFIG_TEMPLATE ${CMAKE_SOURCE_DIR}/cmake/OsqpEigenConfig.cmake.in)
DEPENDENCIES ${OSQP_EIGEN_EXPORTED_DEPENDENCIES})

## Testing
option(BUILD_TESTING "Create tests using CMake" OFF)
Expand Down
12 changes: 0 additions & 12 deletions cmake/OsqpEigenConfig.cmake.in

This file was deleted.

3 changes: 2 additions & 1 deletion example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ set (CMAKE_CXX_STANDARD 11)
project(OsqpEigen-Example)

find_package(OsqpEigen)
find_package(Eigen3)

include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

#MPCExample
add_executable(MPCExample src/MPCExample.cpp)
target_link_libraries(MPCExample OsqpEigen::OsqpEigen osqp::osqp)
target_link_libraries(MPCExample OsqpEigen::OsqpEigen)
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ add_test(NAME SparseMatrixTest

# QPTest
add_executable(QPTest QPTest.cpp)
target_link_libraries(QPTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
target_link_libraries(QPTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
add_test(NAME QPTest
COMMAND QPTest)

# Update matrix
add_executable(UpdateMatricesTest UpdateMatricesTest.cpp)
target_link_libraries(UpdateMatricesTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
target_link_libraries(UpdateMatricesTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
add_test(NAME UpdateMatricesTest
COMMAND UpdateMatricesTest)

# MPCTest
add_executable(MPCTest MPCTest.cpp)
target_link_libraries(MPCTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
target_link_libraries(MPCTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
add_test(NAME MPCTest
COMMAND MPCTest)

# MPCTest update matrix
add_executable(MPCUpdateMatricesTest UpdateMatricesTest.cpp)
target_link_libraries(MPCUpdateMatricesTest OsqpEigen::OsqpEigen osqp::osqp Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
target_link_libraries(MPCUpdateMatricesTest OsqpEigen::OsqpEigen Eigen3::Eigen ${GTEST_LIBRARIES} pthread)
add_test(NAME MPCUpdateMatricesTest
COMMAND MPCUpdateMatricesTest)

0 comments on commit dbca942

Please sign in to comment.