summaryrefslogtreecommitdiff
path: root/Embed.cmake
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-09-02 11:25:03 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-09-02 11:25:03 +0300
commit1e548eac8c63922315f89c96436b622615c488c7 (patch)
treed2c36fdaaa0bcc42cbc34bb804de5a7201dba2b1 /Embed.cmake
parent8ed2faadc4ca2497fc3b2e9d2eae6d40921de918 (diff)
parente2b5ea14d25dbbb62a1e827803e67c30df79c6a1 (diff)
Merge branch 'master' of skyjake.fi:skyjake/lagrange
Diffstat (limited to 'Embed.cmake')
-rw-r--r--Embed.cmake10
1 files changed, 5 insertions, 5 deletions
diff --git a/Embed.cmake b/Embed.cmake
index 4d51f418..c75f19e4 100644
--- a/Embed.cmake
+++ b/Embed.cmake
@@ -2,9 +2,9 @@
2# Copyright: 2020 Jaakko Keränen <jaakko.keranen@iki.fi> 2# Copyright: 2020 Jaakko Keränen <jaakko.keranen@iki.fi>
3# License: BSD 2-Clause 3# License: BSD 2-Clause
4 4
5option (EMBED_IN_EXECUTABLE "Embed resources inside the executable" OFF) 5option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF)
6# Note: If disabled, the Unix "cat" tool is required for concatenating 6# Note: If disabled, the Unix "cat" tool is required for concatenating
7# the resources into a single "resources.bin" file. 7# the resources into a single "resources.binary" file.
8 8
9function (embed_getname output fn) 9function (embed_getname output fn)
10 get_filename_component (name ${fn} NAME_WE) 10 get_filename_component (name ${fn} NAME_WE)
@@ -57,7 +57,7 @@ endfunction (embed_filesize)
57function (embed_make) 57function (embed_make)
58 set (EMB_H ${CMAKE_CURRENT_BINARY_DIR}/embedded.h) 58 set (EMB_H ${CMAKE_CURRENT_BINARY_DIR}/embedded.h)
59 set (EMB_C ${CMAKE_CURRENT_BINARY_DIR}/embedded.c) 59 set (EMB_C ${CMAKE_CURRENT_BINARY_DIR}/embedded.c)
60 if (EMBED_IN_EXECUTABLE) 60 if (ENABLE_RESOURCE_EMBED)
61 set (needGen NO) 61 set (needGen NO)
62 if (NOT EXISTS ${EMB_H} OR NOT EXISTS ${EMB_C}) 62 if (NOT EXISTS ${EMB_H} OR NOT EXISTS ${EMB_C})
63 set (needGen YES) 63 set (needGen YES)
@@ -75,7 +75,7 @@ function (embed_make)
75 set (needGen YES) 75 set (needGen YES)
76 endif () 76 endif ()
77 if (needGen) 77 if (needGen)
78 if (EMBED_IN_EXECUTABLE) 78 if (ENABLE_RESOURCE_EMBED)
79 # Compose a source file with the resource data in an array. 79 # Compose a source file with the resource data in an array.
80 file (WRITE ${EMB_H} "#include <the_Foundation/block.h>\n") 80 file (WRITE ${EMB_H} "#include <the_Foundation/block.h>\n")
81 file (WRITE ${EMB_C} "#include \"embedded.h\"\n") 81 file (WRITE ${EMB_C} "#include \"embedded.h\"\n")
@@ -85,7 +85,7 @@ function (embed_make)
85 endforeach (fn) 85 endforeach (fn)
86 else () 86 else ()
87 # Collect resources in a single binary file. 87 # Collect resources in a single binary file.
88 set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.bin) 88 set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary)
89 file (REMOVE ${EMB_BIN}) 89 file (REMOVE ${EMB_BIN})
90 execute_process (COMMAND cat ${ARGV} OUTPUT_FILE ${EMB_BIN} 90 execute_process (COMMAND cat ${ARGV} OUTPUT_FILE ${EMB_BIN}
91 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 91 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})