diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f8f21d..c3c452a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/bin/prep-embed.sh b/bin/prep-embed.sh new file mode 100644 index 0000000..60dda04 --- /dev/null +++ b/bin/prep-embed.sh @@ -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"