C
Localization: Localize Safety-Critical Content
cmake_minimum_required(VERSION 3.16) project(localization LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}") find_package(Qt6 REQUIRED COMPONENTS LinguistTools Core SafeRenderer SafeRendererTools SafePlatformAdaptation) set(sources main.cpp ) set (safeqmls "SafeUI.qml" ) # Resource files are passed to qtsafelayouttool set(resource_files "images.qrc" "qml.qrc" ) qt6_add_binary_resources(resources_localization ${resource_files} DESTINATION resource.bin) qsr_add_safelayout(generatelayout_localization SAFE_QMLS ${safeqmls} SAFE_LANGUAGES en fi de uk el ar da et no sv SAFE_TRANSLATION "${CMAKE_CURRENT_LIST_DIR}/translationFiles/safeui" OUTPUT_PATH "${CMAKE_CURRENT_LIST_DIR}/layoutData" SAFE_LAYOUT_FONTS "${CMAKE_CURRENT_LIST_DIR}/fonts" SAFE_RESOURCE "${CMAKE_CURRENT_LIST_DIR}/safeasset.qrc" INPUT_RESOURCES resource.bin) qsr_add_resource(buildresource sources "${CMAKE_CURRENT_LIST_DIR}/safeasset.qrc") set (tsfiles "translationFiles/safeui_ar.ts" "translationFiles/safeui_da.ts" "translationFiles/safeui_de.ts" "translationFiles/safeui_el.ts" "translationFiles/safeui_en.ts" "translationFiles/safeui_et.ts" "translationFiles/safeui_fi.ts" "translationFiles/safeui_no.ts" "translationFiles/safeui_sv.ts" "translationFiles/safeui_uk.ts" ) set_source_files_properties(${tsfiles} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_LIST_DIR}/translationFiles") add_executable(localization WIN32 MACOSX_BUNDLE ${sources} ${resource_files} ) qt_add_lupdate(generatelayout_localization TS_FILES tsfiles) qt_add_lrelease(generatelayout_localization TS_FILES ${tsfiles} NO_TARGET_DEPENDENCY QM_FILES_OUTPUT_VARIABLE qmfiles ) add_dependencies(generatelayout_localization generatelayout_localization_lrelease) add_dependencies(localization generatelayout_localization) target_link_libraries(localization PUBLIC Qt::SafeRenderer Qt::SafePlatformAdaptation ) if(lupdate_only) target_sources(localization PUBLIC SafeUI.qml ) endif() if(NOT CMAKE_CROSSCOMPILING) target_compile_definitions(localization PUBLIC HOST_BUILD ) endif() install(TARGETS localization RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" )