Refactor asset copying in CMake configuration for yaze target

- Removed the custom target for copying assets and integrated post-build commands directly into the yaze target.
- Updated commands to create necessary directories and copy asset files (fonts, themes, layouts, libraries) to the output directory, streamlining the build process for Windows and Linux.
This commit is contained in:
scawful
2025-09-28 20:03:57 -04:00
parent 89d0938e89
commit 947c5be06d

View File

@@ -159,13 +159,9 @@ endif()
# Post-build step to copy assets to output directory (Windows/Linux) # Post-build step to copy assets to output directory (Windows/Linux)
if(NOT APPLE) if(NOT APPLE)
# Create custom target for copying assets # Add post-build commands directly to the yaze target
add_custom_target(copy_assets ALL
COMMENT "Copying assets to output directory"
)
# Copy fonts # Copy fonts
add_custom_command(TARGET copy_assets POST_BUILD add_custom_command(TARGET yaze POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:yaze>/assets/font $<TARGET_FILE_DIR:yaze>/assets/font
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
@@ -175,7 +171,7 @@ if(NOT APPLE)
) )
# Copy themes # Copy themes
add_custom_command(TARGET copy_assets POST_BUILD add_custom_command(TARGET yaze POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:yaze>/assets/themes $<TARGET_FILE_DIR:yaze>/assets/themes
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
@@ -186,7 +182,7 @@ if(NOT APPLE)
# Copy other assets if they exist # Copy other assets if they exist
if(EXISTS ${CMAKE_SOURCE_DIR}/assets/layouts) if(EXISTS ${CMAKE_SOURCE_DIR}/assets/layouts)
add_custom_command(TARGET copy_assets POST_BUILD add_custom_command(TARGET yaze POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:yaze>/assets/layouts $<TARGET_FILE_DIR:yaze>/assets/layouts
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
@@ -197,7 +193,7 @@ if(NOT APPLE)
endif() endif()
if(EXISTS ${CMAKE_SOURCE_DIR}/assets/lib) if(EXISTS ${CMAKE_SOURCE_DIR}/assets/lib)
add_custom_command(TARGET copy_assets POST_BUILD add_custom_command(TARGET yaze POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:yaze>/assets/lib $<TARGET_FILE_DIR:yaze>/assets/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
@@ -206,8 +202,5 @@ if(NOT APPLE)
COMMENT "Copying library assets" COMMENT "Copying library assets"
) )
endif() endif()
# Make the main target depend on asset copying
add_dependencies(yaze copy_assets)
endif() endif()