summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-02-06 12:05:41 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-02-07 09:49:32 +0000
commitbf0c928b13fb2d512c6a80ba3d1d447a4daeaa75 (patch)
tree86539b9332ac7f6cc265558117f401a2ff1162b9
parent2ff9a9ff8d5afbf9b8a347b15cf7d3043219d45c (diff)
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 <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake12
1 files changed, 8 insertions, 4 deletions
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index 919980e3..cbf40110 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")