File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,36 @@ add_custom_command(
355355 WORKING_DIRECTORY python
356356 COMMAND_EXPAND_LISTS )
357357
358+ # Generate Stub
359+ if (GENERATE_PYTHON_STUB)
360+ # Look for required python modules
361+ search_python_module(
362+ NAME mypy
363+ PACKAGE mypy
364+ NO_VERSION)
365+
366+ find_program (
367+ stubgen_EXECUTABLE
368+ NAMES stubgen stubgen.exe
369+ REQUIRED
370+ )
371+ message (STATUS "Python: stubgen: ${stubgen_EXECUTABLE} " )
372+
373+ add_custom_command (
374+ OUTPUT python/stub_timestamp
375+ COMMAND ${CMAKE_COMMAND} -E remove -f stub_timestamp
376+ COMMAND ${stubgen_EXECUTABLE} -p ${PYTHON_PROJECT} .foo.python.pyfoo --output .
377+ COMMAND ${stubgen_EXECUTABLE} -p ${PYTHON_PROJECT} .bar.python.pyBar --output .
378+ COMMAND ${stubgen_EXECUTABLE} -p ${PYTHON_PROJECT} .foobar.python.pyfoobar --output .
379+ COMMAND ${CMAKE_COMMAND} -E touch ${PROJECT_BINARY_DIR} /python/stub_timestamp
380+ MAIN_DEPENDENCY
381+ python/setup.py.in
382+ DEPENDS
383+ python/libs_timestamp
384+ python/pybind11_timestamp
385+ WORKING_DIRECTORY python
386+ COMMAND_EXPAND_LISTS )
387+ endif ()
358388
359389# Look for required python modules
360390search_python_module(
You can’t perform that action at this time.
0 commit comments