diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-31 12:23:26 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-31 12:23:26 +0200 |
commit | 98f5ab5aa00f4d6b83079e6ee4e228b401356198 (patch) | |
tree | 3760877ce19431b821b66ae8b43a9fecea201460 /Resources.cmake | |
parent | a7596f683456da5274ecb33d4043a9eb47858c99 (diff) |
Changed format of resources.lgr
Resources are now stored in a ZIP archive, and it comes with an explicit version number. All the old embed/bincat stuff was removed as unnecessary.
resources.lgr is also a valid fontpack, for loading the built-in fonts.
IssueID #363
Diffstat (limited to 'Resources.cmake')
-rw-r--r-- | Resources.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Resources.cmake b/Resources.cmake new file mode 100644 index 00000000..fc5d20c6 --- /dev/null +++ b/Resources.cmake | |||
@@ -0,0 +1,27 @@ | |||
1 | find_program (ZIP_EXECUTABLE zip DOC "ZIP archiver") | ||
2 | if (NOT ZIP_EXECUTABLE) | ||
3 | message (FATAL_ERROR "Please install 'zip' for packaging resources.") | ||
4 | endif () | ||
5 | |||
6 | function (make_resources dst) | ||
7 | list (REMOVE_AT ARGV 0) | ||
8 | set (files) | ||
9 | foreach (arg ${ARGV}) | ||
10 | get_filename_component (name ${arg} NAME) | ||
11 | if (NOT "${name}" MATCHES "^\\..*") | ||
12 | string (SUBSTRING ${arg} 4 -1 rel) | ||
13 | list (APPEND files ${rel}) | ||
14 | endif () | ||
15 | endforeach (arg) | ||
16 | file (REMOVE ${dst}) | ||
17 | get_filename_component (dstName ${dst} NAME) | ||
18 | message (STATUS " ${dstName}") | ||
19 | set (versionTempPath ${CMAKE_SOURCE_DIR}/res/VERSION) | ||
20 | file (WRITE ${versionTempPath} ${PROJECT_VERSION}) | ||
21 | execute_process ( | ||
22 | COMMAND ${ZIP_EXECUTABLE} -1 ${dst} VERSION ${files} | ||
23 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res | ||
24 | OUTPUT_QUIET | ||
25 | ) | ||
26 | file (REMOVE ${versionTempPath}) | ||
27 | endfunction () | ||