Skip to content
Snippets Groups Projects
Commit ce2bde40 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : better import of python

parent 424f0c73
No related branches found
No related tags found
2 merge requests!212Version 0.3.0,!116feat/release_pip
Pipeline #45449 canceled
...@@ -9,15 +9,17 @@ function(generate_python_binding name target_to_bind) ...@@ -9,15 +9,17 @@ function(generate_python_binding name target_to_bind)
) )
# Use the New FindPython mode, recommanded. Requires CMake 3.15+ # Use the New FindPython mode, recommanded. Requires CMake 3.15+
if ( NOT DEFINED PYTHON_EXECUTABLE OR NOT DEFINED PYTHON_INCLUDE_DIR OR NOT DEFINED PYTHON_LIBRARY ) find_package(Python 3.7
find_package(Python 3.7 COMPONENTS Interpreter Development.Module REQUIRED) COMPONENTS Interpreter Development.Module
endif() REQUIRED)
FetchContent_MakeAvailable(PyBind11) FetchContent_MakeAvailable(PyBind11)
message(STATUS "Creating binding for module ${name}") message(STATUS "Creating binding for module ${name}")
file(GLOB_RECURSE pybind_src_files "python_binding/*.cpp") file(GLOB_RECURSE pybind_src_files "python_binding/*.cpp")
pybind11_add_module(${name} MODULE ${pybind_src_files} "NO_EXTRAS") # NO EXTRA recquired for pip install pybind11_add_module(${name} MODULE ${pybind_src_files} "NO_EXTRAS") # NO EXTRA recquired for pip install
target_include_directories(${name} PUBLIC "python_binding") target_include_directories(${name} PUBLIC "python_binding" )
target_link_libraries(${name} PUBLIC ${target_to_bind}) target_link_libraries(${name} PUBLIC ${target_to_bind})
target_include_directories(${target_to_bind} PRIVATE ${Python_INCLUDE_DIRECTORIES})
target_link_directories(${target_to_bind} PRIVATE ${Python_LIBRARY_DIRS})
endfunction() endfunction()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment