Skip to content

Commit 8b5c4b2

Browse files
committed
COMP: Fix unnecessary wrapping hierarchy file regeneration
https://discourse.vtk.org/t/python-wrapping-is-slow-on-windows/5862/11 Fixes #22
1 parent 5f04063 commit 8b5c4b2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

CMake/vtkWrapHierarchy.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,17 @@ $<$<BOOL:$<TARGET_PROPERTY:${module_name},INCLUDE_DIRECTORIES>>:
146146
set(hierarchy_depends ${OTHER_HIERARCHY_TARGETS})
147147
endif ()
148148

149+
# The target depends on ${module_name}Hierarchy.stamp.txt (instead of directly on
150+
# ${module_name}Hierarchy.txt) because this ensures that after any of the dependencies
151+
# (such as vtkWrapHierarchy.exe) changes, the hierarchy file is regenerated once and exactly once.
149152
add_custom_command(
150-
OUTPUT "${OUTPUT_DIR}/${module_name}Hierarchy.txt"
153+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.stamp.txt
154+
"${OUTPUT_DIR}/${module_name}Hierarchy.txt"
151155
COMMAND ${VTK_WRAP_HIERARCHY_EXE}
152156
@${_args_file} -o ${OUTPUT_DIR}/${module_name}Hierarchy.txt
153157
${module_name}Hierarchy.data
154158
@${_other_hierarchy_args_file}
159+
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.stamp.txt
155160
COMMENT "For ${module_name} - updating ${module_name}Hierarchy.txt"
156161
DEPENDS ${VTK_WRAP_HIERARCHY_EXE}
157162
${CMAKE_CURRENT_BINARY_DIR}/${_args_file}
@@ -162,6 +167,6 @@ $<$<BOOL:$<TARGET_PROPERTY:${module_name},INCLUDE_DIRECTORIES>>:
162167
)
163168
add_custom_target(${module_name}Hierarchy
164169
DEPENDS
165-
${OUTPUT_DIR}/${module_name}Hierarchy.txt)
170+
${CMAKE_CURRENT_BINARY_DIR}/${module_name}Hierarchy.stamp.txt)
166171

167172
endmacro()

0 commit comments

Comments
 (0)