7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 00:21:31 +00:00

Avoid rebuilding the bitmap tar every single build by cheesing cmake targets

This commit is contained in:
Marek Roszko 2025-01-14 20:45:22 -05:00
parent 5c3004b96e
commit 9dc0bb2c89

View File

@ -901,15 +901,26 @@ set( TARFLAGS cfz )
if( DEFINED ENV{SOURCE_DATE_EPOCH} )
set( TARFLAGS --sort=name --mtime=@$ENV{SOURCE_DATE_EPOCH} --clamp-mtime --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime -czf )
endif()
add_custom_target( bitmap_archive ALL
# This is a dummy target to bind the custom command to something we can reuse in other calls
# i.e. we want to dynamically make bitmap_archive depend on generate_pngs target after wards
add_custom_target( bitmap_archive_bundle ALL )
# We use a custom command here because it will avoid running the command
# on every cmake build if there are no depends changes
add_custom_command(
OUTPUT ${BITMAP_ARCHIVE_PATH}
COMMAND ${TAR} ${TARFLAGS} "${TAR_OUTPUT_FILE}" .
DEPENDS ${ALL_PNGS}
BYPRODUCTS ${BITMAP_ARCHIVE_PATH}
DEPENDS bitmap_archive_bundle ${ALL_PNGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/png
COMMENT "Creating image archive ${TAR_OUTPUT_FILE}"
VERBATIM
)
# This is the second target we need to require the custom_command to generate and potentially run
add_custom_target( bitmap_archive_build ALL
DEPENDS ${BITMAP_ARCHIVE_PATH})
install( FILES ${BITMAP_ARCHIVE_PATH}
DESTINATION ${KICAD_DATA}/resources
)
@ -991,6 +1002,6 @@ if( MAINTAIN_PNGS )
COMMENT "Creating PNGs from SVGs"
)
add_dependencies( bitmap_archive generate_pngs )
add_dependencies( bitmap_archive_pre generate_pngs )
endif( MAINTAIN_PNGS )