Fix/findpython development embed#565
Open
RyanPaulMcKenna wants to merge 5 commits intosofa-framework:masterfrom
Open
Fix/findpython development embed#565RyanPaulMcKenna wants to merge 5 commits intosofa-framework:masterfrom
RyanPaulMcKenna wants to merge 5 commits intosofa-framework:masterfrom
Conversation
…ods to enable numpy 2 (sofa-framework#518) * Use set_printoptions(legacy=True) in node binfing to force usage of legacy repr for numpy objects. This is ocmpatible with numpy 1 * Patch addChild * Add RAII mechanism to make sure numpy is put back its initial state * Add [[maybe_unused]] Co-authored-by: Frederick Roy <[email protected]> --------- Co-authored-by: Hugo <[email protected]> Co-authored-by: Frederick Roy <[email protected]>
* Add explicit getter and setter * Remove mistake
* [examples] Update examples using imgui as default * Add example to keep the Qt GUI example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: Fix
Python::Pythonmissing when building bindings viaSP3_add_python_module(CMake FindPythonDevelopment.Embed)Summary
This PR fixes a CMake configuration/build failure seen when downstream plugins (e.g. Cosserat) use SofaPython3’s
SP3_add_python_module()helper and it internally callspython_add_library().Problem
On newer CMake/FindPython (observed with CMake 3.28 + Python 3.12 on Ubuntu),
python_add_library()requires the imported targetPython::Pythonto be defined. In some configurations,Python::Pythonis not created becausefind_package(Python … COMPONENTS Development.Embed …)was never requested, leading to:This then causes a cascade (e.g. missing
CosseratBindingsalias target).Solution
Make
SP3_add_python_module()self-contained by ensuringPython::Pythonexists before callingpython_add_library():Python::Pythonis not already defined, explicitly call:find_package(Python REQUIRED COMPONENTS Interpreter Development Development.Module Development.Embed)This guarantees the required
Python::Pythontarget is present and prevents downstream projects from needing to add extra FindPython boilerplate.Testing
Tested locally by building SOFA with SofaPython3 and the Cosserat plugin bindings enabled. After applying this change:
Python::Python/Development.Embederror)