Skip to content

Introduce JRL CMake Modules v2#798

Draft
ahoarau wants to merge 256 commits intojrl-umi3218:masterfrom
ahoarau:jrl-next
Draft

Introduce JRL CMake Modules v2#798
ahoarau wants to merge 256 commits intojrl-umi3218:masterfrom
ahoarau:jrl-next

Conversation

@ahoarau
Copy link
Copy Markdown
Collaborator

@ahoarau ahoarau commented Dec 10, 2025

In this PR we introduce the JRL CMake Modules v2, extracted from the repo: https://github.com/ahoarau/jrl-cmakemodules-v2

The integration on the user-side can be done as follows https://github.com/ahoarau/nanoeigenpy/blob/db692b1dbe3fff76688550048fd3004ecbd1a2d7/cmake/get-jrl-cmakemodules.cmake

find_package(jrl-cmakemodules 1.2.0 CONFIG REQUIRED)
  • v1.2.0 will integrate the v2 folder, containing the new API.
  • Either set an env variable JRL_CMAKEMODULES_SOURCE_DIR pointing to the jrl repo source (example $env:JRL_CMAKEMODULES_SOURCE_DIR="C:/a/jrl-cmakemodules"
  • We do not intend to use both v1 and v2 in projects.

TODO:

  • Port the main modules
  • Test the integration in client repo (proxsuite, eigenpy, nanoeigenpy, coal)
  • Figure out why gersemi still needs to re-format the new modules
  • Add COMPATIBLITY_OPTION for jrl_cmake_dependent_option()
  • Port tests from original repo
  • Port CI from original repo
  • Rewrite release.cmake in python

Comment thread v2/find-modules/FindAccelerate.cmake
Comment thread v2/modules/BoostPython.cmake Outdated
Comment thread v2/jrl-cmakemodules-v2/templates/__init__.py.in Outdated
Comment thread v2/jrl-cmakemodules-v2/CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread v2/modules/jrl.cmake
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/jrl-cmakemodules-v2/CMakeLists.txt Outdated
Comment thread v2/modules/jrl.cmake
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/BoostPython.cmake Outdated
Comment thread v2/modules/jrl.cmake Outdated
Comment on lines +1880 to +1881
# * Otherwise, if running inside a Conda environment on Windows, an
# absolute path to `sysconfig.get_path('purelib')` is returned.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we already talked, I'm not a huge fan of handling this special case. The ${PROJECT_NAME}_PYTHON_INSTALL_DIR variable is made for this purpose.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried both options to see which one feels more natural. In the end, this function is here to handle the different cases of a python install dir, so it makes sense to take the conda+windows special/unique/annoying case here. All the other cases are fine with the default behaviour, so I think it's wise to keep it.

The ${PROJECT_NAME}_PYTHON_INSTALL_DIR is still useful as it can be used to override this behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have some concern.
This mean on Windows we will have an absolute path, ignoring the CMAKE_INSTALL_PREFIX.

Can we at least make the install path relative to CMAKE_INSTALL_PREFIX ? This will avoid user be surprised to install the binding in their conda environment when they specified a CMAKE_INSTALL_PREFIX != CONDA_PREFIX

Copy link
Copy Markdown
Contributor

@arntanguy arntanguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just gave it a try with SpaceVecAlg: jrl-umi3218/SpaceVecAlg#67
There seems to be an issue with BUILDSYSTEM_TARGETS, see my comment inline.

Besides that it worked just fine. I'll keep exploring during the week.

Comment thread v2/modules/jrl.cmake Outdated
Copy link
Copy Markdown
Collaborator

@nim65s nim65s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of work 😅

I did not look into external-modules yet, but here are some comments as a starting point.

Comment thread v2/find-modules/FindScipy.cmake Outdated
Comment thread v2/find-modules/FindScipy.cmake Outdated
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake
Comment thread v2/templates/generate-dependencies.cmake.in
Comment thread v2/CMakeLists.txt Outdated
@ahoarau ahoarau force-pushed the jrl-next branch 3 times, most recently from 9b26ecf to 62e72ef Compare January 13, 2026 08:34
Comment thread v2/modules/jrl.cmake Outdated
#]============================================================================]
macro(jrl_find_nanobind)
string(REPLACE ";" " " args_pp "${ARGN}")
_jrl_check_var_defined(Python_EXECUTABLE "Python executable not found (variable Python_EXECUTABLE).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Python::Interpreter instead

Comment thread v2/modules/jrl.cmake
Comment thread v2/modules/jrl.cmake Outdated
Comment on lines +1880 to +1881
# * Otherwise, if running inside a Conda environment on Windows, an
# absolute path to `sysconfig.get_path('purelib')` is returned.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have some concern.
This mean on Windows we will have an absolute path, ignoring the CMAKE_INSTALL_PREFIX.

Can we at least make the install path relative to CMAKE_INSTALL_PREFIX ? This will avoid user be surprised to install the binding in their conda environment when they specified a CMAKE_INSTALL_PREFIX != CONDA_PREFIX

Comment thread v2/modules/jrl.cmake Outdated
absolute path to `sysconfig.get_path('purelib')` is returned.
* In all other cases, the relative path to site-packages is returned.

### Windows Layout
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Windows Layout
### Conda Windows Layout

Comment thread v2/scripts/release.py Outdated
Comment thread v2/scripts/release.py Outdated
Comment thread v2/modules/jrl.cmake Outdated
Comment thread CMakeLists.txt
Comment thread v2/modules/jrl.cmake Outdated
Comment thread v2/modules/jrl.cmake Outdated
ahoarau added 29 commits April 19, 2026 16:15
which has been removed because unused
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants