From dde5720a26b6bdbbe6457919052def916729bc2b Mon Sep 17 00:00:00 2001 From: EulalieCoevoet Date: Tue, 4 Jun 2024 23:48:50 +0200 Subject: [PATCH 1/3] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30491b6..05bb2c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: From 6f5104b8113e6c6378895345d8d4e76efaa72b13 Mon Sep 17 00:00:00 2001 From: Olivier Roussel Date: Fri, 22 Mar 2024 15:01:28 +0100 Subject: [PATCH 2/3] try to find external qpOASES before falling back on embedded version --- CMakeLists.txt | 25 ++++++++++++------- cmake/{modules => Modules}/FindHIDAPI.cmake | 0 cmake/{modules => Modules}/FindROBOTINO.cmake | 0 cmake/{modules => Modules}/FindVRPN.cmake | 0 cmake/Modules/FindqpOASES.cmake | 23 +++++++++++++++++ 5 files changed, 39 insertions(+), 9 deletions(-) rename cmake/{modules => Modules}/FindHIDAPI.cmake (100%) rename cmake/{modules => Modules}/FindROBOTINO.cmake (100%) rename cmake/{modules => Modules}/FindVRPN.cmake (100%) create mode 100644 cmake/Modules/FindqpOASES.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2293121..587c248 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,14 +139,6 @@ 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}) @@ -154,11 +146,26 @@ 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}") diff --git a/cmake/modules/FindHIDAPI.cmake b/cmake/Modules/FindHIDAPI.cmake similarity index 100% rename from cmake/modules/FindHIDAPI.cmake rename to cmake/Modules/FindHIDAPI.cmake diff --git a/cmake/modules/FindROBOTINO.cmake b/cmake/Modules/FindROBOTINO.cmake similarity index 100% rename from cmake/modules/FindROBOTINO.cmake rename to cmake/Modules/FindROBOTINO.cmake diff --git a/cmake/modules/FindVRPN.cmake b/cmake/Modules/FindVRPN.cmake similarity index 100% rename from cmake/modules/FindVRPN.cmake rename to cmake/Modules/FindVRPN.cmake diff --git a/cmake/Modules/FindqpOASES.cmake b/cmake/Modules/FindqpOASES.cmake new file mode 100644 index 0000000..a9706ea --- /dev/null +++ b/cmake/Modules/FindqpOASES.cmake @@ -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) From e0bec8df5c875d06cc422f8b3423c74b0108cc1d Mon Sep 17 00:00:00 2001 From: Olivier Roussel Date: Fri, 22 Mar 2024 15:01:49 +0100 Subject: [PATCH 3/3] remove deprecated FindOASES.cmake --- cmake/modules/FindOASES.cmake | 62 ----------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 cmake/modules/FindOASES.cmake diff --git a/cmake/modules/FindOASES.cmake b/cmake/modules/FindOASES.cmake deleted file mode 100644 index bcddfd3..0000000 --- a/cmake/modules/FindOASES.cmake +++ /dev/null @@ -1,62 +0,0 @@ -# Find the OASES includes and libraries. -# The following variables are set if OASES is found. If OASES is not -# found, OASES_FOUND is set to false. -# OASES_FOUND - True when the OASES include directory is found. -# OASES_INCLUDE_DIRS - the path to where the OASES include files are. -# OASES_LIBRARY_DIRS - The path to where the OASES library files are. -# OASES_LIBRARIES - The libraries to link against OASES - -# One may want to use a specific OASES Library by setting -# OASES_LIBRARY_DIRECTORY before FIND_PACKAGE(OASES) -INCLUDE(FindPackageHandleStandardArgs) - -IF(APPLE) - set (extension ".dylib") -ELSEIF(WIN32) - set (extension ".lib") #On Windows, load-time dynamic linking links to the .lib before using the dll at runtime -ELSE(WIN32) - set (extension ".so") -ENDIF(APPLE) - -IF(OASES_LIBRARY_DIRECTORY) - MESSAGE(STATUS "Looking for OASES library libqpOASES${extension} in ${OASES_LIBRARY_DIRECTORY}bin/") - FIND_LIBRARY(OASES_LIBRARY libqpOASES${extension} PATHS "${OASES_LIBRARY_DIRECTORY}bin/" NO_DEFAULT_PATH) - IF(OASES_LIBRARY) - MESSAGE(STATUS "Found : OASES_LIBRARY") - ENDIF(OASES_LIBRARY) -ELSE(OASES_LIBRARY_DIRECTORY) - FIND_LIBRARY(OASES_LIBRARY libqpOASES${extension} PATHS ENV LD_LIBRARY_PATH ENV DYLD_LIBRARY_PATH) -ENDIF(OASES_LIBRARY_DIRECTORY) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(qpOASES - REQUIRED_VARS OASES_LIBRARY) - - -IF(OASES_LIBRARY) - SET(OASES_LIBRARIES ${OASES_LIBRARY}) - GET_FILENAME_COMPONENT(OASES_LIBRARY_NAME ${OASES_LIBRARY} NAME) - GET_FILENAME_COMPONENT(OASES_LIBRARY_DIRS ${OASES_LIBRARY} PATH) - GET_FILENAME_COMPONENT(OASES_LIBRARY_DIRS_DIR ${OASES_LIBRARY_DIRS} PATH) - GET_FILENAME_COMPONENT(OASES_LIBRARY_DIRS_DIR_DIR ${OASES_LIBRARY_DIRS_DIR} PATH) - - FIND_PATH(OASES_INCLUDE_DIRS qpOASES.hpp - HINTS ${OASES_LIBRARY_DIRS_DIR} ${OASES_LIBRARY_DIRS_DIR_DIR} - ENV PATH - PATH_SUFFIXES include) - - IF(NOT OASES_INCLUDE_DIRS) - IF(OASES_FIND_REQUIRED) - MESSAGE(FATAL_ERROR - "Required OASES headers not found. Please specify headers location in CMAKE_INCLUDE_PATH") - ENDIF(OASES_FIND_REQUIRED) - ELSE(NOT OASES_INCLUDE_DIRS) - SET(OASES_FOUND TRUE) - ENDIF(NOT OASES_INCLUDE_DIRS) - -ELSE(OASES_LIBRARY) - SET(OASES_FOUND FALSE) - IF(OASES_FIND_REQUIRED) - MESSAGE(FATAL_ERROR - "Required OASES library not found. Please specify library location in OASES_LIBRARY_DIRECTORY") - ENDIF(OASES_FIND_REQUIRED) -ENDIF(OASES_LIBRARY)