X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=5330663dbf755100dfb99c42296e14a9681d8a43;hb=6fca27657e1f66c718d609cb7eb5e90bb1f49ff6;hp=3770f1e4d6eafc994930ab358fd58ce7ee46660c;hpb=adf9e02242336548a384c23dadc062af7a2ef83a;p=pulseview.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3770f1e4..5330663d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ ## ## Copyright (C) 2012 Joel Holdsworth ## Copyright (C) 2012-2013 Alexandru Gagniuc +## Copyright (C) 2020 Soeren Apel ## ## This program is free software: you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -101,7 +102,7 @@ pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS}) set(CMAKE_AUTOMOC TRUE) -find_package(Qt5 5.3 COMPONENTS Core Gui Widgets Svg REQUIRED) +find_package(Qt5 5.3 COMPONENTS Core Gui LinguistTools Widgets Svg REQUIRED) message(STATUS "Qt version: ${Qt5_VERSION}") @@ -422,6 +423,21 @@ endif() qt5_add_resources(pulseview_RESOURCES_RCC ${pulseview_RESOURCES}) +#=============================================================================== +#= Translations +#------------------------------------------------------------------------------- + +file(GLOB TS_FILES ${CMAKE_SOURCE_DIR}/l10n/*.ts) +set_property(SOURCE ${TS_FILES} PROPERTY OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/l10n) +if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + configure_file("translations.qrc" "translations.qrc" COPYONLY) +endif () + +qt5_add_translation(QM_FILES ${TS_FILES}) +qt5_create_translation(QM_FILES ${pulseview_SOURCES} ${TS_FILES}) + +qt5_add_resources(pulseview_RESOURCES_RCC ${CMAKE_BINARY_DIR}/translations.qrc) + #=============================================================================== #= Global Definitions #------------------------------------------------------------------------------- @@ -512,10 +528,11 @@ if(ANDROID) list(APPEND PULSEVIEW_LINK_LIBS "-llog") endif() +set(INPUT_FILES_LIST ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC} ${QM_FILES}) if(ANDROID) - add_library(${PROJECT_NAME} SHARED ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC}) + add_library(${PROJECT_NAME} SHARED ${INPUT_FILES_LIST}) else() - add_executable(${PROJECT_NAME} ${pulseview_SOURCES} ${pulseview_RESOURCES_RCC}) + add_executable(${PROJECT_NAME} ${INPUT_FILES_LIST}) endif() target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})