1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix installation of compiled QM files

This commit is contained in:
Ivan Savenko 2023-01-16 18:02:11 +02:00
parent 96141f010b
commit c252837b6a
3 changed files with 17 additions and 13 deletions

View File

@ -90,6 +90,11 @@ if(APPLE_IOS AND COPY_CONFIG_ON_BUILD)
set(COPY_CONFIG_ON_BUILD OFF)
endif()
# No QT Linguist on MXE
if(${CMAKE_CROSSCOMPILING})
set(ENABLE_TRANSLATIONS OFF)
endif()
############################################
# Miscellaneous options #
############################################
@ -368,12 +373,8 @@ if(ENABLE_LAUNCHER OR ENABLE_EDITOR)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)
find_package(QT NAMES Qt6 Qt5 COMPONENTS LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS LinguistTools)
if(NOT Qt${QT_VERSION_MAJOR}LinguistTools_DIR)
set(ENABLE_TRANSLATIONS OFF)
endif()
if(ENABLE_TRANSLATIONS)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS LinguistTools)
add_definitions(-DENABLE_QT_TRANSLATIONS)
endif()
endif()

View File

@ -96,7 +96,7 @@ if(TARGET Qt6::Core)
else()
qt5_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
if(ENABLE_TRANSLATIONS)
set_source_files_properties(${launcher_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/translation)
set_source_files_properties(${launcher_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translation)
qt5_add_translation( launcher_QM ${launcher_TS} )
endif()
endif()
@ -164,8 +164,10 @@ else()
# Copy to build directory for easier debugging
add_custom_command(TARGET vcmilauncher POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/launcher/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/launcher/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/translation ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/translation
)
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
@ -179,5 +181,5 @@ endif()
install(DIRECTORY icons DESTINATION ${RESOURCES_DESTINATION})
if(ENABLE_TRANSLATIONS)
install(DIRECTORY translation DESTINATION ${RESOURCES_DESTINATION})
install(FILES ${launcher_QM} DESTINATION ${RESOURCES_DESTINATION}/translation)
endif()

View File

@ -98,7 +98,7 @@ if(TARGET Qt6::Core)
else()
qt5_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
if(ENABLE_TRANSLATIONS)
set_source_files_properties(${editor_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/translation)
set_source_files_properties(${editor_TS} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/translation)
qt5_add_translation( editor_QM ${editor_TS} )
endif()
endif()
@ -139,14 +139,15 @@ enable_pch(vcmieditor)
# Copy to build directory for easier debugging
add_custom_command(TARGET vcmieditor POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/mapeditor/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SOURCE_DIR}/mapeditor/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/translation ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/translation
)
install(TARGETS vcmieditor DESTINATION ${BIN_DIR})
# copy whole directory
install(DIRECTORY icons DESTINATION ${DATA_DIR}/mapeditor)
install(DIRECTORY translation DESTINATION ${DATA_DIR}/mapeditor)
install(FILES ${editor_QM} DESTINATION ${DATA_DIR}/mapeditor/translation)
# Install icons and desktop file on Linux
if(NOT WIN32 AND NOT APPLE)
install(FILES "vcmieditor.desktop" DESTINATION share/applications)