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
7 changes: 4 additions & 3 deletions .github/workflows/ci-ubuntu-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: pycppad
auto-update-conda: true
environment-file: .github/workflows/conda/conda-env.yml
python-version: 3.8
auto-update-conda: true
auto-activate-base: false
conda-remove-defaults: true

- name: Build PyCppAD
shell: bash -el {0}
Expand All @@ -50,7 +51,7 @@ jobs:
-DPYTHON_EXECUTABLE=$(which python3) \
-DBUILD_WITH_CPPAD_CODEGEN_BINDINGS=ON
ninja -j1
ctest --output-on-failure -C Release -V
ctest --output-on-failure
ninja install

- name: Uninstall PyCppAD
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ env:

jobs:
build:
name: build (${{ matrix.os }}, ${{ matrix.compiler.name }}, ${{ matrix.compiler.cppad_codegen }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
fail-fast: false
matrix:
os: [windows-latest]
compiler:
- cmd: cl
- name: cl
cmd: cl
cppad_codegen: OFF
- cmd: clang-cl
- name: clang-cl
cmd: '%CONDA_PREFIX%\\Library\\bin\\clang-cl'
cppad_codegen: ON

steps:
Expand All @@ -28,11 +31,12 @@ jobs:

- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: pycppad
auto-update-conda: true
environment-file: .github/workflows/conda/conda-env.yml
python-version: 3.8
auto-update-conda: true
auto-activate-base: false
conda-remove-defaults: true

- name: Build PyCppAD
shell: cmd /C CALL {0}
Expand Down Expand Up @@ -62,7 +66,7 @@ jobs:
ninja -j1

:: Testing
ctest --output-on-failure -C Release -V
ctest --output-on-failure

:: Test Python import
ninja install
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/conda/conda-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ name: pycppad
channels:
- conda-forge
dependencies:
- boost
- libboost-devel
- libboost-python-devel
- eigenpy
- python
- cppad
- cppadcodegen
- ninja
- cmake
- pkg-config
- ninja
- cxx-compiler
- clangxx
- doxygen
24 changes: 4 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2021-2023 INRIA
#

CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
CMAKE_MINIMUM_REQUIRED(VERSION 3.22)

SET(PROJECT_NAME pycppad)
SET(PROJECT_DESCRIPTION "Python bindings for CppAD and CppADCodeGen using Boost.Python")
Expand All @@ -21,11 +21,7 @@ SET(CMAKE_VERBOSE_MAKEFILE TRUE)
SET(CXX_DISABLE_WERROR TRUE)

# Check if the submodule cmake have been initialized
SET(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
IF(NOT EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
MESSAGE(FATAL_ERROR "\nPlease run the following command first:\ngit submodule update --init\n")
ENDIF()

set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
else()
Expand All @@ -36,13 +32,6 @@ else()
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
"\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.")
include(FetchContent)
Expand All @@ -63,8 +52,6 @@ INCLUDE(${JRL_CMAKE_MODULES}/boost.cmake)
INCLUDE(${JRL_CMAKE_MODULES}/ide.cmake)
INCLUDE(${JRL_CMAKE_MODULES}/python.cmake)

SET(CMAKE_MODULE_PATH "${JRL_CMAKE_MODULES}/find-external/CppAD/" ${CMAKE_MODULE_PATH})

# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
Expand All @@ -79,11 +66,11 @@ ADD_PROJECT_DEPENDENCY(Boost REQUIRED)
EXPORT_BOOST_DEFAULT_OPTIONS()

IF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
ADD_PROJECT_DEPENDENCY(cppadcg 2.4.1 REQUIRED PKG_CONFIG_REQUIRES "cppadcg >= 2.4.1") # CppADCodeGen 2.4.1 is the first version to check the minimal version of CppAD
ADD_PROJECT_DEPENDENCY(cppadcg 2.4.1 REQUIRED PKG_CONFIG_REQUIRES "cppadcg >= 2.4.1" FIND_EXTERNAL "CppAD") # CppADCodeGen 2.4.1 is the first version to check the minimal version of CppAD
ADD_DEFINITIONS(-DPYCPPAD_WITH_CPPAD_CODEGEN_BINDINGS)
ENDIF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)

ADD_PROJECT_DEPENDENCY(cppad 20180000.0 REQUIRED PKG_CONFIG_REQUIRES "cppad >= 20180000.0")
ADD_PROJECT_DEPENDENCY(cppad 20180000.0 REQUIRED PKG_CONFIG_REQUIRES "cppad >= 20180000.0" FIND_EXTERNAL "CppAD")
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.5")
SET(PYTHON_COMPONENTS Interpreter Development NumPy)
FINDPYTHON(REQUIRED)
Expand Down Expand Up @@ -178,7 +165,4 @@ PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
PKG_CONFIG_APPEND_CFLAGS("-I${PYTHON_INCLUDE_DIRS}")
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_COMPONENTS})

# Install catkin package.xml
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})

setup_project_finalize()
2 changes: 1 addition & 1 deletion cmake
Submodule cmake updated 435 files
11 changes: 11 additions & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
function(ADD_WINDOWS_DLL_PATH_TO_TEST TEST_NAME)
if(WIN32)
get_test_property(${TEST_NAME} ENVIRONMENT ENV_VARIABLES)
list(APPEND ENV_VARIABLES
"PYCPPAD_WINDOWS_DLL_PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>")
set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT "${ENV_VARIABLES}")
endif()
endfunction()

ADD_PYTHON_UNIT_TEST("${PROJECT_NAME}-add_eq" "example/add_eq.py" "python")
ADD_WINDOWS_DLL_PATH_TO_TEST(${PROJECT_NAME}-add_eq)
IF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
ADD_PYTHON_UNIT_TEST("${PROJECT_NAME}-cppadcg_c_codegen" "example/cppadcg_c_codegen.py" "python")
ADD_WINDOWS_DLL_PATH_TO_TEST(${PROJECT_NAME}-cppadcg_c_codegen)
ENDIF()
6 changes: 2 additions & 4 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
<maintainer email="rohan.budhiraja@inria.fr">Rohan Budhiraja</maintainer>
<author>Rohan Budhiraja</author>
<author>Justin Carpentier</author>
<license>BSD</license>
<license>BSD-3-Clause</license>

<url type="website">https://github.com/simple-robotics/pycppad</url>

<build_depend>git</build_depend>
<build_depend>jrl_cmakemodules</build_depend>
<build_depend>doxygen</build_depend>
<!-- The following tags are recommended by REP-136 -->
<exec_depend condition="$ROS_VERSION == 1">catkin</exec_depend>
<exec_depend condition="$ROS_VERSION == 2">ament_cmake</exec_depend>
<depend condition="$ROS_PYTHON_VERSION == 2">python</depend>
<depend condition="$ROS_PYTHON_VERSION == 3">python3</depend>
<depend condition="$ROS_PYTHON_VERSION == 2">python-numpy</depend>
<depend condition="$ROS_PYTHON_VERSION == 3">python3-numpy</depend>
<depend>eigen</depend>
<depend>boost</depend>
Expand Down
11 changes: 9 additions & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ SET_TARGET_PROPERTIES(${PYWRAP}
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/python/${PROJECT_NAME}"
)

IF(UNIX AND NOT APPLE)
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES INSTALL_RPATH "\$ORIGIN/../../..")
IF(UNIX)
GET_RELATIVE_RPATH(
${${PYWRAP}_INSTALL_DIR}
${PYWRAP}_INSTALL_RPATH
)
set_target_properties(
${PYWRAP}
PROPERTIES INSTALL_RPATH "${${PYWRAP}_INSTALL_RPATH}"
)
ENDIF()

INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})
Expand Down
3 changes: 0 additions & 3 deletions python/pycppad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# Copyright 2021 INRIA
#

from .pycppad_pywrap import *
from .pycppad_pywrap import __version__, __raw_version__

# On Windows, if pycppad.dll is not in the same directory than
# the .pyd, it will not be loaded.
# We first try to load pycppad, then, if it fail and we are on Windows:
Expand Down
Loading