CMake: add QCONF_BUILD, missing Qt translation in binary fixed
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3f910c16b0
commit
94fb78c59a
2 changed files with 49 additions and 3 deletions
|
@ -12,6 +12,7 @@ set(CMAKE_CXX_STANDARD 11)
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt5 COMPONENTS Network Svg Widgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS LinguistTools QUIET)
|
||||
|
||||
set(GTA5VIEW_SOURCES
|
||||
main.cpp
|
||||
|
@ -125,19 +126,61 @@ set(GTA5VIEW_DEFINES
|
|||
)
|
||||
|
||||
set(GTA5VIEW_RESOURCES
|
||||
res/tr_g5p.qrc
|
||||
res/app_cmake.qrc
|
||||
res/global.qrc
|
||||
)
|
||||
|
||||
set_property(SOURCE res/global.qrc PROPERTY AUTORCC_OPTIONS "-threshold;0;-compress;9")
|
||||
|
||||
if(Qt5LinguistTools_FOUND)
|
||||
qt5_add_translation(GTA5VIEW_TRANSLATIONS
|
||||
res/gta5sync_de.ts
|
||||
res/gta5sync_en_US.ts
|
||||
res/gta5sync_fr.ts
|
||||
res/gta5sync_ko.ts
|
||||
res/gta5sync_ru.ts
|
||||
res/gta5sync_uk.ts
|
||||
res/gta5sync_zh_TW.ts
|
||||
res/qtbase_en_GB.ts
|
||||
)
|
||||
add_custom_target(translations DEPENDS ${GTA5VIEW_TRANSLATIONS})
|
||||
else()
|
||||
set(GTA5VIEW_TRANSLATIONS
|
||||
res/gta5sync_de.qm
|
||||
res/gta5sync_en_US.qm
|
||||
res/gta5sync_fr.qm
|
||||
res/gta5sync_ko.qm
|
||||
res/gta5sync_ru.qm
|
||||
res/gta5sync_uk.qm
|
||||
res/gta5sync_zh_TW.qm
|
||||
res/qtbase_en_GB.qm
|
||||
)
|
||||
endif()
|
||||
|
||||
option(QCONF_BUILD "System installation intended QCONF build" OFF)
|
||||
|
||||
if(QCONF_BUILD)
|
||||
list(APPEND GTA5VIEW_DEFINES
|
||||
-DGTA5SYNC_QCONF
|
||||
)
|
||||
else()
|
||||
list(APPEND GTA5VIEW_RESOURCES
|
||||
res/tr_g5p.qrc
|
||||
res/tr_qt5.qrc
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(gta5view
|
||||
${GTA5VIEW_HEADERS}
|
||||
${GTA5VIEW_SOURCES}
|
||||
${GTA5VIEW_FORMS}
|
||||
${GTA5VIEW_RESOURCES}
|
||||
)
|
||||
|
||||
if(Qt5LinguistTools_FOUND AND QCONF_BUILD)
|
||||
add_dependencies(gta5view translations)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0")
|
||||
target_precompile_headers(gta5view PRIVATE config.h)
|
||||
endif()
|
||||
|
@ -149,3 +192,7 @@ target_link_libraries(gta5view PRIVATE Qt5::Network Qt5::Svg Qt5::Widgets)
|
|||
install(TARGETS gta5view DESTINATION bin)
|
||||
install(FILES res/gta5view.desktop DESTINATION share/applications)
|
||||
install(FILES res/gta5view.png DESTINATION share/pixmaps)
|
||||
|
||||
if(QCONF_BUILD)
|
||||
install(FILES ${GTA5VIEW_TRANSLATIONS} DESTINATION share/gta5view/translations)
|
||||
endif()
|
||||
|
|
|
@ -146,7 +146,6 @@ DISTFILES += res/app.rc \
|
|||
res/gta5view.desktop \
|
||||
res/gta5sync_de.ts \
|
||||
res/gta5sync_en_US.ts \
|
||||
res/gta5sync_es.ts \
|
||||
res/gta5sync_fr.ts \
|
||||
res/gta5sync_ko.ts \
|
||||
res/gta5sync_ru.ts \
|
||||
|
@ -229,7 +228,7 @@ contains(DEFINES, GTA5SYNC_QCONF){
|
|||
!contains(DEFINES, GTA5SYNC_QCONF_IN){
|
||||
RESOURCES -= res/tr_g5p.qrc
|
||||
langfiles.path = $$GTA5SYNC_PREFIX/share/gta5view/translations
|
||||
langfiles.files = $$PWD/res/gta5sync_en_US.qm $$PWD/res/gta5sync_de.qm $$PWD/res/gta5sync_fr.qm $$PWD/res/gta5sync_ko.qm $$PWD/res/gta5sync_ru.qm $$PWD/res/gta5sync_uk.qm $$PWD/res/gta5sync_zh_TW.qm $$PWD/res/qtbase_en_GB.qm $$PWD/res/qtbase_zh_TW.qm
|
||||
langfiles.files = $$PWD/res/gta5sync_en_US.qm $$PWD/res/gta5sync_de.qm $$PWD/res/gta5sync_fr.qm $$PWD/res/gta5sync_ko.qm $$PWD/res/gta5sync_ru.qm $$PWD/res/gta5sync_uk.qm $$PWD/res/gta5sync_zh_TW.qm $$PWD/res/qtbase_en_GB.qm
|
||||
INSTALLS += langfiles
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue