1234567891011 |
- cmake_minimum_required(VERSION 3.18)
- FILE(SIZE ${LANG_FILE} FILE_SIZE)
- get_filename_component(FILE_BASE ${LANG_FILE} NAME)
- MATH(EXPR PADDED_SIZE "((${FILE_SIZE}+4096-1) / 4096 * 4096 )")
- message(STATUS "${FILE_BASE} raw size ${FILE_SIZE} bytes (${PADDED_SIZE} b padded)")
- if(${PADDED_SIZE} GREATER ${LANG_MAX_SIZE})
- message(FATAL_ERROR "Language file ${FILE_BASE} (${PADDED_SIZE}b) exceeds maximum allowed size of ${LANG_MAX_SIZE} bytes - Aborting!")
- else()
- MATH(EXPR SIZE_PCT "( ${PADDED_SIZE} * 100) / ${LANG_MAX_SIZE} " )
- message(STATUS "Language file ${FILE_BASE} is ${PADDED_SIZE} bytes, ${SIZE_PCT}% of allowed space - OK")
- endif()
|