-
Notifications
You must be signed in to change notification settings - Fork 55
Introduce JRL CMake Modules v2 #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| endif() | ||
| endfunction() | ||
|
|
||
| function(jrl_python_generate_init_py name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some documentation
| if(NOT Python_EXECUTABLE) | ||
| message( | ||
| FATAL_ERROR | ||
| "Python_EXECUTABLE not defined. | ||
| Please use jrl_find_package(Python REQUIRED COMPONENT Interpreter)" | ||
| ) | ||
| endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use jrl_check_var_defined ?
Also, in BoostPython.cmake you use $<TARGET_FILE:Python::Interpreter>. Which one is the best ?
v2/modules/jrl.cmake
Outdated
| if(NOT Python_EXECUTABLE) | ||
| message( | ||
| FATAL_ERROR | ||
| "Python_EXECUTABLE not defined. | ||
| Please use jrl_find_package(Python REQUIRED COMPONENT Interpreter)" | ||
| ) | ||
| endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use jrl_check_var_defined ?
Also, in BoostPython.cmake you use $<TARGET_FILE:Python::Interpreter>. Which one is the best ?
the dll needs to be closed after the import coal call
otherwise, the dll are already close():28
also fixes an error when running in script mode
…ke the installed version
remove the test for now
…on dir
This commit might be reverted as we already have ${PROJECT_NAME}_PYTHON_INSTALL_DIR to override the installation path
This reverts commit 8148456.
this is a proper way to enfore the policy CMP0057, required to NEW on CMake 3.22
…build in build dir
…ve error messaging
| function(jrl_configure_default_install_dirs) | ||
| include(GNUInstallDirs) | ||
| endfunction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| function(jrl_configure_default_install_dirs) | |
| include(GNUInstallDirs) | |
| endfunction() | |
| macro(jrl_configure_default_install_dirs) | |
| include(GNUInstallDirs) | |
| endmacro() |
Some variables like ${CMAKE_INSTALL_FULL_BINDIR} are not defined if the include is inside a function.
| configure_file( | ||
| "${templates_dir}/cmake-uninstall.cmake.in" | ||
| "${CMAKE_CURRENT_BINARY_DIR}/cmake-uninstall.cmake" | ||
| IMMEDIATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find the documentation for this keyword.
| endfunction() | ||
|
|
||
| # Helper function: pad or truncate a string to a fixed width | ||
| function(_pad_string input width output_var) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename it into _jrl_pad_string
| add_custom_command( | ||
| OUTPUT ${arg_OUTPUT} | ||
| COMMAND | ||
| ${CMAKE_COMMAND} -E env ${pythonpath} $<TARGET_FILE:Python::Interpreter> ${stubgen_py} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check like this one : jrl_check_target_exists(Python::Interpreter "Python::Interpreter target not found. Please call jrl_find_python() first.")
| # * Otherwise, if running inside a Conda environment on Windows, an | ||
| # absolute path to `sysconfig.get_path('purelib')` is returned. |
There was a problem hiding this comment.
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.
In this PR we introduce the
JRL CMake Modules v2, extracted from the repo: https://github.com/ahoarau/jrl-cmakemodules-v2The integration on the user-side can be done as follows:
We can still use the repo
jrl-cmakemodulesas usual, i.e. withpixior manually installing it.Either set an env variable
JRL_CMAKEMODULES_SOURCE_DIRpointing to the jrl repo source location or use the installed version (find_package(...)).Then define
JRL_CMAKEMODULES_USE_V2 ONto bypass thev1and use exclusively thev2.We do not intend to use both
v1andv2in projects.TODO:
COMPATIBLITY_OPTIONforjrl_cmake_dependent_option()release.cmakein python (help wanted)