Skip to content

Commit 43c5b53

Browse files
authored
Merge pull request #43 from nim65s/cmake
CMake: sync with new jrl-cmakemodules
2 parents 54362f0 + b43d534 commit 43c5b53

File tree

9 files changed

+45
-41
lines changed

9 files changed

+45
-41
lines changed

.github/workflows/ci-ubuntu-macos.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ jobs:
2828

2929
- uses: conda-incubator/setup-miniconda@v3
3030
with:
31+
miniforge-version: latest
3132
activate-environment: pycppad
32-
auto-update-conda: true
3333
environment-file: .github/workflows/conda/conda-env.yml
34-
python-version: 3.8
34+
auto-update-conda: true
3535
auto-activate-base: false
36+
conda-remove-defaults: true
3637

3738
- name: Build PyCppAD
3839
shell: bash -el {0}
@@ -50,7 +51,7 @@ jobs:
5051
-DPYTHON_EXECUTABLE=$(which python3) \
5152
-DBUILD_WITH_CPPAD_CODEGEN_BINDINGS=ON
5253
ninja -j1
53-
ctest --output-on-failure -C Release -V
54+
ctest --output-on-failure
5455
ninja install
5556
5657
- name: Uninstall PyCppAD

.github/workflows/ci-windows.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ env:
99

1010
jobs:
1111
build:
12+
name: build (${{ matrix.os }}, ${{ matrix.compiler.name }}, ${{ matrix.compiler.cppad_codegen }})
1213
runs-on: ${{ matrix.os }}
1314

1415
strategy:
15-
fail-fast: true
16+
fail-fast: false
1617
matrix:
1718
os: [windows-latest]
1819
compiler:
19-
- cmd: cl
20+
- name: cl
21+
cmd: cl
2022
cppad_codegen: OFF
21-
- cmd: clang-cl
23+
- name: clang-cl
24+
cmd: '%CONDA_PREFIX%\\Library\\bin\\clang-cl'
2225
cppad_codegen: ON
2326

2427
steps:
@@ -28,11 +31,12 @@ jobs:
2831

2932
- uses: conda-incubator/setup-miniconda@v3
3033
with:
34+
miniforge-version: latest
3135
activate-environment: pycppad
32-
auto-update-conda: true
3336
environment-file: .github/workflows/conda/conda-env.yml
34-
python-version: 3.8
37+
auto-update-conda: true
3538
auto-activate-base: false
39+
conda-remove-defaults: true
3640

3741
- name: Build PyCppAD
3842
shell: cmd /C CALL {0}
@@ -62,7 +66,7 @@ jobs:
6266
ninja -j1
6367
6468
:: Testing
65-
ctest --output-on-failure -C Release -V
69+
ctest --output-on-failure
6670
6771
:: Test Python import
6872
ninja install

.github/workflows/conda/conda-env.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ name: pycppad
22
channels:
33
- conda-forge
44
dependencies:
5-
- boost
5+
- libboost-devel
6+
- libboost-python-devel
67
- eigenpy
78
- python
89
- cppad
910
- cppadcodegen
10-
- ninja
1111
- cmake
1212
- pkg-config
1313
- ninja
1414
- cxx-compiler
15+
- clangxx
16+
- doxygen

CMakeLists.txt

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2021-2023 INRIA
33
#
44

5-
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
5+
CMAKE_MINIMUM_REQUIRED(VERSION 3.22)
66

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

2323
# Check if the submodule cmake have been initialized
24-
SET(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
25-
IF(NOT EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
26-
MESSAGE(FATAL_ERROR "\nPlease run the following command first:\ngit submodule update --init\n")
27-
ENDIF()
28-
24+
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
2925
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
3026
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
3127
else()
@@ -36,13 +32,6 @@ else()
3632
TARGET jrl-cmakemodules::jrl-cmakemodules
3733
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
3834
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
39-
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
40-
message(
41-
FATAL_ERROR
42-
"\nCan't find jrl-cmakemodules. Please either:\n"
43-
" - use git submodule: 'git submodule update --init'\n"
44-
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
45-
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n")
4635
else()
4736
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
4837
include(FetchContent)
@@ -63,8 +52,6 @@ INCLUDE(${JRL_CMAKE_MODULES}/boost.cmake)
6352
INCLUDE(${JRL_CMAKE_MODULES}/ide.cmake)
6453
INCLUDE(${JRL_CMAKE_MODULES}/python.cmake)
6554

66-
SET(CMAKE_MODULE_PATH "${JRL_CMAKE_MODULES}/find-external/CppAD/" ${CMAKE_MODULE_PATH})
67-
6855
# Project definition
6956
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
7057
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
@@ -79,11 +66,11 @@ ADD_PROJECT_DEPENDENCY(Boost REQUIRED)
7966
EXPORT_BOOST_DEFAULT_OPTIONS()
8067

8168
IF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
82-
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
69+
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
8370
ADD_DEFINITIONS(-DPYCPPAD_WITH_CPPAD_CODEGEN_BINDINGS)
8471
ENDIF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
8572

86-
ADD_PROJECT_DEPENDENCY(cppad 20180000.0 REQUIRED PKG_CONFIG_REQUIRES "cppad >= 20180000.0")
73+
ADD_PROJECT_DEPENDENCY(cppad 20180000.0 REQUIRED PKG_CONFIG_REQUIRES "cppad >= 20180000.0" FIND_EXTERNAL "CppAD")
8774
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.5")
8875
SET(PYTHON_COMPONENTS Interpreter Development NumPy)
8976
FINDPYTHON(REQUIRED)
@@ -178,7 +165,4 @@ PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
178165
PKG_CONFIG_APPEND_CFLAGS("-I${PYTHON_INCLUDE_DIRS}")
179166
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_COMPONENTS})
180167

181-
# Install catkin package.xml
182-
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
183-
184168
setup_project_finalize()

cmake

Submodule cmake updated 435 files

example/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
function(ADD_WINDOWS_DLL_PATH_TO_TEST TEST_NAME)
2+
if(WIN32)
3+
get_test_property(${TEST_NAME} ENVIRONMENT ENV_VARIABLES)
4+
list(APPEND ENV_VARIABLES
5+
"PYCPPAD_WINDOWS_DLL_PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>")
6+
set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT "${ENV_VARIABLES}")
7+
endif()
8+
endfunction()
9+
110
ADD_PYTHON_UNIT_TEST("${PROJECT_NAME}-add_eq" "example/add_eq.py" "python")
11+
ADD_WINDOWS_DLL_PATH_TO_TEST(${PROJECT_NAME}-add_eq)
212
IF(BUILD_WITH_CPPAD_CODEGEN_BINDINGS)
313
ADD_PYTHON_UNIT_TEST("${PROJECT_NAME}-cppadcg_c_codegen" "example/cppadcg_c_codegen.py" "python")
14+
ADD_WINDOWS_DLL_PATH_TO_TEST(${PROJECT_NAME}-cppadcg_c_codegen)
415
ENDIF()

package.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
<maintainer email="[email protected]">Rohan Budhiraja</maintainer>
77
<author>Rohan Budhiraja</author>
88
<author>Justin Carpentier</author>
9-
<license>BSD</license>
9+
<license>BSD-3-Clause</license>
1010

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

1313
<build_depend>git</build_depend>
14+
<build_depend>jrl_cmakemodules</build_depend>
1415
<build_depend>doxygen</build_depend>
1516
<!-- The following tags are recommended by REP-136 -->
16-
<exec_depend condition="$ROS_VERSION == 1">catkin</exec_depend>
1717
<exec_depend condition="$ROS_VERSION == 2">ament_cmake</exec_depend>
18-
<depend condition="$ROS_PYTHON_VERSION == 2">python</depend>
1918
<depend condition="$ROS_PYTHON_VERSION == 3">python3</depend>
20-
<depend condition="$ROS_PYTHON_VERSION == 2">python-numpy</depend>
2119
<depend condition="$ROS_PYTHON_VERSION == 3">python3-numpy</depend>
2220
<depend>eigen</depend>
2321
<depend>boost</depend>

python/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,15 @@ SET_TARGET_PROPERTIES(${PYWRAP}
4040
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/python/${PROJECT_NAME}"
4141
)
4242

43-
IF(UNIX AND NOT APPLE)
44-
SET_TARGET_PROPERTIES(${PYWRAP} PROPERTIES INSTALL_RPATH "\$ORIGIN/../../..")
43+
IF(UNIX)
44+
GET_RELATIVE_RPATH(
45+
${${PYWRAP}_INSTALL_DIR}
46+
${PYWRAP}_INSTALL_RPATH
47+
)
48+
set_target_properties(
49+
${PYWRAP}
50+
PROPERTIES INSTALL_RPATH "${${PYWRAP}_INSTALL_RPATH}"
51+
)
4552
ENDIF()
4653

4754
INSTALL(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})

python/pycppad/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# Copyright 2021 INRIA
33
#
44

5-
from .pycppad_pywrap import *
6-
from .pycppad_pywrap import __version__, __raw_version__
7-
85
# On Windows, if pycppad.dll is not in the same directory than
96
# the .pyd, it will not be loaded.
107
# We first try to load pycppad, then, if it fail and we are on Windows:

0 commit comments

Comments
 (0)