File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,15 +51,14 @@ file(MAKE_DIRECTORY "${STUBGEN_OUTPUT_PATH}")
5151add_custom_command (
5252 TARGET pyqpp
5353 POST_BUILD
54- COMMAND ${Python3_EXECUTABLE} -m pybind11_stubgen pyqpp --output-dir
55- ${STUBGEN_OUTPUT_PATH} --ignore-all-errors
54+ # 1. Use ${CMAKE_COMMAND} -E env to correctly set PYTHONPATH
55+ # 2. Use $<TARGET_FILE_DIR:pyqpp> to dynamically find the .pyd location
56+ # (Release/Debug)
57+ COMMAND
58+ ${CMAKE_COMMAND } -E env "PYTHONPATH=$<TARGET_FILE_DIR :pyqpp >"
59+ ${Python3_EXECUTABLE} -m pybind11_stubgen pyqpp --output-dir
60+ "${STUBGEN_OUTPUT_PATH} " --ignore-all-errors
5661 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR }
5762 COMMENT "Generating Python stubs for pyqpp..."
58- VERBATIM ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Release )
59-
60- # Create an empty "py.typed" file in the build directory
61- file (TOUCH "${CMAKE_CURRENT_BINARY_DIR } /py.typed" )
62- install (FILES "${CMAKE_CURRENT_BINARY_DIR } /py.typed" DESTINATION pyqpp)
63-
64- # Install the generated stub directory alongside the module
63+ VERBATIM ) # Install the generated stub directory alongside the module
6564install (DIRECTORY "${STUBGEN_OUTPUT_PATH} /pyqpp/" DESTINATION pyqpp)
You can’t perform that action at this time.
0 commit comments