diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 20 | ||||
-rw-r--r-- | cmake/opentrack-clean-build-directory.cmake | 2 | ||||
-rw-r--r-- | cmake/opentrack-hier.cmake | 3 | ||||
-rw-r--r-- | cmake/opentrack-install.cmake | 28 | ||||
-rw-r--r-- | cmake/opentrack-qt.cmake | 1 |
5 files changed, 53 insertions, 1 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 8efc6129..fc26f685 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -214,4 +214,24 @@ function(opentrack_boilerplate n) opentrack_install_pdb_current_project() endif() endif() + + 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-${i}-ts) + set(tt ${tt} ${t}) + set_property(GLOBAL PROPERTY opentrack-${i}-ts ${tt}) + endforeach() + + get_property(modules GLOBAL PROPERTY opentrack-all-modules) + list(APPEND modules "${n}") + set_property(GLOBAL PROPERTY opentrack-all-modules "${modules}") + + add_custom_target(${n}-i18n + COMMAND cmake -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/lang" + COMMAND "${Qt5_DIR}/../../../bin/lupdate" -silent -recursive -no-obsolete -locations relative . -ts ${langs} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + SOURCES ${langs}) endfunction() + diff --git a/cmake/opentrack-clean-build-directory.cmake b/cmake/opentrack-clean-build-directory.cmake index bf79281e..ab9fffaf 100644 --- a/cmake/opentrack-clean-build-directory.cmake +++ b/cmake/opentrack-clean-build-directory.cmake @@ -37,7 +37,7 @@ function(cleanup_build_dir) # let's hope nothing bad happens
file(REMOVE_RECURSE ${files_})
- execute_process(COMMAND cmake . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" OUTPUT_QUIET)
+ #execute_process(COMMAND cmake . WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" OUTPUT_QUIET)
endfunction()
cleanup_build_dir()
diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index 195b6333..8ba62830 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -17,6 +17,7 @@ if(NOT opentrack-hier-included) set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
set(opentrack-doc-pfx "./doc")
set(opentrack-doc-src-pfx "./source-code")
+ set(opentrack-i18n-pfx "${opentrack-hier-pfx}")
elseif(WIN32)
set(opentrack-hier-pfx "./modules")
set(opentrack-hier-path "/modules/")
@@ -24,6 +25,7 @@ if(NOT opentrack-hier-included) set(opentrack-doc-pfx "./doc")
set(opentrack-doc-src-pfx "./source-code")
set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
+ set(opentrack-i18n-pfx "./i18n")
else()
set(opentrack-hier-pfx "libexec/opentrack")
set(opentrack-hier-path "/../libexec/opentrack/")
@@ -32,6 +34,7 @@ if(NOT opentrack-hier-included) set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code")
set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
set(opentrack-hier-str ARCHIVE DESTINATION lib/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
+ set(opentrack-i18n-pfx "libexec/opentrack/i18n")
endif()
function(opentrack_escape_string var str)
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 601c89c3..3e77e396 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -45,3 +45,31 @@ function(opentrack_install_sources n) endforeach() opentrack_inst2("${opentrack-doc-src-pfx}/${subdir}" FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt") endfunction() + +function(merge_translations) + set(all-deps "") + + install(CODE "file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/i18n\")") + + get_property(modules GLOBAL PROPERTY opentrack-all-modules) + + foreach(i ${opentrack-all-translations}) + get_property(ts GLOBAL PROPERTY opentrack-${i}-ts) + + set(qm-output "${CMAKE_BINARY_DIR}/${i}.qm") + + set(deps "") + foreach(k ${modules}) + list(APPEND deps "${k}-i18n") + endforeach() + + add_custom_target(i18n-lang-${i} + COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts} -qm "${qm-output}" + DEPENDS ${deps} + ) + list(APPEND all-deps "i18n-lang-${i}") + install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms}) + endforeach() + add_custom_target(i18n ALL DEPENDS ${all-deps}) +endfunction() + diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index ded4ec41..bb492eda 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -22,3 +22,4 @@ if(MSVC AND NOT is-msvc EQUAL 0) endforeach() ") endif() + |