Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jcarpent/eigenpy
  • gsaurel/eigenpy
  • stack-of-tasks/eigenpy
3 results
Show changes
Commits on Source (681)
Showing
with 1435 additions and 295 deletions
BasedOnStyle: Google
SortIncludes: false
Standard: Cpp03
# pre-commit run -a (Guilhem Saurel, 2022-07-27)
4af05ec6781f9da65b81af8e3af8d69213f99e85
# pre-commit run -a (Guilhem Saurel, 2024-02-17)
48fb48c83f0456de2fb612ef55df8ad789824d87
# pre-commit run -a (Guilhem Saurel, 2024-02-19)
0bae435330ee475f8dbb11bf5e672284d294d9b3
# GitHub syntax highlighting
pixi.lock linguist-language=YAML
name: CI - Check-changelog
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled, edited]
branches:
- devel
jobs:
check-changelog:
name: Check changelog action
runs-on: ubuntu-latest
steps:
- uses: tarides/changelog-check-action@v2
with:
changelog: CHANGELOG.md
name: eigenpy
channels:
- conda-forge
- defaults
dependencies:
- eigen
- cmake
- numpy
- pkg-config
- boost
name: JRL-cmakemodules
on: [push,pull_request]
name: CI - JRL-cmakemodules
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
with-submodules:
......@@ -9,7 +31,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- run: sudo apt install libboost-all-dev libeigen3-dev python3-numpy
- run: sudo apt install libboost-all-dev libeigen3-dev python3-numpy python3-scipy
- run: cmake .
......@@ -20,5 +42,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: false
- run: sudo apt install libboost-all-dev libeigen3-dev python3-numpy
- run: cmake .
path: eigenpy
- run: sudo apt install libboost-all-dev libeigen3-dev python3-numpy python3-scipy
- run: cmake -B build -S eigenpy
- run: grep -qvz CMAKE_PROJECT_VERSION:STATIC=0.0 build/CMakeCache.txt
name: Check build on linux
name: CI - Linux via APT
on: ["push", "pull_request"]
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
......@@ -9,17 +30,31 @@ jobs:
strategy:
matrix:
python: [3]
ubuntu: [18, 20, 22]
include:
- ubuntu: 18
python: 2
ubuntu: [20, 22]
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- run: |
sudo apt-get update
sudo apt-get install cmake libboost-all-dev libeigen3-dev python*-numpy python*-dev
- run: cmake -DPYTHON_EXECUTABLE=$(which python${{ matrix.python }}) .
sudo apt-get install cmake libboost-all-dev libeigen3-dev python*-numpy python*-dev python*-scipy
echo $(sudo apt list --installed)
echo $(g++ --version)
- run: cmake . -DPYTHON_EXECUTABLE=$(which python${{ matrix.python }}) -DBUILD_TESTING_SCIPY=ON
- run: make -j2
- run: make test
- run: ctest --output-on-failure
check:
if: always()
name: check-linux
needs:
- test
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
name: Conda-CI
on: [push,pull_request]
jobs:
eigenpy-conda:
name: ${{ matrix.os }} - ${{ matrix.build_type }} ${{ matrix.cxx_options }}
runs-on: ${{ matrix.os }}
env:
CCACHE_DIR: /github/home/.ccache # Enable ccache
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
cxx_options: ['', '-mavx2']
build_type: [Release, Debug]
exclude:
- build_type: Debug
cxx_options: -mavx2
os: macos-latest
- build_type: Release
cxx_options: -mavx2
os: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: eigenpy
auto-update-conda: true
environment-file: .github/workflows/conda/environment.yml
python-version: '3.10'
- uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.cxx_options }}
- name: Install cmake and update conda
shell: bash -l {0}
run: |
conda activate eigenpy
conda install cmake -c main
conda list
- name: Build EigenPy
shell: bash -l {0}
run: |
conda activate eigenpy
echo $CONDA_PREFIX
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3) -DGENERATE_PYTHON_STUBS=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS=${{ matrix.cxx_options }}
make
make build_tests
export CTEST_OUTPUT_ON_FAILURE=1
make test
make install
- name: Test packaging
shell: bash -l {0}
run: |
conda activate eigenpy
cmake -B test-packaging -S unittest/packaging/cmake -DPYTHON_EXECUTABLE=$(which python3)
- name: Configure hpp-fcl
shell: bash -l {0}
run: |
conda activate eigenpy
conda install -c conda-forge octomap assimp qhull
git clone https://github.com/humanoid-path-planner/hpp-fcl.git --recursive
cd hpp-fcl
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3)
- name: Uninstall EigenPy
shell: bash -l {0}
run: |
cd build
make uninstall
name: CI - MacOS/Linux/Windows via Pixi
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
eigenpy-pixi:
name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.cxx_options }} ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
env:
CCACHE_BASEDIR: "${GITHUB_WORKSPACE}"
CCACHE_DIR: "${GITHUB_WORKSPACE}/.ccache"
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 6
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-13]
environment: [all, all-py39]
build_type: [Release, Debug]
cxx_options: ['', '-mavx2']
exclude:
- os: macos-latest
cxx_options: '-mavx2'
- os: macos-13
cxx_options: '-mavx2'
include:
- os: windows-latest
environment: all
cxx_options: ''
build_type: Release
- os: windows-latest
environment: all-clang-cl
cxx_options: ''
build_type: Release
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
with:
path: .ccache
key: ccache-macos-linux-windows-pixi-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.cxx_options }}-${{ matrix.environment }}-${{ github.sha }}
restore-keys: ccache-macos-linux-windows-pixi-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.cxx_options }}-${{ matrix.environment }}-
- uses: prefix-dev/setup-pixi@v0.8.1
with:
cache: true
environments: ${{ matrix.environment }}
- name: Build EigenPy [MacOS/Linux/Windows]
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
EIGENPY_BUILD_TYPE: ${{ matrix.build_type }}
EIGENPY_CXX_FLAGS: ${{ matrix.cxx_options }}
run: |
pixi run -e ${{ matrix.environment }} test
check:
if: always()
name: check-macos-linux-windows-pixi
needs:
- eigenpy-pixi
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
name: "CI - Nix"
on:
push:
jobs:
nix:
runs-on: "${{ matrix.os }}-latest"
strategy:
matrix:
os: [ubuntu, macos]
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L
name: Ensure relocatable
name: CI - Ensure relocatable
on: [push,pull_request]
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
relocatable:
......@@ -30,7 +51,7 @@ jobs:
run: git -C /RELOC/SRC clone --recursive $(pwd)
- name: install dependencies
run: sudo apt install libboost-all-dev libeigen3-dev python-is-python3 python3-numpy python3-pip ccache
run: sudo apt install libboost-all-dev libeigen3-dev python-is-python3 python3-numpy python3-pip python3-scipy ccache
- name: update CMake
run: pip install -U pip && pip install -U cmake
......
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)
name: ROS-CI
name: CI - Linux via ROS
# This determines when this workflow is run
on: [push, pull_request] # on all pushes and PRs
on:
push:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
pull_request:
paths-ignore:
- 'doc/**'
- '.gitlab-ci.yml'
- '.gitignore'
- '*.md'
- 'LICENSE'
- 'colcon.pkg'
- '.pre-commit-config.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
CI:
strategy:
matrix:
env:
- {ROS_DISTRO: melodic, PRERELEASE: false}
# ROS1
- {ROS_DISTRO: noetic}
- {ROS_DISTRO: foxy}
- {ROS_DISTRO: rolling}
# ROS2
- {ROS_DISTRO: iron}
- {ROS_DISTRO: humble}
- {ROS_DISTRO: jazzy}
- {ROS_DISTRO: rolling}
env:
CCACHE_DIR: /github/home/.ccache # Enable ccache
PRERELEASE: true
# PRERELEASE: true # Fails due to issues in the underlying Docker image
BUILDER: colcon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
# This step will fetch/store the directory used by ccache before/after the ci run
- uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}
- name: Echo CCACHE_DIR
shell: bash -l {0}
env: ${{ matrix.env }}
run: |
echo CCACHE_DIR=${CCACHE_DIR}
- name: Echo CCACHE_DIR
shell: bash -l {0}
run: |
echo CCACHE_DIR=${CCACHE_DIR}
# Run industrial_ci
- uses: 'ros-industrial/industrial_ci@6a8f546cbd31fbd5c9f77e3409265c8b39abc3d6'
- uses: 'ros-industrial/industrial_ci@875c2aebfd634eebaa84dbe5198f2fdb4c5f1b7e'
env: ${{ matrix.env }}
check:
if: always()
name: check-ros-ci
needs:
- CI
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
name: update-flake-lock
on:
workflow_dispatch:
schedule:
- cron: '0 15 3 * *'
jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@main
with:
pr-labels: "no changelog"
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
name: CI - Update Pixi lockfile
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch:
schedule:
- cron: 0 5 1 * *
jobs:
pixi-update:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
ref: devel
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
persist-credentials: false
- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
run-install: false
- name: Update lockfile
run: |
set -o pipefail
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: 'pixi: Update pixi lockfile'
title: Update pixi lockfile
body-path: diff.md
branch: topic/update-pixi
base: devel
labels: |
pixi
no changelog
delete-branch: true
add-paths: pixi.lock
name: Build Eigenpy on Windows via Conda
on: [push,pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v3
- name: Checkout submodules
run: |
git submodule update --init
- uses: goanpeca/setup-miniconda@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
activate-environment: eigenpy
environment-file: .github/workflows/conda/environment.yml
python-version: 3.7
- name: Build Eigenpy
shell: cmd /C CALL {0}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
:: unset extra Boost envs
set Boost_ROOT=
set BOOST_ROOT_1_69_0=
set BOOST_ROOT_1_72_0=
set PATH=%PATH:C:\hostedtoolcache\windows\Boost\1.72.0;=%
if errorlevel 1 exit 1
:: start building
call "%programfiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
if errorlevel 1 exit 1
mkdir build
pushd build
cmake ^
-G "NMake Makefiles" ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DGENERATE_PYTHON_STUBS=ON ^
-DPYTHON_SITELIB=%CONDA_PREFIX%\Lib\site-packages ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
..
if errorlevel 1 exit 1
:: Build and Install
cmake --build . --config Release --target install
if errorlevel 1 exit 1
:: Build stubs
git clone https://github.com/jcarpent/pybind11-stubgen.git
python "%CD%\pybind11-stubgen\pybind11_stubgen\__init__.py" -o %CONDA_PREFIX%\Lib\site-packages\eigenpy eigenpy --boost-python --ignore-invalid signature --no-setup-py --root-module-suffix ""
if errorlevel 1 exit 1
:: Testing
ctest --output-on-failure -C Release -V
if errorlevel 1 exit 1
:: Test Python import
cd ..
python -c "import eigenpy"
if errorlevel 1 exit 1
:: Test packaging
cmake -B test-packaging -S unittest/packaging/cmake ^
-G "NMake Makefiles" ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe
if errorlevel 1 exit 1
:: Configure hpp-fcl
conda install -c conda-forge octomap assimp qhull
git clone --recursive https://github.com/humanoid-path-planner/hpp-fcl.git
pushd hpp-fcl
mkdir build
pushd build
cmake ^
-G "NMake Makefiles" ^
-DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^
-DCMAKE_BUILD_TYPE=Release ^
-DPYTHON_EXECUTABLE=%CONDA_PREFIX%\python.exe ^
..
cd ..
if errorlevel 1 exit 1
:: Uninstall
cmake --build . --config Release --target uninstall
if errorlevel 1 exit 1
*~
*build*
*build*/
# pixi environments
.pixi
ci:
autoupdate_branch: 'devel'
autoupdate_branch: devel
autofix_prs: false
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
hooks:
- id: clang-format
args: ['--style={BasedOnStyle: Google, SortIncludes: false, Standard: Cpp03}']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
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/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
exclude: pixi.toml
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.6
hooks:
- id: clang-format
args:
- '--style={BasedOnStyle: Google, SortIncludes: false, Standard: Cpp03}'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
This diff is collapsed.
......@@ -2,7 +2,7 @@
# Copyright (c) 2014-2019 CNRS Copyright (c) 2018-2023 INRIA
#
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)
set(PROJECT_NAME eigenpy)
set(PROJECT_DESCRIPTION "Bindings between Numpy and Eigen using Boost.Python")
......@@ -11,14 +11,30 @@ set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
set(PROJECT_COMPATIBILITY_VERSION AnyNewerVersion)
# To enable jrl-cmakemodules compatibility with workspace we must define the two
# following lines
set(PROJECT_AUTO_RUN_FINALIZE FALSE)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
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}")
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(
FATAL_ERROR
"\nPlease run the following command first:\ngit submodule update --init\n"
"\nCan't find jrl-cmakemodules. Please either:\n"
" - use git submodule: 'git submodule update --init'\n"
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
......@@ -31,6 +47,14 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
endif()
endif()
function(set_standard_output_directory target)
set_target_properties(
${target}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
endfunction()
# Disable -Werror on Unix for now.
set(CXX_DISABLE_WERROR True)
set(CMAKE_VERBOSE_MAKEFILE True)
......@@ -41,16 +65,30 @@ set(CMAKE_VERBOSE_MAKEFILE True)
# ----------------------------------------------------
option(INSTALL_DOCUMENTATION "Generate and install the documentation" OFF)
option(SUFFIX_SO_VERSION "Suffix library name with its version" OFF)
option(BUILD_TESTING_SCIPY
"Build the SciPy tests (scipy should be installed on the machine)" ON)
if(DEFINED BUILD_UNIT_TESTS)
message(
AUTHOR_WARNING
"BUILD_UNIT_TESTS is deprecated. Use BUILD_TESTING instead.\
If you are manually building EigenPy from source in an existing build folder,\
we suggest that you delete your build folder and make a new one.")
set(BUILD_TESTING ${BUILD_UNIT_TESTS})
endif(DEFINED BUILD_UNIT_TESTS)
# ----------------------------------------------------
# --- Policy -----------------------------------------
# CMake Policy setup
# ----------------------------------------------------
# Policy can be removed when cmake_minimum_required is updated.
# We also set CMAKE_POLICY_DEFAULT_CMPXXXX because CMake modules can reset
# policy and redefine some macros like `find_dependency` that will not use our
# policy.
# Use BoostConfig module distributed by boost library instead of using FindBoost
# module distributed by CMake (to remove in 3.30).
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0167 NEW)
endif()
# install() DESTINATION paths are normalized (to remove in 3.31).
if(POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0177 NEW)
endif()
include("${JRL_CMAKE_MODULES}/base.cmake")
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})
......@@ -63,10 +101,20 @@ include("${JRL_CMAKE_MODULES}/apple.cmake")
option(GENERATE_PYTHON_STUBS
"Generate the Python stubs associated to the Python library" OFF)
option(BUILD_WITH_CHOLMOD_SUPPORT "Build EigenPy with the Cholmod support" OFF)
if(APPLE)
option(BUILD_WITH_ACCELERATE_SUPPORT
"Build EigenPy with the Accelerate support" OFF)
else(APPLE)
set(BUILD_WITH_ACCELERATE_SUPPORT FALSE)
endif(APPLE)
string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# If needed, fix CMake policy for APPLE systems
apply_default_apple_configuration()
check_minimal_cxx_standard(11 ENFORCE)
if(WIN32)
set(LINK copy_if_different)
......@@ -105,12 +153,45 @@ export_boost_default_options()
find_package(Boost REQUIRED)
search_for_boost_python(REQUIRED)
if(BUILD_WITH_CHOLMOD_SUPPORT)
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/CHOLMOD
${CMAKE_MODULE_PATH})
add_project_dependency(CHOLMOD REQUIRED FIND_EXTERNAL "CHOLMOD")
message(
STATUS
"Build with CHOLDOD support (LGPL). See CHOLMOD/Doc/License.txt for further details."
)
add_definitions(-DEIGENPY_WITH_CHOLMOD_SUPPORT)
endif(BUILD_WITH_CHOLMOD_SUPPORT)
if(BUILD_WITH_ACCELERATE_SUPPORT)
if(NOT ${Eigen3_VERSION} VERSION_GREATER_EQUAL "3.4.90")
message(
FATAL_ERROR
"Your version of Eigen is too low. Should be at least 3.4.90. Current version is ${Eigen3_VERSION}."
)
endif()
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/Accelerate
${CMAKE_MODULE_PATH})
find_package(
Accelerate REQUIRED # FIND_EXTERNAL "Accelerate" # We don't export yet as
# there might be an issue on AMR64 platforms
)
message(STATUS "Build with Accelerate support framework.")
add_definitions(-DEIGENPY_WITH_ACCELERATE_SUPPORT)
endif(BUILD_WITH_ACCELERATE_SUPPORT)
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
set(${PROJECT_NAME}_UTILS_HEADERS
include/eigenpy/utils/scalar-name.hpp include/eigenpy/utils/is-approx.hpp
include/eigenpy/utils/is-aligned.hpp)
include/eigenpy/utils/scalar-name.hpp
include/eigenpy/utils/is-approx.hpp
include/eigenpy/utils/is-aligned.hpp
include/eigenpy/utils/traits.hpp
include/eigenpy/utils/python-compat.hpp
include/eigenpy/utils/empty-visitor.hpp)
set(${PROJECT_NAME}_SOLVERS_HEADERS
include/eigenpy/solvers/solvers.hpp
......@@ -122,20 +203,57 @@ set(${PROJECT_NAME}_SOLVERS_HEADERS
include/eigenpy/solvers/BasicPreconditioners.hpp
include/eigenpy/solvers/BFGSPreconditioners.hpp)
set(${PROJECT_NAME}_EIGEN_HEADERS include/eigenpy/eigen/EigenBase.hpp)
set(${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_CHOLMOD_HEADERS
include/eigenpy/decompositions/sparse/cholmod/CholmodBase.hpp
include/eigenpy/decompositions/sparse/cholmod/CholmodDecomposition.hpp
include/eigenpy/decompositions/sparse/cholmod/CholmodSimplicialLDLT.hpp
include/eigenpy/decompositions/sparse/cholmod/CholmodSimplicialLLT.hpp
include/eigenpy/decompositions/sparse/cholmod/CholmodSupernodalLLT.hpp)
set(${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_ACCELERATE_HEADERS
include/eigenpy/decompositions/sparse/accelerate/accelerate.hpp)
set(${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_HEADERS
include/eigenpy/decompositions/sparse/LLT.hpp
include/eigenpy/decompositions/sparse/LDLT.hpp
include/eigenpy/decompositions/sparse/SimplicialCholesky.hpp
include/eigenpy/decompositions/sparse/SparseSolverBase.hpp)
if(BUILD_WITH_CHOLMOD_SUPPORT)
list(APPEND ${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_HEADERS
${${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_CHOLMOD_HEADERS})
endif(BUILD_WITH_CHOLMOD_SUPPORT)
if(BUILD_WITH_ACCELERATE_SUPPORT)
list(APPEND ${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_HEADERS
${${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_ACCELERATE_HEADERS})
endif(BUILD_WITH_ACCELERATE_SUPPORT)
set(${PROJECT_NAME}_DECOMPOSITIONS_HEADERS
${${PROJECT_NAME}_DECOMPOSITIONS_SPARSE_HEADERS}
include/eigenpy/decompositions/decompositions.hpp
include/eigenpy/decompositions/EigenSolver.hpp
include/eigenpy/decompositions/PermutationMatrix.hpp
include/eigenpy/decompositions/LDLT.hpp
include/eigenpy/decompositions/LLT.hpp
include/eigenpy/decompositions/QR.hpp
include/eigenpy/decompositions/HouseholderQR.hpp
include/eigenpy/decompositions/ColPivHouseholderQR.hpp
include/eigenpy/decompositions/CompleteOrthogonalDecomposition.hpp
include/eigenpy/decompositions/FullPivHouseholderQR.hpp
include/eigenpy/decompositions/SelfAdjointEigenSolver.hpp
include/eigenpy/decompositions/minres.hpp)
set(${PROJECT_NAME}_HEADERS
${${PROJECT_NAME}_UTILS_HEADERS}
${${PROJECT_NAME}_SOLVERS_HEADERS}
${${PROJECT_NAME}_EIGEN_HEADERS}
${${PROJECT_NAME}_DECOMPOSITIONS_HEADERS}
include/eigenpy/alignment.hpp
include/eigenpy/computation-info.hpp
include/eigenpy/deprecation-policy.hpp
include/eigenpy/eigenpy.hpp
include/eigenpy/exception.hpp
include/eigenpy/scalar-conversion.hpp
......@@ -147,25 +265,37 @@ set(${PROJECT_NAME}_HEADERS
include/eigenpy/eigen-to-python.hpp
include/eigenpy/eigen-from-python.hpp
include/eigenpy/eigen-typedef.hpp
include/eigenpy/id.hpp
include/eigenpy/numpy-map.hpp
include/eigenpy/geometry.hpp
include/eigenpy/geometry-conversion.hpp
include/eigenpy/map.hpp
include/eigenpy/memory.hpp
include/eigenpy/numpy.hpp
include/eigenpy/numpy-allocator.hpp
include/eigenpy/numpy-type.hpp
include/eigenpy/registration.hpp
include/eigenpy/registration_class.hpp
include/eigenpy/angle-axis.hpp
include/eigenpy/quaternion.hpp
include/eigenpy/user-type.hpp
include/eigenpy/ufunc.hpp
include/eigenpy/register.hpp
include/eigenpy/std-array.hpp
include/eigenpy/std-map.hpp
include/eigenpy/std-pair.hpp
include/eigenpy/std-vector.hpp
include/eigenpy/optional.hpp
include/eigenpy/pickle-vector.hpp
include/eigenpy/stride.hpp
include/eigenpy/tensor/eigen-from-python.hpp
include/eigenpy/sparse/eigen-from-python.hpp
include/eigenpy/scipy-allocator.hpp
include/eigenpy/scipy-type.hpp
include/eigenpy/variant.hpp
include/eigenpy/std-unique-ptr.hpp
include/eigenpy/swig.hpp
include/eigenpy/type_info.hpp
include/eigenpy/version.hpp)
list(
......@@ -182,7 +312,27 @@ set(${PROJECT_NAME}_SOLVERS_SOURCES src/solvers/preconditioners.cpp
src/solvers/solvers.cpp)
set(${PROJECT_NAME}_DECOMPOSITIONS_SOURCES
src/decompositions/decompositions.cpp)
src/decompositions/decompositions.cpp
src/decompositions/eigen-solver.cpp
src/decompositions/llt-solver.cpp
src/decompositions/ldlt-solver.cpp
src/decompositions/minres-solver.cpp
src/decompositions/qr-solvers.cpp
src/decompositions/eigen-solver.cpp
src/decompositions/self-adjoint-eigen-solver.cpp
src/decompositions/permutation-matrix.cpp
src/decompositions/simplicial-llt-solver.cpp
src/decompositions/simplicial-ldlt-solver.cpp)
if(BUILD_WITH_CHOLMOD_SUPPORT)
list(APPEND ${PROJECT_NAME}_DECOMPOSITIONS_SOURCES
src/decompositions/cholmod.cpp)
endif(BUILD_WITH_CHOLMOD_SUPPORT)
if(BUILD_WITH_ACCELERATE_SUPPORT)
list(APPEND ${PROJECT_NAME}_DECOMPOSITIONS_SOURCES
src/decompositions/accelerate.cpp)
endif(BUILD_WITH_ACCELERATE_SUPPORT)
set(${PROJECT_NAME}_SOURCES
${${PROJECT_NAME}_SOLVERS_SOURCES}
......@@ -199,20 +349,39 @@ set(${PROJECT_NAME}_SOURCES
src/matrix-long-double.cpp
src/matrix-complex-long-double.cpp
src/matrix-bool.cpp
src/matrix-int.cpp
src/matrix-long.cpp
src/matrix-char.cpp
src/matrix-int8.cpp
src/matrix-uint8.cpp
src/matrix-int16.cpp
src/matrix-uint16.cpp
src/matrix-int32.cpp
src/matrix-uint32.cpp
src/matrix-windows-long.cpp
src/matrix-windows-ulong.cpp
src/matrix-mac-long.cpp
src/matrix-mac-ulong.cpp
src/matrix-int64.cpp
src/matrix-uint64.cpp
src/matrix-linux-long-long.cpp
src/matrix-linux-ulong-long.cpp
src/angle-axis.cpp
src/quaternion.cpp
src/geometry-conversion.cpp
src/scipy-type.cpp
src/std-vector.cpp
src/optional.cpp
src/type_info.cpp
src/version.cpp)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
set_standard_output_directory(${PROJECT_NAME})
target_include_directories(
${PROJECT_NAME} SYSTEM
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
modernize_target_link_libraries(
${PROJECT_NAME}
......@@ -233,17 +402,30 @@ modernize_target_link_libraries(
${NUMPY_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIR})
# Links against CholMod
if(BUILD_WITH_CHOLMOD_SUPPORT)
modernize_target_link_libraries(${PROJECT_NAME} SCOPE PUBLIC TARGETS
CHOLMOD::CHOLMOD)
endif(BUILD_WITH_CHOLMOD_SUPPORT)
# Links against accelerate
if(BUILD_WITH_ACCELERATE_SUPPORT)
# modernize_target_link_libraries(${PROJECT_NAME} SCOPE PUBLIC TARGETS
# Accelerate)
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework accelerate")
endif(BUILD_WITH_ACCELERATE_SUPPORT)
if(SUFFIX_SO_VERSION)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
endif(SUFFIX_SO_VERSION)
if(NOT WIN32)
target_compile_options(
${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>
${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj -MP>
"-Wno-conversion")
else()
target_compile_options(${PROJECT_NAME}
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>)
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj -MP>)
target_compile_definitions(${PROJECT_NAME} PUBLIC "HAVE_SNPRINTF")
endif()
......@@ -263,29 +445,6 @@ add_source_group(${PROJECT_NAME}_SOURCES)
# Install package for ROS
install(FILES package.xml DESTINATION share/eigenpy)
# Allows Colcon to find non-Ament packages when using workspace underlays
file(
WRITE
${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME}
"")
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME}
DESTINATION share/ament_index/resource_index/packages)
file(
WRITE
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv
"prepend-non-duplicate;AMENT_PREFIX_PATH;")
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv
DESTINATION share/${PROJECT_NAME}/hook)
file(WRITE
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
"prepend-non-duplicate;PYTHONPATH;${PYTHON_SITELIB}")
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
DESTINATION share/${PROJECT_NAME}/hook)
# ----------------------------------------------------
# --- PYTHON LIBRARY ---------------------------------
......@@ -301,3 +460,5 @@ pkg_config_append_libs(${PROJECT_NAME})
pkg_config_append_cflags("-I${PYTHON_INCLUDE_DIRS}")
pkg_config_append_cflags("-I${NUMPY_INCLUDE_DIRS}")
pkg_config_append_boost_libs(${BOOST_COMPONENTS})
setup_project_finalize()
BSD 2-Clause License
Copyright (c) 2014-2020, CNRS
Copyright (c) 2018-2023, INRIA
Copyright (c) 2018-2025, INRIA
All rights reserved.
Redistribution and use in source and binary forms, with or without
......