Merge branch 'upgrade_pybind11_stubgen' into 'master'

pybind11 stubgen v1 needs new call syntax

See merge request ngsolve/netgen!599
This commit is contained in:
Lackner, Christopher 2023-08-31 17:15:39 +02:00
commit 78e92c76df

View File

@ -26,13 +26,17 @@ install(FILES
# build stub files for pybind11 packages
if(BUILD_STUB_FILES)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import pybind11_stubgen; print(pybind11_stubgen.__file__)" OUTPUT_VARIABLE stubgen_path RESULT_VARIABLE pybind11_stubgen)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "from importlib.metadata import version; print(version('pybind11-stubgen'))" OUTPUT_VARIABLE stubgen_version RESULT_VARIABLE pybind11_stubgen)
if(pybind11_stubgen AND NOT ${pybind11_stubgen} EQUAL 0)
message(WARNING "pybind11-stubgen not found, if you want to create stub files
for better autocompletion support install it with pip.")
else()
message("-- Found pybind11-stubgen: ${stubgen_path}")
install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} -m pybind11_stubgen --no-setup-py --ignore-invalid=all netgen)")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../stubs/netgen-stubs/ DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen/ COMPONENT netgen)
if(stubgen_version LESS "1.0")
message(WARNING "pybind11-stubgen version is too old, if you want to create stub files for better autocompletion support upgrade it with pip.")
else()
message("-- Found pybind11-stubgen version: ${stubgen_version}")
install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} -m pybind11_stubgen --ignore-all-errors netgen)")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../stubs/netgen/ DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen/ COMPONENT netgen)
endif()
endif()
endif(BUILD_STUB_FILES)