Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] Allow external qpOASES dependency #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
sofa_branch: [master]
sofa_branch: [v24.06]
python_version: ['3.10']

steps:
Expand Down
25 changes: 16 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,33 @@ endif()
set(DOC_FILES README.md)
file(GLOB_RECURSE EXAMPLE_FILES examples "*.pyscn" "*.py" "*.md" "*.psl" "*.pslx" "*.scn" "*.xml")

set(OASES_LIBRARY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/extlibs/qpOASES-3.2.0/")
add_subdirectory(${OASES_LIBRARY_DIRECTORY} extlibs/libqpOASES)
find_package(libqpOASES REQUIRED)
message("libqpOASES_INCLUDE_DIRS = ${libqpOASES_INCLUDE_DIRS}")
include_directories(${libqpOASES_INCLUDE_DIRS})
set(QPOASES_INCLUDE_DIR ${libqpOASES_INCLUDE_DIRS} CACHE INTERNAL "")
sofa_install_libraries(PATHS ${libqpOASES_LIBRARY})

option(SOFTROBOTSINVERSE_INSTALL_HEADERS "Install the headers" ON)
if(SOFTROBOTSINVERSE_INSTALL_HEADERS)
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${DOC_FILES} ${EXAMPLE_FILES} ${HEADER_FILES})
else()
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${DOC_FILES} ${EXAMPLE_FILES} "${SRC_DIR}/component/config.h.in")
endif()

find_package(qpOASES)
if(qpOASES_FOUND)
include_directories(${qpOASES_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${qpOASES_LIBRARIES})
set(QPOASES_INCLUDE_DIR ${qpOASES_INCLUDE_DIRS} CACHE INTERNAL "")
else()
message("External package qpOASES not found, using embedded version...")
set(OASES_LIBRARY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/extlibs/qpOASES-3.2.0/")
add_subdirectory(${OASES_LIBRARY_DIRECTORY} extlibs/libqpOASES)
find_package(libqpOASES REQUIRED)
include_directories(${libqpOASES_INCLUDE_DIRS})
set(QPOASES_INCLUDE_DIR ${libqpOASES_INCLUDE_DIRS} CACHE INTERNAL "")
sofa_install_libraries(PATHS ${libqpOASES_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${libqpOASES_LIBRARY})
endif()

target_link_libraries(${PROJECT_NAME}
SoftRobots
Sofa.Component.Constraint.Lagrangian.Solver
Sofa.Component.Collision.Response.Contact)
target_link_libraries(${PROJECT_NAME} ${libqpOASES_LIBRARY})

# TODO: remove this when SoftRobotsConfig.cmake.in is fixed
message("SOFTROBOTS_HAVE_SOFA_GL = ${SOFTROBOTS_HAVE_SOFA_GL}")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions cmake/Modules/FindqpOASES.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Find the qpOASES includes and libraries.
# The following variables are set if qpOASES is found. If qpOASES is not
# found, qpOASES_FOUND is set to false.
# qpOASES_FOUND - True when the qpOASES include directory is found.
# qpOASES_INCLUDE_DIRS - the path to where the qpOASES include files are.
# qpOASES_LIBRARIES - The libraries to link against qpOASES

include(FindPackageHandleStandardArgs)

find_path(qpOASES_INCLUDE_DIR
NAMES qpOASES.hpp
PATH_SUFFIXES include
)

find_library(qpOASES_LIBRARY
NAMES qpOASES
PATH_SUFFIXES lib
)

set(qpOASES_INCLUDE_DIRS ${qpOASES_INCLUDE_DIR})
set(qpOASES_LIBRARIES ${qpOASES_LIBRARY})

find_package_handle_standard_args(qpOASES DEFAULT_MSG qpOASES_LIBRARIES qpOASES_INCLUDE_DIRS)
62 changes: 0 additions & 62 deletions cmake/modules/FindOASES.cmake

This file was deleted.

Loading