Skip to content

Commit

Permalink
Add stubs (i.e type hints)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjanvier committed Sep 16, 2024
1 parent 564cfcc commit f3f673d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ find_package(nanobind CONFIG REQUIRED)

nanobind_add_module(pgeof_ext NOMINSIZE STABLE_ABI LTO src/pgeof_ext.cpp)

# for nanobind 2
# nanobind_add_stub(
# pgeof_ext_stub
# MODULE pgeof_ext
# OUTPUT pgeof_ext.pyi
# PYTHON_PATH $<TARGET_FILE_DIR:pgeof_ext>
# DEPENDS pgeof_ext
# )
nanobind_add_stub(
pgeof_ext_stub
MODULE pgeof_ext
OUTPUT pgeof_ext.pyi
MARKER_FILE py.typed
PYTHON_PATH $<TARGET_FILE_DIR:pgeof_ext>
DEPENDS pgeof_ext
)

# All lib are headeer only.
# it's faster to include like this than using exported targets
# (i.e add_subdirectories(...))
target_include_directories(pgeof_ext PRIVATE "include" "third_party/eigen" "third_party/nanoflann/include" "third_party/taskflow")

install(TARGETS pgeof_ext LIBRARY DESTINATION pgeof)
install(TARGETS pgeof_ext LIBRARY DESTINATION pgeof)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pgeof_ext.pyi ${CMAKE_CURRENT_BINARY_DIR}/py.typed DESTINATION pgeof)

0 comments on commit f3f673d

Please sign in to comment.