summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/Embed.cmake9
-rwxr-xr-xres/bincat.sh22
2 files changed, 30 insertions, 1 deletions
diff --git a/res/Embed.cmake b/res/Embed.cmake
index bab06347..1a971cc1 100644
--- a/res/Embed.cmake
+++ b/res/Embed.cmake
@@ -3,9 +3,16 @@
3# License: BSD 2-Clause 3# License: BSD 2-Clause
4 4
5option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF) 5option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF)
6option (ENABLE_BINCAT_SH "Prepare resource files using the 'bincat.sh' shell script" ON)
7
8if (ENABLE_BINCAT_SH OR CMAKE_CROSSCOMPILING)
9 set (embed_use_bincat_sh YES)
10endif ()
6 11
7# Build "bincat" for concatenating files. 12# Build "bincat" for concatenating files.
8if (NOT ENABLE_RESOURCE_EMBED) 13if (embed_use_bincat_sh)
14 set (BINCAT_COMMAND ${CMAKE_SOURCE_DIR}/res/bincat.sh)
15elseif (NOT ENABLE_RESOURCE_EMBED)
9 message (STATUS "Compiling bincat for merging resource files...") 16 message (STATUS "Compiling bincat for merging resource files...")
10 set (_catDir ${CMAKE_BINARY_DIR}/res) 17 set (_catDir ${CMAKE_BINARY_DIR}/res)
11 execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory ${_catDir}) 18 execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory ${_catDir})
diff --git a/res/bincat.sh b/res/bincat.sh
new file mode 100755
index 00000000..46483998
--- /dev/null
+++ b/res/bincat.sh
@@ -0,0 +1,22 @@
1#!/bin/sh
2# Binary Resource Concatenator
3# Copyright: 2021 Jaakko Keränen <jaakko.keranen@iki.fi>
4# License: BSD 2-Clause
5
6OUTPUT=--
7SIZES=""
8for fn in $*; do
9 if [ "$OUTPUT" == "--" ]; then
10 OUTPUT=$fn
11 rm -f ${OUTPUT}
12 else
13 vals=(`/bin/ls -l $fn`)
14 if [ "$SIZES" == "" ]; then
15 SIZES=${vals[4]}
16 else
17 SIZES=$SIZES\;${vals[4]}
18 fi
19 cat ${fn} >> ${OUTPUT}
20 fi
21done
22echo $SIZES