mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Merge pull request #9691 from zeule/cmake
cmake: restore out-of-source build
This commit is contained in:
commit
5ccd4b3611
48
cmake/Modules/QbtTranslations.cmake
Normal file
48
cmake/Modules/QbtTranslations.cmake
Normal file
@ -0,0 +1,48 @@
|
||||
# macros to handle translation files
|
||||
|
||||
# qbt_add_translations(<target> QRC_FILE <filename> TS_FILES <filenames>)
|
||||
# handles out of source builds for Qt resource files that include translations
|
||||
# The function generates translations out of the supplied list of .ts files in the build directory,
|
||||
# copies the .qrc file there, calls qt5_add_resources() adds its output to the target sources list.
|
||||
function(qbt_add_translations _target)
|
||||
set(oneValueArgs QRC_FILE)
|
||||
set(multiValueArgs TS_FILES)
|
||||
cmake_parse_arguments(QBT_TR "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
get_target_property(_binaryDir ${_target} BINARY_DIR)
|
||||
|
||||
if (NOT QBT_TR_QRC_FILE)
|
||||
message(FATAL_ERROR "QRC file is empty")
|
||||
endif()
|
||||
if (NOT QBT_TR_TS_FILES)
|
||||
message(FATAL_ERROR "TS_FILES files are empty")
|
||||
endif()
|
||||
|
||||
if(IS_ABSOLUTE "${QBT_TR_QRC_FILE}")
|
||||
file(RELATIVE_PATH _qrcToTs "${CMAKE_CURRENT_SOURCE_DIR}" "${QBT_TR_QRC_FILE}")
|
||||
else()
|
||||
set(_qrcToTs "${QBT_TR_QRC_FILE}")
|
||||
endif()
|
||||
|
||||
get_filename_component(_qrcToTsDir "${_qrcToTs}" DIRECTORY)
|
||||
|
||||
get_filename_component(_qmFilesBinaryDir "${CMAKE_CURRENT_BINARY_DIR}/${_qrcToTsDir}" ABSOLUTE)
|
||||
# to make qt5_add_translation() work as we need
|
||||
set_source_files_properties(${QBT_TR_TS_FILES} PROPERTIES OUTPUT_LOCATION "${_qmFilesBinaryDir}")
|
||||
qt5_add_translation(_qmFiles ${QBT_TR_TS_FILES})
|
||||
|
||||
set(_qrc_dest_dir "${_binaryDir}/${_qrcToTsDir}")
|
||||
set(_qrc_dest_file "${_binaryDir}/${QBT_TR_QRC_FILE}")
|
||||
|
||||
message(STATUS "copying ${QBT_TR_QRC_FILE} to ${_qrc_dest_dir}")
|
||||
file(COPY ${QBT_TR_QRC_FILE} DESTINATION ${_qrc_dest_dir})
|
||||
|
||||
set_source_files_properties("${_qrc_dest_file}" PROPERTIES
|
||||
GENERATED True
|
||||
OBJECT_DEPENDS "${_qmFiles}")
|
||||
|
||||
# With AUTORCC enabled rcc is ran by cmake before language files are generated,
|
||||
# and thus we call rcc explicitly
|
||||
qt5_add_resources(_resources "${_qrc_dest_file}")
|
||||
target_sources(${_target} PRIVATE "${_resources}")
|
||||
endfunction()
|
@ -13,7 +13,7 @@ if (Boost_VERSION VERSION_LESS 106000)
|
||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
endif()
|
||||
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
|
||||
find_package(Qt5Widgets ${requiredQtVersion})
|
||||
if (Qt5Widgets_FOUND)
|
||||
find_package(Qt5DBus ${requiredQtVersion})
|
||||
|
@ -23,29 +23,19 @@ set_target_properties(qBittorrent
|
||||
)
|
||||
|
||||
# translations
|
||||
include(QbtTranslations)
|
||||
|
||||
file(GLOB QBT_TS_FILES ../lang/*.ts)
|
||||
get_filename_component(QBT_QM_FILES_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
|
||||
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${QBT_QM_FILES_BINARY_DIR}")
|
||||
qbt_add_translations(qBittorrent QRC_FILE "../lang/lang.qrc" TS_FILES ${QBT_TS_FILES})
|
||||
|
||||
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
|
||||
|
||||
get_filename_component(_lang_qrc_src "${CMAKE_CURRENT_SOURCE_DIR}/../lang/lang.qrc" ABSOLUTE)
|
||||
get_filename_component(_lang_qrc_dst "${CMAKE_CURRENT_BINARY_DIR}/../lang/lang.qrc" ABSOLUTE)
|
||||
get_filename_component(_lang_qrc_dst_dir "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
|
||||
|
||||
message(STATUS "copying ${_lang_qrc_src} -> ${_lang_qrc_dst}")
|
||||
file(COPY ${_lang_qrc_src} DESTINATION ${_lang_qrc_dst_dir})
|
||||
|
||||
set_source_files_properties("${_lang_qrc_dst}" PROPERTIES GENERATED True)
|
||||
foreach(qm_file ${QBT_QM_FILES})
|
||||
set_source_files_properties("${_lang_qrc_dst}" PROPERTIES OBJECT_DEPENDS ${qm_file})
|
||||
endforeach()
|
||||
if (WEBUI)
|
||||
file(GLOB QBT_WEBUI_TS_FILES ../webui/www/translations/*.ts)
|
||||
qbt_add_translations(qBittorrent QRC_FILE "../webui/www/translations/webui_translations.qrc" TS_FILES ${QBT_WEBUI_TS_FILES})
|
||||
endif()
|
||||
|
||||
set(QBT_APP_RESOURCES
|
||||
../icons/icons.qrc
|
||||
../searchengine/searchengine.qrc
|
||||
"${_lang_qrc_dst}"
|
||||
)
|
||||
|
||||
# With AUTORCC rcc is ran by cmake before language files are generated,
|
||||
|
@ -27,7 +27,7 @@ SOURCES += \
|
||||
$$PWD/webapplication.cpp \
|
||||
$$PWD/webui.cpp
|
||||
|
||||
RESOURCES += $$PWD/www/webui.qrc
|
||||
RESOURCES += $$PWD/www/webui.qrc $$PWD/www/translations/webui_translations.qrc
|
||||
|
||||
# WebUI Translation
|
||||
isEmpty(QMAKE_LRELEASE) {
|
||||
|
54
src/webui/www/translations/webui_translations.qrc
Normal file
54
src/webui/www/translations/webui_translations.qrc
Normal file
@ -0,0 +1,54 @@
|
||||
<RCC>
|
||||
<qresource prefix="/www/translations">
|
||||
<file>webui_ar.qm</file>
|
||||
<file>webui_be.qm</file>
|
||||
<file>webui_bg.qm</file>
|
||||
<file>webui_ca.qm</file>
|
||||
<file>webui_cs.qm</file>
|
||||
<file>webui_da.qm</file>
|
||||
<file>webui_de.qm</file>
|
||||
<file>webui_el.qm</file>
|
||||
<file>webui_en.qm</file>
|
||||
<file>webui_en_AU.qm</file>
|
||||
<file>webui_en_GB.qm</file>
|
||||
<file>webui_eo.qm</file>
|
||||
<file>webui_es.qm</file>
|
||||
<file>webui_eu.qm</file>
|
||||
<file>webui_fi.qm</file>
|
||||
<file>webui_fr.qm</file>
|
||||
<file>webui_gl.qm</file>
|
||||
<file>webui_he.qm</file>
|
||||
<file>webui_hi_IN.qm</file>
|
||||
<file>webui_hr.qm</file>
|
||||
<file>webui_hu.qm</file>
|
||||
<file>webui_hy.qm</file>
|
||||
<file>webui_id.qm</file>
|
||||
<file>webui_is.qm</file>
|
||||
<file>webui_it.qm</file>
|
||||
<file>webui_ja.qm</file>
|
||||
<file>webui_ka.qm</file>
|
||||
<file>webui_ko.qm</file>
|
||||
<file>webui_lt.qm</file>
|
||||
<file>webui_lv_LV.qm</file>
|
||||
<file>webui_ms_MY.qm</file>
|
||||
<file>webui_nb.qm</file>
|
||||
<file>webui_nl.qm</file>
|
||||
<file>webui_oc.qm</file>
|
||||
<file>webui_pl.qm</file>
|
||||
<file>webui_pt_BR.qm</file>
|
||||
<file>webui_pt_PT.qm</file>
|
||||
<file>webui_ro.qm</file>
|
||||
<file>webui_ru.qm</file>
|
||||
<file>webui_sk.qm</file>
|
||||
<file>webui_sl.qm</file>
|
||||
<file>webui_sr.qm</file>
|
||||
<file>webui_sv.qm</file>
|
||||
<file>webui_tr.qm</file>
|
||||
<file>webui_uk.qm</file>
|
||||
<file>webui_uz@Latn.qm</file>
|
||||
<file>webui_vi.qm</file>
|
||||
<file>webui_zh.qm</file>
|
||||
<file>webui_zh_HK.qm</file>
|
||||
<file>webui_zh_TW.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -45,55 +45,5 @@
|
||||
<file>public/css/login.css</file>
|
||||
<file>public/login.html</file>
|
||||
<file>public/scripts/lib/mootools-1.2-core-yc.js</file>
|
||||
<file>translations/webui_ar.qm</file>
|
||||
<file>translations/webui_be.qm</file>
|
||||
<file>translations/webui_bg.qm</file>
|
||||
<file>translations/webui_ca.qm</file>
|
||||
<file>translations/webui_cs.qm</file>
|
||||
<file>translations/webui_da.qm</file>
|
||||
<file>translations/webui_de.qm</file>
|
||||
<file>translations/webui_el.qm</file>
|
||||
<file>translations/webui_en.qm</file>
|
||||
<file>translations/webui_en_AU.qm</file>
|
||||
<file>translations/webui_en_GB.qm</file>
|
||||
<file>translations/webui_eo.qm</file>
|
||||
<file>translations/webui_es.qm</file>
|
||||
<file>translations/webui_eu.qm</file>
|
||||
<file>translations/webui_fi.qm</file>
|
||||
<file>translations/webui_fr.qm</file>
|
||||
<file>translations/webui_gl.qm</file>
|
||||
<file>translations/webui_he.qm</file>
|
||||
<file>translations/webui_hi_IN.qm</file>
|
||||
<file>translations/webui_hr.qm</file>
|
||||
<file>translations/webui_hu.qm</file>
|
||||
<file>translations/webui_hy.qm</file>
|
||||
<file>translations/webui_id.qm</file>
|
||||
<file>translations/webui_is.qm</file>
|
||||
<file>translations/webui_it.qm</file>
|
||||
<file>translations/webui_ja.qm</file>
|
||||
<file>translations/webui_ka.qm</file>
|
||||
<file>translations/webui_ko.qm</file>
|
||||
<file>translations/webui_lt.qm</file>
|
||||
<file>translations/webui_lv_LV.qm</file>
|
||||
<file>translations/webui_ms_MY.qm</file>
|
||||
<file>translations/webui_nb.qm</file>
|
||||
<file>translations/webui_nl.qm</file>
|
||||
<file>translations/webui_oc.qm</file>
|
||||
<file>translations/webui_pl.qm</file>
|
||||
<file>translations/webui_pt_BR.qm</file>
|
||||
<file>translations/webui_pt_PT.qm</file>
|
||||
<file>translations/webui_ro.qm</file>
|
||||
<file>translations/webui_ru.qm</file>
|
||||
<file>translations/webui_sk.qm</file>
|
||||
<file>translations/webui_sl.qm</file>
|
||||
<file>translations/webui_sr.qm</file>
|
||||
<file>translations/webui_sv.qm</file>
|
||||
<file>translations/webui_tr.qm</file>
|
||||
<file>translations/webui_uk.qm</file>
|
||||
<file>translations/webui_uz@Latn.qm</file>
|
||||
<file>translations/webui_vi.qm</file>
|
||||
<file>translations/webui_zh.qm</file>
|
||||
<file>translations/webui_zh_HK.qm</file>
|
||||
<file>translations/webui_zh_TW.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
x
Reference in New Issue
Block a user