hopefully more portable way of packaging binary embeds
This commit is contained in:
parent
826622cd58
commit
36c0af9953
@ -364,11 +364,8 @@ target_link_libraries(${TWN_TARGET} PUBLIC
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/font.o
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_LINKER} --relocatable --format binary
|
||||
--output ${CMAKE_CURRENT_BINARY_DIR}/font.o
|
||||
share/assets/Dernyns256.ttf
|
||||
DEPENDS share/assets/Dernyns256.ttf
|
||||
)
|
||||
COMMAND ${CMAKE_COMMAND} -E env CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} sh bin/prep-embed.sh
|
||||
DEPENDS share/assets/Dernyns256.ttf)
|
||||
|
||||
add_custom_target(asset-compilation ALL DEPENDS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/font.o)
|
||||
|
8
bin/prep-embed.sh
Normal file
8
bin/prep-embed.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/env sh
|
||||
set -e
|
||||
# packages embedded resources with objcopy, so that it is more portable
|
||||
# ld.lld on windows doesn't recognize --format binary, sadly
|
||||
|
||||
objdump=$(objdump -i)
|
||||
bdfname=$(echo "$objdump" | sed -n 2p)
|
||||
objcopy -I binary -O "$bdfname" share/assets/Dernyns256.ttf "$CMAKE_CURRENT_BINARY_DIR/font.o"
|
Loading…
Reference in New Issue
Block a user