Merge branch 'generate_stub_files' into 'master'

auto generate stub files using pybind11_stubgen

See merge request jschoeberl/netgen!172
This commit is contained in:
Joachim Schöberl 2019-06-30 16:46:13 +00:00
commit 933c93da3a
3 changed files with 18 additions and 3 deletions

View File

@ -28,6 +28,7 @@ option( ENABLE_CPP_CORE_GUIDELINES_CHECK "Enable cpp core guideline checks on ng
option( USE_SPDLOG "Enable spd log logging" OFF)
option( DEBUG_LOG "Enable more debug output (may increase computation time) - only works with USE_SPDLOG=ON" OFF)
option( CHECK_RANGE "Check array range access, automatically enabled if built in debug mode" OFF)
option( BUILD_STUB_FILES "Build stub files for better autocompletion" ON)
option( USE_SUPERBUILD "use ccache" ON)
@ -382,13 +383,13 @@ endif(ENABLE_CPP_CORE_GUIDELINES_CHECK)
add_subdirectory(libsrc)
add_subdirectory(ng)
add_subdirectory(tutorials)
if (USE_PYTHON)
add_subdirectory(python)
endif (USE_PYTHON)
add_subdirectory(py_tutorials)
add_subdirectory(doc)
add_subdirectory(windows)
add_subdirectory(nglib)
if (USE_PYTHON)
add_subdirectory(python)
endif (USE_PYTHON)
add_subdirectory(tests)

View File

@ -145,6 +145,7 @@ set_vars( NETGEN_CMAKE_ARGS
USE_SPDLOG
DEBUG_LOG
CHECK_RANGE
BUILD_STUB_FILES
)
# propagate all variables set on the command line using cmake -DFOO=BAR

View File

@ -11,3 +11,16 @@ install(FILES
DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX}
COMPONENT netgen
)
# build stub files for pybind11 packages
if(BUILD_STUB_FILES)
find_program(PYBIND11_STUBS NAMES pybind11-stubgen)
if(PYBIND11_STUBS)
message("-- Found pybind11-stubgen: ${PYBIND11_STUBS}")
install(CODE "execute_process(COMMAND ${PYBIND11_STUBS} --no-setup-py netgen)")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../stubs/netgen-stubs/ DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen/)
else(PYBIND11_STUBS)
message(WARNING "pybind11-stubgen not found, if you want to create stub files
for better autocompletion support install it with pip.")
endif(PYBIND11_STUBS)
endif(BUILD_STUB_FILES)