diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 27 | ||||
-rw-r--r-- | cmake/opentrack-install.cmake | 15 | ||||
-rw-r--r-- | cmake/opentrack-qt.cmake | 2 |
3 files changed, 28 insertions, 16 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 8d23ad19..9ca382e8 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -199,7 +199,7 @@ function(opentrack_boilerplate n) if(NOT arg_STATIC) string(REGEX REPLACE "^opentrack-" "" n_ "${n}") - string(REGEX REPLACE "^(tracker|filter-proto)-" "" n_ "${n_}") + string(REGEX REPLACE "^(tracker|filter|proto)-" "" n_ "${n_}") string(REPLACE "-" "_" n_ ${n_}) target_compile_definitions(${n} PRIVATE "BUILD_${n_}") @@ -215,23 +215,30 @@ 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-${i}-ts) - set(tt ${tt} ${t}) - set_property(GLOBAL PROPERTY opentrack-${i}-ts ${tt}) + if(SDK_REGEN_TRANSLATIONS OR NOT EXISTS "${t}") + list(APPEND langs "${t}") + get_property(tt GLOBAL PROPERTY opentrack-${i}-ts) + set(tt ${tt} ${t}) + set_property(GLOBAL PROPERTY opentrack-${i}-ts ${tt}) + endif() 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}" - ) + if(NOT langs STREQUAL "") + add_custom_target(i18n-module-${n} + COMMAND ${CMAKE_COMMAND} -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}") + else() + add_custom_target(i18n-module-${n}) + endif() endfunction() diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 3e77e396..3406007b 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -36,6 +36,8 @@ opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md") opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") +opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") +opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") function(opentrack_install_sources n) opentrack_sources(${n} sources) @@ -60,13 +62,16 @@ function(merge_translations) set(deps "") foreach(k ${modules}) - list(APPEND deps "${k}-i18n") + list(APPEND deps "i18n-module-${k}") endforeach() - add_custom_target(i18n-lang-${i} - COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts} -qm "${qm-output}" - DEPENDS ${deps} - ) + if(NOT "${ts}" STREQUAL "") + add_custom_target(i18n-lang-${i} + COMMAND "${Qt5_DIR}/../../../bin/lrelease" -nounfinished -silent ${ts} -qm "${qm-output}" + DEPENDS ${deps}) + else() + add_custom_target(i18n-lang-${i} DEPENDS ${deps}) + endif() list(APPEND all-deps "i18n-lang-${i}") install(FILES "${qm-output}" DESTINATION "${opentrack-i18n-pfx}" RENAME "${i}.qm" ${opentrack-perms}) endforeach() diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index bb492eda..c6ab2673 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -1,5 +1,5 @@ find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets Gui QUIET) -find_package(Qt5 COMPONENTS SerialPort QUIET) +find_package(Qt5 COMPONENTS SerialPort Gamepad QUIET) include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) |