Skip to content

Commit 3450df0

Browse files
authored
Merge pull request #375 from jcarpent/devel
Enhance support of Tensor module in external applications
2 parents 0bdb505 + 7a0cad4 commit 3450df0

File tree

9 files changed

+39
-21
lines changed

9 files changed

+39
-21
lines changed

.github/workflows/macos-linux-conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
os: ["ubuntu-latest", "macos-latest"]
1616
cxx_options: ['', '-mavx2']
1717
build_type: [Release, Debug]
18-
python-version: ["3.10", "3.11", "3.12"]
18+
python-version: ["3.8", "3.12"]
1919

2020
include:
2121
- os: ubuntu-latest

.github/workflows/windows-conda.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
activate-environment: eigenpy
2121
environment-file: .github/workflows/conda/environment.yml
22-
python-version: 3.7
22+
python-version: "3.10"
2323
- name: Build Eigenpy
2424
shell: cmd /C CALL {0}
2525
env:
@@ -51,11 +51,6 @@ jobs:
5151
cmake --build . --config Release --target install
5252
if errorlevel 1 exit 1
5353
54-
:: Build stubs
55-
git clone https://github.com/jcarpent/pybind11-stubgen.git
56-
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 ""
57-
if errorlevel 1 exit 1
58-
5954
:: Testing
6055
ctest --output-on-failure -C Release -V
6156
if errorlevel 1 exit 1

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
### Added
10+
- Add new helper functions to check Tensor support
11+
12+
### Fixed
13+
- Fix stub generation on Windows
14+
915
## [3.1.3] - 2023-11-09
1016

1117
### Fixed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ endif(SUFFIX_SO_VERSION)
243243

244244
if(NOT WIN32)
245245
target_compile_options(
246-
${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>
246+
${PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj -MP>
247247
"-Wno-conversion")
248248
else()
249249
target_compile_options(${PROJECT_NAME}
250-
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>)
250+
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj -MP>)
251251
target_compile_definitions(${PROJECT_NAME} PUBLIC "HAVE_SNPRINTF")
252252
endif()
253253

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ EigenPy — Versatile and efficient Python bindings between Numpy and Eigen
1010
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black"></a>
1111
</p>
1212

13-
**EigenPy** is an open source framework which allows to bind the famous [Eigen](http://eigen.tuxfamily.org) C++ library in Python via Boost.Python.
13+
**EigenPy** is an open-source framework that allows the binding of the famous [Eigen](http://eigen.tuxfamily.org) C++ library in Python via Boost.Python.
1414

1515
**EigenPy** provides:
16-
- full memory sharing between Numpy and Eigen avoiding memory allocation
16+
- full memory sharing between Numpy and Eigen, avoiding memory allocation
1717
- full support Eigen::Ref avoiding memory allocation
1818
- full support of the Eigen::Tensor module
1919
- exposition of the Geometry module of Eigen for easy code prototyping
20-
- standard matrix decomposion routines of Eigen such as the Cholesky decomposition, SVD decomposition, QR decomposition, and etc.
20+
- standard matrix decomposion routines of Eigen such as the Cholesky decomposition, SVD decomposition, QR decomposition, etc.
2121
- full support of SWIG objects
2222
- full support of runtime declaration of Numpy scalar types
2323
- extended API to expose std::vector types
2424
- full support of vectorization between C++ and Python (all the hold objects are properly aligned in memory)
2525

2626
## Setup
2727

28-
The installation of **EigenPy** on your computer is made easy for Linux/BSD, Mac OS X and Windows environments.
28+
The installation of **EigenPy** on your computer is made easy for Linux/BSD, Mac OS X, and Windows environments.
2929

3030
### The Conda approach
3131

@@ -36,7 +36,7 @@ conda install eigenpy -c conda-forge
3636

3737
### Ubuntu
3838

39-
You can easily install **EigenPy** from binairies.
39+
You can easily install **EigenPy** from binaries.
4040

4141
#### Add robotpkg apt repository
4242
1. Add robotpkg as source repository to apt:
@@ -47,7 +47,7 @@ sudo sh -c "echo 'deb [arch=amd64] http://robotpkg.openrobots.org/packages/debia
4747
```
4848
curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | sudo apt-key add -
4949
```
50-
3. You need to run at least once apt update to fetch the package descriptions:
50+
3. You need to run at least one apt update to fetch the package descriptions:
5151
```bash
5252
sudo apt-get update
5353
```
@@ -58,12 +58,12 @@ sudo apt-get update
5858
```bash
5959
sudo apt install robotpkg-py35-eigenpy
6060
```
61-
where 35 should be replaced by the python 3 you want to work this (e.g. `robotpkg-py36-eigenpy` to work with Python 3.6).
61+
where 35 should be replaced by the Python 3, you want to work this (e.g., `robotpkg-py36-eigenpy` to work with Python 3.6).
6262

6363
### Mac OS X
6464

6565
The installation of **EigenPy** on Mac OS X is made via [HomeBrew](https://brew.sh/).
66-
You just need to register the tap of the sofware repository.
66+
You just need to register the tap of the software repository.
6767

6868
```
6969
brew tap gepetto/homebrew-gepetto
@@ -83,8 +83,9 @@ The following people have been involved in the development of **EigenPy**:
8383
- [Sean Yen](https://www.linkedin.com/in/seanyentw) (Microsoft): Windows integration
8484
- [Loïc Estève](https://github.com/lesteve) (INRIA): Conda integration
8585
- [Wilson Jallet](https://manifoldfr.github.io/) (INRIA/LAAS-CNRS): core developer
86+
- [Joris Vaillant](https://github.com/jorisv) (Inria): core developer and manager of the project
8687

87-
If you have taken part to the development of **EigenPy**, feel free to add your name and contribution here.
88+
If you have taken part in the development of **EigenPy**, feel free to add your name and contribution here.
8889

8990
## Acknowledgments
9091

cmake

include/eigenpy/eigenpy.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ namespace eigenpy {
1919
*/
2020
void EIGENPY_DLLAPI enableEigenPy();
2121

22+
bool EIGENPY_DLLAPI withTensorSupport();
23+
2224
/* Enable the Eigen--Numpy serialization for the templated MatType class.*/
2325
template <typename MatType>
2426
void enableEigenPySpecific();

python/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ include("${JRL_CMAKE_MODULES}/stubs.cmake")
1515
add_custom_target(python)
1616
set_target_properties(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True)
1717

18-
add_library(${PYWRAP} SHARED main.cpp)
18+
add_library(${PYWRAP} MODULE main.cpp)
1919
add_dependencies(python ${PYWRAP})
2020
target_link_libraries(${PYWRAP} PUBLIC ${PROJECT_NAME})
21+
22+
python_build_get_target(python_build_target)
23+
add_dependencies(${PYWRAP} ${python_build_target})
24+
2125
# BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS spews conversion warnings from int to
2226
# long unsigned int. Unfortunately, using literals does not work in a macro. As
2327
# such, this turns them off for the entire wrapper:
@@ -56,8 +60,10 @@ install(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR})
5660
if(GENERATE_PYTHON_STUBS)
5761
load_stubgen()
5862

63+
# Set PYWRAP and PROJECT_NAME as stubs dependencies PROJECT_NAME is mandatory
64+
# (even if it's a PYWRAP dependency) to find PROJECT_NAME name DLL on windows
5965
generate_stubs(${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_NAME}
60-
${ABSOLUTE_PYTHON_SITELIB} ${PYWRAP})
66+
${ABSOLUTE_PYTHON_SITELIB} ${PYWRAP} ${PROJECT_NAME})
6167
endif(GENERATE_PYTHON_STUBS)
6268

6369
# --- INSTALL SCRIPTS

src/eigenpy.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,12 @@ void enableEigenPy() {
6060
exposeNoneType();
6161
}
6262

63+
bool withTensorSupport() {
64+
#ifdef EIGENPY_WITH_TENSOR_SUPPORT
65+
return true;
66+
#else
67+
return false;
68+
#endif
69+
}
70+
6371
} // namespace eigenpy

0 commit comments

Comments
 (0)