Bindings: Python: Simplify debug process

pull/73/head
Kyle Schwarz 2025-02-11 12:43:30 -05:00
parent f04cd16bee
commit 02b5dafca9
1 changed files with 18 additions and 3 deletions

View File

@ -1,7 +1,18 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
set(PYBIND11_FINDPYTHON ON) set(PYBIND11_FINDPYTHON ON)
if(PYBIND11_ROOT)
find_package(pybind11 CONFIG REQUIRED) find_package(pybind11 CONFIG REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.13.6
)
FetchContent_MakeAvailable(pybind11)
endif()
pybind11_add_module(icsneopy pybind11_add_module(icsneopy
icsneopy/api/event.cpp icsneopy/api/event.cpp
@ -28,6 +39,10 @@ target_link_libraries(icsneopy PRIVATE icsneocpp)
install(TARGETS icsneopy LIBRARY DESTINATION icsneopy) install(TARGETS icsneopy LIBRARY DESTINATION icsneopy)
find_program(STUBGEN_EXE stubgen)
if(STUBGEN_EXE)
add_custom_command(TARGET icsneopy POST_BUILD COMMAND stubgen -m icsneopy -o .) add_custom_command(TARGET icsneopy POST_BUILD COMMAND stubgen -m icsneopy -o .)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/icsneopy.pyi py.typed DESTINATION icsneopy)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/icsneopy.pyi __init__.py py.typed DESTINATION icsneopy) install(FILES __init__.py DESTINATION icsneopy)