Skip to content

Commit e8426d9

Browse files
committed
re-work code gen so that it doesnt re-build all the time
1 parent 9f72f60 commit e8426d9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmake/GodotCPPModule.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,16 @@ function(
107107
# Strip newlines and whitespace to make it a one-liner.
108108
string(REGEX REPLACE "\n *" " " PYTHON_SCRIPT "${PYTHON_SCRIPT}")
109109

110-
add_custom_target(
111-
generate_bindings
110+
add_custom_command(
111+
OUTPUT ${GENERATED_FILES_LIST}
112112
COMMAND "${Python3_EXECUTABLE}" "-c" "${PYTHON_SCRIPT}"
113-
BYPRODUCTS ${GENERATED_FILES_LIST}
113+
MAIN_DEPENDENCY ${GODOTCPP_GDEXTENSION_API_FILE}
114+
DEPENDS ${godot-cpp_SOURCE_DIR}/binding_generator.py
114115
WORKING_DIRECTORY ${godot-cpp_SOURCE_DIR}
115116
COMMENT "Generating bindings"
116117
VERBATIM
117-
SOURCES ${godot-cpp_SOURCE_DIR}/binding_generator.py ${GODOTCPP_GDEXTENSION_API_FILE}
118118
)
119+
add_custom_target(generate_bindings DEPENDS ${GENERATED_FILES_LIST})
119120
set_target_properties(generate_bindings PROPERTIES FOLDER "godot-cpp")
120121
endfunction()
121122

0 commit comments

Comments
 (0)