CMake: prevent double work when using parallel make

This commit is contained in:
Matt Penny 2024-10-09 22:49:02 -04:00
parent 87f931a8e4
commit ddac6daeff
4 changed files with 24 additions and 10 deletions

View File

@ -415,7 +415,7 @@ function(_add_material_generate_command INPUT_FILE OUTPUT_LIST)
# TODO: add dependency on skeletool once it is built with CMake
add_custom_command(
DEPENDS
${DEPENDENCY_FILES}
textures ${DEPENDENCY_FILES}
OUTPUT
${OUTPUT_FILE_H} ${OUTPUT_FILE_C}
COMMAND

View File

@ -154,7 +154,10 @@ function(_add_model_generate_command MODEL_NAME MODEL_FBX OUTPUT_LIST)
add_custom_command(
DEPENDS
textures "$<TARGET_PROPERTY:textures,OUTPUTS>"
${CONVERT_ASSET} ${MODEL_FBX} ${MODEL_FLAGS} ${MODEL_MATERIALS}
${CONVERT_ASSET}
${MODEL_FBX}
${MODEL_FLAGS}
${MODEL_MATERIALS}
OUTPUT
${OUTPUT_FILES}
COMMAND
@ -252,7 +255,8 @@ set(DYNAMIC_MODEL_LIST_H "${DYNAMIC_MODEL_LIST_OUT_DIR}/dynamic_model_list.h")
set(DYNAMIC_MODEL_LIST_C "${DYNAMIC_MODEL_LIST_OUT_DIR}/dynamic_model_list.c")
add_custom_command(
DEPENDS
${GEN_DYNAMIC_MODEL_LIST} ${MODEL_LIST_UTILS} ${DYNAMIC_MODEL_HEADERS}
generated_models ${DYNAMIC_MODEL_HEADERS}
${GEN_DYNAMIC_MODEL_LIST} ${MODEL_LIST_UTILS}
OUTPUT
${DYNAMIC_MODEL_LIST_H} ${DYNAMIC_MODEL_LIST_C}
COMMAND
@ -268,7 +272,8 @@ set(DYNAMIC_ANIMATED_MODEL_LIST_H "${DYNAMIC_MODEL_LIST_OUT_DIR}/dynamic_animate
set(DYNAMIC_ANIMATED_MODEL_LIST_C "${DYNAMIC_MODEL_LIST_OUT_DIR}/dynamic_animated_model_list.c")
add_custom_command(
DEPENDS
${GEN_DYNAMIC_ANIM_MODEL_LIST} ${MODEL_LIST_UTILS} ${DYNAMIC_ANIMATED_MODEL_HEADERS}
generated_models ${DYNAMIC_ANIMATED_MODEL_HEADERS}
${GEN_DYNAMIC_ANIM_MODEL_LIST} ${MODEL_LIST_UTILS}
OUTPUT
${DYNAMIC_ANIMATED_MODEL_LIST_H} ${DYNAMIC_ANIMATED_MODEL_LIST_C}
COMMAND

View File

@ -227,7 +227,9 @@ function(_add_sound_transform_command_sox SOUND_SCRIPT INPUT_FILE OUTPUT_FILE)
add_custom_command(
DEPENDS
extract_vpks ${CONVERT_ASSET} ${INPUT_FILE} ${SOUND_SCRIPT}
extract_vpks ${INPUT_FILE}
${CONVERT_ASSET}
${SOUND_SCRIPT}
OUTPUT
${OUTPUT_FILE}
COMMAND
@ -243,7 +245,9 @@ endfunction()
function(_add_sound_transform_command_jsox SOUND_SCRIPT INPUT_FILE OUTPUT_FILE)
add_custom_command(
DEPENDS
extract_vpks ${JSOX} ${INPUT_FILE} ${SOUND_SCRIPT}
extract_vpks ${INPUT_FILE}
${JSOX}
${SOUND_SCRIPT}
OUTPUT
${OUTPUT_FILE}
COMMAND
@ -418,7 +422,7 @@ set(SOUND_DATA_TABLE_FILES
)
add_custom_command(
DEPENDS
${SOUND_TABLE_DEPENDENCIES}
extract_vpks sounds ${SOUND_TABLE_DEPENDENCIES}
OUTPUT
${SOUND_DATA_TABLE_FILES}
COMMAND
@ -439,7 +443,8 @@ set(SOUND_LOOKUP_TABLE_FILES
)
add_custom_command(
DEPENDS
${GEN_SOUND_IDS} ${SOUND_TABLE_DEPENDENCIES}
extract_vpks sounds ${SOUND_TABLE_DEPENDENCIES}
${GEN_SOUND_IDS}
OUTPUT
${SOUND_LOOKUP_TABLE_FILES}
COMMAND

View File

@ -113,7 +113,10 @@ function(_add_level_generate_command LEVEL_NAME LEVEL_FBX OUTPUT_LIST)
add_custom_command(
DEPENDS
textures "$<TARGET_PROPERTY:textures,OUTPUTS>"
${EXPORT_SCRIPTS} ${LEVEL_FBX} ${LEVEL_YAML} ${LEVEL_MATERIALS}
${EXPORT_SCRIPTS}
${LEVEL_FBX}
${LEVEL_YAML}
${LEVEL_MATERIALS}
OUTPUT
${OUTPUT_FILES}
COMMAND
@ -159,7 +162,8 @@ set(LEVEL_LIST "${LEVEL_LIST_OUT_DIR}/level_list.h")
add_custom_command(
DEPENDS
${GEN_LEVEL_LIST} ${MODEL_LIST_UTILS} ${LEVEL_GENERATED_HEADERS}
generated_levels ${LEVEL_GENERATED_HEADERS}
${GEN_LEVEL_LIST} ${MODEL_LIST_UTILS}
OUTPUT
${LEVEL_LIST}
COMMAND