Fixes #30, Add CMake steps to install python bindings (#31)

This commit is contained in:
Dantali0n
2025-09-17 20:03:28 +02:00
committed by GitHub
parent 8fe8314905
commit bfe752433f
3 changed files with 33 additions and 2 deletions

View File

@@ -8,5 +8,18 @@ if(NOT pybind11_FOUND)
FetchContent_MakeAvailable(pybind11)
endif()
# Needed to set ${Python_VERSION_MAJOR} and ${Python_VERSION_MINOR}
find_package(
Python REQUIRED
)
pybind11_add_module(pytrigdx bindings.cpp)
target_link_libraries(pytrigdx PRIVATE trigdx)
set_target_properties(pytrigdx PROPERTIES OUTPUT_NAME "trigdx")
set(PYTHON_SITE_PACKAGES
"${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/trigdx"
)
install(TARGETS pytrigdx DESTINATION ${PYTHON_SITE_PACKAGES})
install(FILES __init__.py DESTINATION ${PYTHON_SITE_PACKAGES})