From bf0c928b13fb2d512c6a80ba3d1d447a4daeaa75 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 6 Feb 2019 12:05:41 +0100 Subject: Make .pyi file generation a standalone CMake target Rather than using add_custom_command(TARGET foo POST_BUILD) for pyi file generation, use add_custom_target() with add_dependencies() instead. Semantically it should have the same meaning, but I'm hoping this will eliminate the weird race condition build issues that occur with manifest embedding on Windows. Change-Id: I854b8f80fd39363723ab2661b2423461396efc11 Reviewed-by: Cristian Maureira-Fredes --- sources/pyside2/cmake/Macros/PySideModules.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake index 919980e3f..cbf401102 100644 --- a/sources/pyside2/cmake/Macros/PySideModules.cmake +++ b/sources/pyside2/cmake/Macros/PySideModules.cmake @@ -175,10 +175,14 @@ macro(create_pyside_module) if (QUIET_BUILD) list(APPEND generate_pyi_options "--quiet") endif() - add_custom_command( TARGET ${module_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E env ${ld_prefix} - "${SHIBOKEN_PYTHON_INTERPRETER}" - "${CMAKE_CURRENT_SOURCE_DIR}/../support/generate_pyi.py" ${generate_pyi_options}) + + # Add target to generate pyi file, which depends on the module target. + add_custom_target("${module_NAME}_pyi" ALL + COMMAND ${CMAKE_COMMAND} -E env ${ld_prefix} + "${SHIBOKEN_PYTHON_INTERPRETER}" + "${CMAKE_CURRENT_SOURCE_DIR}/../support/generate_pyi.py" ${generate_pyi_options}) + add_dependencies("${module_NAME}_pyi" ${module_NAME}) + # install install(TARGETS ${module_NAME} LIBRARY DESTINATION "${PYTHON_SITE_PACKAGES}/PySide2") -- cgit v1.2.3