diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 21 | ||||
-rw-r--r-- | cmake/opentrack-install.cmake | 41 |
2 files changed, 24 insertions, 38 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index c1d3f4f7..1bd79a97 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -216,30 +216,29 @@ function(opentrack_boilerplate n) endif() endif() - set(SDK_REGEN_TRANSLATIONS FALSE CACHE BOOL "Regenerate translation files on build") - set(langs "") foreach(i ${opentrack-all-translations}) set(t "${CMAKE_CURRENT_SOURCE_DIR}/lang/${i}.ts") + list(APPEND langs "${t}") + get_property(tt GLOBAL PROPERTY "opentrack-ts-${i}") list(APPEND tt "${t}") set_property(GLOBAL PROPERTY "opentrack-ts-${i}" "${tt}") endforeach() - get_property(modules GLOBAL PROPERTY opentrack-all-modules) list(APPEND modules "${n}") set_property(GLOBAL PROPERTY opentrack-all-modules "${modules}") - if(NOT langs STREQUAL "") - add_custom_command(OUTPUT ${langs} + foreach(i ${langs}) + add_custom_command(OUTPUT ${i} COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang" - COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts ${langs} + COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts "${i}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMENT "Running lupdate for ${n}") - add_custom_target(i18n-module-${n} DEPENDS ${langs}) - else() - add_custom_target(i18n-module-${n}) - endif() + DEPENDS ${${n}-all} + COMMENT "Running lupdate for ${i}") + endforeach() + + add_custom_target(i18n-module-${n} DEPENDS ${langs}) endfunction() diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 66c0edee..28f13a51 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -55,40 +55,27 @@ function(merge_translations) get_property(modules GLOBAL PROPERTY opentrack-all-modules) - set(deps "") - - get_property(maybe-force-i18n GLOBAL PROPERTY opentrack-force-i18n-regen) - - if(SDK_REGEN_TRANSLATIONS OR maybe-force-i18n) - set(maybe-all ALL) - endif() - foreach(i ${opentrack-all-translations}) - get_property(ts_ GLOBAL PROPERTY "opentrack-ts-${i}") - set(ts "") - foreach(i ${ts_}) - list(APPEND ts "${i}") - endforeach() + get_property(ts GLOBAL PROPERTY "opentrack-ts-${i}") - set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm") + set(deps "") foreach(k ${modules}) list(APPEND deps "i18n-module-${k}") endforeach() - if(NOT ts STREQUAL "") - add_custom_command(OUTPUT "${qm-output}" - COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts} -qm "${qm-output}" - DEPENDS ${ts} - COMMENT "Running lrelease for ${i}") - add_custom_target(i18n-lang-${i} ALL DEPENDS "${qm-output}") - list(APPEND all-deps "i18n-lang-${i}") - install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms}) - else() - message(FATAL_ERROR "build logic error: no translations for language ${i}") - endif() + set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm") + + add_custom_command(OUTPUT "${qm-output}" + COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts} -qm "${qm-output}" + DEPENDS ${ts} ${deps} + COMMENT "Running lrelease for ${i}") + + add_custom_target(i18n-lang-${i} ALL DEPENDS "${qm-output}") + + list(APPEND all-deps "i18n-lang-${i}") + install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms}) endforeach() - set(maybe-all "") - add_custom_target(i18n ${maybe-all} DEPENDS ${all-deps} ${deps}) + add_custom_target(i18n DEPENDS ${all-deps} ${deps}) endfunction() |