Commit 00a912d9 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed dependency chain in embed_assets

parent 70a85252
......@@ -13,26 +13,14 @@ endif()
macro(mirrage_embed_asset target src_files)
string (REPLACE ";" "$<SEMICOLON>" src_files_str "${src_files}")
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.zip"
COMMAND ${CMAKE_COMMAND} -DSRC_FILES=${src_files_str} -DDST_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${MIRRAGE_ROOT_DIR}/copy_recursive.cmake
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s"
set(ID "mirrage_embedded_asset_${target}")
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s"
COMMAND ${CMAKE_COMMAND} -DMIRRAGE_ROOT_DIR=${MIRRAGE_ROOT_DIR} -DID=${ID} -DSRC_FILES=${src_files_str} -DDST_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${MIRRAGE_ROOT_DIR}/embed_recursive_into_asm.cmake
DEPENDS ${ARGN}
VERBATIM
)
set(ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.zip")
set(ID "mirrage_embedded_asset_${target}")
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s" CONTENT
" .global ${ID}
.global ${ID}_size
.section .rodata
${ID}:
.incbin \"${ARCHIVE}\"
1:
${ID}_size:
.int 1b - ${ID}
")
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.cpp" CONTENT
"#include <mirrage/asset/embedded_asset.hpp>
......@@ -60,7 +48,7 @@ void ref_embedded_assets_${target}() {
endif()
target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s")
target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.cpp")
add_custom_target(mirrage_embedded_assets_${target} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.zip" "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s")
add_custom_target(mirrage_embedded_assets_${target} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s")
add_dependencies(${target} mirrage_embedded_assets_${target})
endmacro()
......@@ -31,3 +31,6 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${DST_DIR}/embedded_asset
OUTPUT_QUIET
)
configure_file(${MIRRAGE_ROOT_DIR}/embedded_assets.s.in "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s")
execute_process(COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/embedded_assets.s" OUTPUT_QUIET)
.global ${ID}
.global ${ID}_size
.section .rodata
${ID}:
.incbin "${DST_DIR}/embedded_assets.zip"
1:
${ID}_size:
.int 1b - ${ID}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment