diff --git a/.github/workflows/macos-linux-conda.yml b/.github/workflows/macos-linux-conda.yml index fc13f90e2e2ec41f7f9dd9d2c8686fc52ddb4536..aa70eee125016690617e0addf374ce3219faeb2d 100644 --- a/.github/workflows/macos-linux-conda.yml +++ b/.github/workflows/macos-linux-conda.yml @@ -15,7 +15,7 @@ jobs: os: ["ubuntu-latest", "macos-latest"] cxx_options: ['', '-mavx2'] build_type: [Release, Debug] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.8", "3.12"] include: - os: ubuntu-latest diff --git a/.github/workflows/windows-conda.yml b/.github/workflows/windows-conda.yml index 07f82fab4c361e71aabdb0f3332aef923b2cfaf1..3a5ca233b1ae2ed94bfb72d39236943a6c48d8ac 100644 --- a/.github/workflows/windows-conda.yml +++ b/.github/workflows/windows-conda.yml @@ -19,7 +19,7 @@ jobs: with: activate-environment: eigenpy environment-file: .github/workflows/conda/environment.yml - python-version: 3.7 + python-version: "3.10" - name: Build Eigenpy shell: cmd /C CALL {0} env: @@ -51,11 +51,6 @@ jobs: 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index a64cc97c232619d0c05d9b6b2ec81a6cc3d729db..8c8898697560c9c6ed82e69f5680795d004be795 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Added +- Add new helper functions to check Tensor support + +### Fixed +- Fix stub generation on Windows + ## [3.1.3] - 2023-11-09 ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 821d49b76bf1b8cb80b4db10a8403de03691f1a4..96a80995f5b3d4f583cefe1e58a255bc69eccea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -243,11 +243,11 @@ 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() diff --git a/README.md b/README.md index b5237f786d4576bdde6aa3e76f0abd2f30363028..b21a05f67d9d3e4460f352f9f8d01b4463f11454 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,14 @@ EigenPy — Versatile and efficient Python bindings between Numpy and Eigen <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black"></a> </p> -**EigenPy** is an open source framework which allows to bind the famous [Eigen](http://eigen.tuxfamily.org) C++ library in Python via Boost.Python. +**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. **EigenPy** provides: - - full memory sharing between Numpy and Eigen avoiding memory allocation + - full memory sharing between Numpy and Eigen, avoiding memory allocation - full support Eigen::Ref avoiding memory allocation - full support of the Eigen::Tensor module - exposition of the Geometry module of Eigen for easy code prototyping - - standard matrix decomposion routines of Eigen such as the Cholesky decomposition, SVD decomposition, QR decomposition, and etc. + - standard matrix decomposion routines of Eigen such as the Cholesky decomposition, SVD decomposition, QR decomposition, etc. - full support of SWIG objects - full support of runtime declaration of Numpy scalar types - extended API to expose std::vector types @@ -25,7 +25,7 @@ EigenPy — Versatile and efficient Python bindings between Numpy and Eigen ## Setup -The installation of **EigenPy** on your computer is made easy for Linux/BSD, Mac OS X and Windows environments. +The installation of **EigenPy** on your computer is made easy for Linux/BSD, Mac OS X, and Windows environments. ### The Conda approach @@ -36,7 +36,7 @@ conda install eigenpy -c conda-forge ### Ubuntu -You can easily install **EigenPy** from binairies. +You can easily install **EigenPy** from binaries. #### Add robotpkg apt repository 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 ``` curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | sudo apt-key add - ``` -3. You need to run at least once apt update to fetch the package descriptions: +3. You need to run at least one apt update to fetch the package descriptions: ```bash sudo apt-get update ``` @@ -58,12 +58,12 @@ sudo apt-get update ```bash sudo apt install robotpkg-py35-eigenpy ``` -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). +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). ### Mac OS X The installation of **EigenPy** on Mac OS X is made via [HomeBrew](https://brew.sh/). -You just need to register the tap of the sofware repository. +You just need to register the tap of the software repository. ``` brew tap gepetto/homebrew-gepetto @@ -83,8 +83,9 @@ The following people have been involved in the development of **EigenPy**: - [Sean Yen](https://www.linkedin.com/in/seanyentw) (Microsoft): Windows integration - [Loïc Estève](https://github.com/lesteve) (INRIA): Conda integration - [Wilson Jallet](https://manifoldfr.github.io/) (INRIA/LAAS-CNRS): core developer +- [Joris Vaillant](https://github.com/jorisv) (Inria): core developer and manager of the project -If you have taken part to the development of **EigenPy**, feel free to add your name and contribution here. +If you have taken part in the development of **EigenPy**, feel free to add your name and contribution here. ## Acknowledgments diff --git a/cmake b/cmake index d769b7c0f0837399c21381c24ab4e8fd9b3b7220..04687800b78c0058cd1dcdbfeb9f34460611df6b 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d769b7c0f0837399c21381c24ab4e8fd9b3b7220 +Subproject commit 04687800b78c0058cd1dcdbfeb9f34460611df6b diff --git a/include/eigenpy/eigenpy.hpp b/include/eigenpy/eigenpy.hpp index bdbca6f4c2ce15699652650a8966fd81a551bab7..8a6cecc28be18685375feba1e47f812f54103ef0 100644 --- a/include/eigenpy/eigenpy.hpp +++ b/include/eigenpy/eigenpy.hpp @@ -19,6 +19,8 @@ namespace eigenpy { */ void EIGENPY_DLLAPI enableEigenPy(); +bool EIGENPY_DLLAPI withTensorSupport(); + /* Enable the Eigen--Numpy serialization for the templated MatType class.*/ template <typename MatType> void enableEigenPySpecific(); diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index ba1356310263622dbfdd102f103e772a0ca47748..4a9825a98e095c65068930ad6d0a8560d1620631 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -15,9 +15,13 @@ include("${JRL_CMAKE_MODULES}/stubs.cmake") add_custom_target(python) set_target_properties(python PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True) -add_library(${PYWRAP} SHARED main.cpp) +add_library(${PYWRAP} MODULE main.cpp) add_dependencies(python ${PYWRAP}) target_link_libraries(${PYWRAP} PUBLIC ${PROJECT_NAME}) + +python_build_get_target(python_build_target) +add_dependencies(${PYWRAP} ${python_build_target}) + # BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS spews conversion warnings from int to # long unsigned int. Unfortunately, using literals does not work in a macro. As # such, this turns them off for the entire wrapper: @@ -56,8 +60,10 @@ install(TARGETS ${PYWRAP} DESTINATION ${${PYWRAP}_INSTALL_DIR}) if(GENERATE_PYTHON_STUBS) load_stubgen() + # Set PYWRAP and PROJECT_NAME as stubs dependencies PROJECT_NAME is mandatory + # (even if it's a PYWRAP dependency) to find PROJECT_NAME name DLL on windows generate_stubs(${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_NAME} - ${ABSOLUTE_PYTHON_SITELIB} ${PYWRAP}) + ${ABSOLUTE_PYTHON_SITELIB} ${PYWRAP} ${PROJECT_NAME}) endif(GENERATE_PYTHON_STUBS) # --- INSTALL SCRIPTS diff --git a/src/eigenpy.cpp b/src/eigenpy.cpp index 6e13f13f3a9256d32bfb2186c8d616db677ca759..6a74bc6a932d0609fc5e8dafc7e05650961d9c87 100644 --- a/src/eigenpy.cpp +++ b/src/eigenpy.cpp @@ -60,4 +60,12 @@ void enableEigenPy() { exposeNoneType(); } +bool withTensorSupport() { +#ifdef EIGENPY_WITH_TENSOR_SUPPORT + return true; +#else + return false; +#endif +} + } // namespace eigenpy