Skip to content
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
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
2 changes: 0 additions & 2 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: update-flake-lock

on:
workflow_dispatch:
schedule:
- cron: '0 4 14 * *'

jobs:
update-flake-inputs:
runs-on: ubuntu-slim
Expand Down
73 changes: 37 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
ci:
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- --ignore
- UP036
- id: ruff-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.0
hooks:
- id: clang-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.26.1
hooks:
- id: gersemi
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.9
hooks:
- id: ruff-check
- id: ruff-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.4
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.2
hooks:
- id: clang-format
args:
- --style=Google
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
204 changes: 118 additions & 86 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,38 @@ option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)

# Project configuration
if(NOT BUILD_STANDALONE_PYTHON_INTERFACE)
set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(PROJECT_USE_CMAKE_EXPORT TRUE)
endif()

# Check if the submodule cmake have been initialized
if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
message(STATUS "JRL cmakemodules found in the source tree.")
set(JRL_CMAKE_MODULES "${CMAKE_SOURCE_DIR}/cmake")
message(STATUS "JRL cmakemodules found in the source tree.")
set(JRL_CMAKE_MODULES "${CMAKE_SOURCE_DIR}/cmake")
else()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
message(
STATUS
"JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}"
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git"
)
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties(
"jrl-cmakemodules"
SOURCE_DIR JRL_CMAKE_MODULES
)
endif()
endif()

# JRL-cmakemodule setup
Expand All @@ -47,95 +55,119 @@ project(${PROJECT_NAME} ${PROJECT_ARGS})

# Dependencies
if(BUILD_PYTHON_INTERFACE)
add_project_dependency(eigenpy REQUIRED)
string(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
set(${PY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${PY_NAME})
add_project_dependency(eigenpy REQUIRED)
string(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
set(${PY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${PY_NAME})
endif()

add_project_dependency(pinocchio REQUIRED)
add_project_dependency(eiquadprog REQUIRED)

if(BUILD_TESTING)
add_project_dependency(example-robot-data REQUIRED)
add_project_dependency(Boost REQUIRED COMPONENTS unit_test_framework)
add_project_dependency(example-robot-data REQUIRED)
add_project_dependency(Boost REQUIRED COMPONENTS unit_test_framework)
endif()

# Main library
if(BUILD_STANDALONE_PYTHON_INTERFACE)
add_project_dependency(${PROJECT_NAME} REQUIRED CONFIG)
add_project_dependency(${PROJECT_NAME} REQUIRED CONFIG)
else()
set(${PROJECT_NAME}_HEADERS
include/${PROJECT_NAME}/arm_ig.hpp #
include/${PROJECT_NAME}/leg_ig.hpp #
include/${PROJECT_NAME}/biped_ig.hpp #
include/${PROJECT_NAME}/dyna_com.hpp #
include/${PROJECT_NAME}/python.hpp #
include/${PROJECT_NAME}/contact6d.hpp #
)
set(${PROJECT_NAME}_SOURCES
src/arm_ig.cpp #
src/leg_ig.cpp #
src/biped_ig.cpp #
src/dyna_com.cpp #
src/contac6d.cpp #
)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen)
target_include_directories(${PROJECT_NAME}
PUBLIC $<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} PUBLIC pinocchio::pinocchio
eiquadprog::eiquadprog)
set(${PROJECT_NAME}_HEADERS
include/${PROJECT_NAME}/arm_ig.hpp #
include/${PROJECT_NAME}/leg_ig.hpp #
include/${PROJECT_NAME}/biped_ig.hpp #
include/${PROJECT_NAME}/dyna_com.hpp #
include/${PROJECT_NAME}/python.hpp #
include/${PROJECT_NAME}/contact6d.hpp #
)
set(${PROJECT_NAME}_SOURCES
src/arm_ig.cpp #
src/leg_ig.cpp #
src/biped_ig.cpp #
src/dyna_com.cpp #
src/contac6d.cpp #
)
add_library(
${PROJECT_NAME}
SHARED
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS}
)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen)
target_include_directories(
${PROJECT_NAME}
PUBLIC $<INSTALL_INTERFACE:include>
)
target_link_libraries(
${PROJECT_NAME}
PUBLIC pinocchio::pinocchio eiquadprog::eiquadprog
)

if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION
${PROJECT_VERSION})
endif()
if(SUFFIX_SO_VERSION)
set_target_properties(
${PROJECT_NAME}
PROPERTIES SOVERSION ${PROJECT_VERSION}
)
endif()
endif()

# Python Bindings
if(BUILD_PYTHON_INTERFACE)
set(${PY_NAME}_SOURCES python/contact_6d.cpp python/aig_modules.cpp
python/dyna_com.cpp python/biped_ig.cpp)
add_library(${PY_NAME}_py SHARED ${${PY_NAME}_SOURCES})
target_link_libraries(${PY_NAME}_py PUBLIC ${PROJECT_NAME}::${PROJECT_NAME}
eigenpy::eigenpy)
get_relative_rpath(${${PY_NAME}_INSTALL_DIR} ${PY_NAME}_INSTALL_RPATH)
set_target_properties(
${PY_NAME}_py
PROPERTIES INSTALL_RPATH "${${PY_NAME}_INSTALL_RPATH}"
LIBRARY_OUTPUT_DIRECTORY ${PY_NAME}
OUTPUT_NAME ${PY_NAME}
PREFIX ""
SUFFIX ${PYTHON_EXT_SUFFIX})
install(TARGETS ${PY_NAME}_py DESTINATION ${${PY_NAME}_INSTALL_DIR})
install(DIRECTORY python/aig DESTINATION ${${PY_NAME}_INSTALL_DIR}/..)
set(${PY_NAME}_SOURCES
python/contact_6d.cpp
python/aig_modules.cpp
python/dyna_com.cpp
python/biped_ig.cpp
)
add_library(${PY_NAME}_py SHARED ${${PY_NAME}_SOURCES})
target_link_libraries(
${PY_NAME}_py
PUBLIC ${PROJECT_NAME}::${PROJECT_NAME} eigenpy::eigenpy
)
get_relative_rpath(${${PY_NAME}_INSTALL_DIR} ${PY_NAME}_INSTALL_RPATH)
set_target_properties(
${PY_NAME}_py
PROPERTIES
INSTALL_RPATH "${${PY_NAME}_INSTALL_RPATH}"
LIBRARY_OUTPUT_DIRECTORY ${PY_NAME}
OUTPUT_NAME ${PY_NAME}
PREFIX ""
SUFFIX ${PYTHON_EXT_SUFFIX}
)
install(TARGETS ${PY_NAME}_py DESTINATION ${${PY_NAME}_INSTALL_DIR})
install(DIRECTORY python/aig DESTINATION ${${PY_NAME}_INSTALL_DIR}/..)
endif()

if(BUILD_TESTING AND NOT BUILD_STANDALONE_PYTHON_INTERFACE)
# Unit-Tests dependencies
set(${PROJECT_NAME}_CPP_TESTS
test_dependencies_usage #
test_leg_ig #
test_arm_ig #
test_biped_ig #
)
# Unit-Tests dependencies
set(${PROJECT_NAME}_CPP_TESTS
test_dependencies_usage #
test_leg_ig #
test_arm_ig #
test_biped_ig #
)

foreach(unittest_name ${${PROJECT_NAME}_CPP_TESTS})
add_unit_test(${unittest_name} tests/${unittest_name}.cpp)
target_link_libraries(
${unittest_name} ${PROJECT_NAME} Boost::unit_test_framework
example-robot-data::example-robot-data)
target_compile_definitions(${unittest_name}
PUBLIC "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN")
endforeach()
foreach(unittest_name ${${PROJECT_NAME}_CPP_TESTS})
add_unit_test(${unittest_name} tests/${unittest_name}.cpp)
target_link_libraries(
${unittest_name}
${PROJECT_NAME}
Boost::unit_test_framework
example-robot-data::example-robot-data
)
target_compile_definitions(
${unittest_name}
PUBLIC "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN"
)
endforeach()
endif()

# Installation
if(NOT BUILD_STANDALONE_PYTHON_INTERFACE)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib
)
endif()
Loading