Skip to content

Commit

Permalink
[Py] only perform stubgen for CPython by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Nov 14, 2024
1 parent 585bb69 commit 55f6a0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions QPALM/interfaces/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ target_link_libraries(_qpalm PRIVATE pybind11::pybind11 qpalm qpalm_cxx)
target_compile_definitions(_qpalm PRIVATE
MODULE_NAME=$<TARGET_FILE_BASE_NAME:_qpalm>
VERSION_INFO="${PY_FULL_VERSION}")
set_target_properties(_qpalm PROPERTIES
set_target_properties(_qpalm PROPERTIES
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand Down Expand Up @@ -71,9 +71,14 @@ if (CMAKE_STRIP AND CMAKE_OBJCOPY)
endif()

# Generate stubs for the Python module
set(QPALM_WITH_PY_STUBS_DEFAULT On)
if (CMAKE_CROSSCOMPILING OR NOT Python3_INTERPRETER_ID STREQUAL "Python")
set(QPALM_WITH_PY_STUBS_DEFAULT Off)
endif()
option(QPALM_WITH_PY_STUBS
"Generate Python stub files (.pyi) for the Python module." On)
if (QPALM_WITH_PY_STUBS AND NOT CMAKE_CROSSCOMPILING)
"Generate Python stub files (.pyi) for the Python module."
${QPALM_WITH_PY_STUBS_DEFAULT})
if (QPALM_WITH_PY_STUBS)
include(cmake/Pybind11Stubgen.cmake)
pybind11_stubgen(_qpalm)
pybind11_stubgen_install(_qpalm)
Expand Down

0 comments on commit 55f6a0d

Please sign in to comment.