Skip to content

Commit 48e8660

Browse files
Kakueeendeepin-bot[bot]
authored andcommitted
fix: optimize lrelease command with additional flags
The lrelease command in the CMake build process has been enhanced with additional flags for better performance and output quality. The changes include adding -compress flag to reduce the size of generated .qm files, -nounfinished to exclude unfinished translations, and -removeidentical to remove identical translations. Additionally, a new custom target 'generate_qm' has been added to ensure all .qm files are generated as part of the build process. Influence: 1. Verify that .qm files are correctly generated during build 2. Check that translation files are smaller in size due to compression 3. Ensure unfinished translations are properly excluded from final output 4. Test that identical translations are removed to avoid redundancy 5. Confirm the generate_qm target builds all translation files as expected fix: 优化 lrelease 命令并添加额外标志 CMake 构建过程中的 lrelease 命令已通过附加标志进行增强,以提高性 能和输出质量。更改包括添加 -compress 标志以减少生成的 .qm 文件大 小,-nounfinished 以排除未完成的翻译,以及 -removeidentical 以移除相同的 翻译。此外,新增了一个自定义目标 'generate_qm',以确保所有 .qm 文件作为 构建过程的一部分被生成。 Influence: 1. 验证构建过程中 .qm 文件是否正确生成 2. 检查翻译文件是否因压缩而体积变小 3. 确保未完成的翻译被正确排除在最终输出之外 4. 测试相同的翻译是否被移除以避免冗余 5. 确认 generate_qm 目标按预期构建所有翻译文件
1 parent d766542 commit 48e8660

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ else()
9090
set(QM_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TS_FILE_NAME}.qm")
9191
add_custom_command(
9292
OUTPUT ${QM_FILE}
93-
COMMAND lrelease ${TS_FILE} -qm ${QM_FILE}
93+
COMMAND lrelease -compress -nounfinished -removeidentical ${TS_FILE} -qm ${QM_FILE}
9494
DEPENDS ${TS_FILE}
9595
COMMENT "Generating ${QM_FILE} from ${TS_FILE}"
9696
)
9797
list(APPEND QM_FILES ${QM_FILE})
9898
endforeach()
99+
add_custom_target(generate_qm ALL DEPENDS ${QM_FILES})
99100
endif()
100101

101102
# 在文件开头部分添加自动 moc 处理

0 commit comments

Comments
 (0)