mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
da400f6d66
This makes three big changes to how translation files are generated: - use Qt5 cmake built-in commands to do the translations rather than calling lrelease directly. lrelease is often not in the path, while Qt5 cmake knows how to find and invoke it. - Slam the resulting files into a C++ file using a cmake script rather than needing to compile a .c file to generate C++ file. This is simpler, but more importantly avoids the mess needed when cross compiling of having to import a cmake script from an external native build. - In the actual generated files, use an unordered_map rather than a massive list of static variable pointers.
11 lines
396 B
CMake
11 lines
396 B
CMake
|
|
set(TRANSLATION_FILES "")
|
|
foreach(qm_file ${qm_files})
|
|
file(READ "${qm_file}" trans_data HEX)
|
|
file(RELATIVE_PATH basename "${base_dir}" "${qm_file}")
|
|
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "\\\\x\\1" trans_data "${trans_data}")
|
|
set(TRANSLATION_FILES "${TRANSLATION_FILES} {\"${basename}\"s, \"${trans_data}\"s},\n")
|
|
endforeach()
|
|
|
|
configure_file(${in_file} ${out_file} @ONLY)
|