aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/yuzu
diff options
context:
space:
mode:
authorlat9nq <[email protected]>2023-11-08 11:27:13 -0500
committerlat9nq <[email protected]>2023-11-08 11:54:05 -0500
commitcb3559539a33da15859bc5f1ded24bdb41f4bd7f (patch)
tree0d2431140811ad14b818103cdce2cd787897c59e /src/yuzu
parent71cdfa6ad576c721227595cac8170fb9095f23e3 (diff)
downloadyuzu-android-cb3559539a33da15859bc5f1ded24bdb41f4bd7f.tar.gz
yuzu-android-cb3559539a33da15859bc5f1ded24bdb41f4bd7f.zip
CMakeLists: Add option to call lupdate directly
qt_create_translation silently fails to run at all on my system. Since there is no error, I was unable to determine a fix. This sidesteps the convenience function by setting up the rules ourselves. This is left as an option since this path likely does not work on Windows.
Diffstat (limited to 'src/yuzu')
-rw-r--r--src/yuzu/CMakeLists.txt51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 33e1fb663..181b2817c 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -252,6 +252,7 @@ file(GLOB_RECURSE THEMES ${PROJECT_SOURCE_DIR}/dist/qt_themes/*)
if (ENABLE_QT_TRANSLATION)
set(YUZU_QT_LANGUAGES "${PROJECT_SOURCE_DIR}/dist/languages" CACHE PATH "Path to the translation bundle for the Qt frontend")
option(GENERATE_QT_TRANSLATION "Generate en.ts as the translation source file" OFF)
+ option(WORKAROUND_BROKEN_LUPDATE "Run lupdate directly through CMake if Qt's convenience wrappers don't work" OFF)
# Update source TS file if enabled
if (GENERATE_QT_TRANSLATION)
@@ -259,19 +260,51 @@ if (ENABLE_QT_TRANSLATION)
# these calls to qt_create_translation also creates a rule to generate en.qm which conflicts with providing english plurals
# so we have to set a OUTPUT_LOCATION so that we don't have multiple rules to generate en.qm
set_source_files_properties(${YUZU_QT_LANGUAGES}/en.ts PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations")
- qt_create_translation(QM_FILES
- ${SRCS}
- ${UIS}
- ${YUZU_QT_LANGUAGES}/en.ts
- OPTIONS
- -source-language en_US
- -target-language en_US
- )
+ if (WORKAROUND_BROKEN_LUPDATE)
+ add_custom_command(OUTPUT ${YUZU_QT_LANGUAGES}/en.ts
+ COMMAND lupdate
+ -source-language en_US
+ -target-language en_US
+ ${SRCS}
+ ${UIS}
+ -ts ${YUZU_QT_LANGUAGES}/en.ts
+ DEPENDS
+ ${SRCS}
+ ${UIS}
+ WORKING_DIRECTORY
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ else()
+ qt_create_translation(QM_FILES
+ ${SRCS}
+ ${UIS}
+ ${YUZU_QT_LANGUAGES}/en.ts
+ OPTIONS
+ -source-language en_US
+ -target-language en_US
+ )
+ endif()
# Generate plurals into dist/english_plurals/generated_en.ts so it can be used to revise dist/english_plurals/en.ts
set(GENERATED_PLURALS_FILE ${PROJECT_SOURCE_DIR}/dist/english_plurals/generated_en.ts)
set_source_files_properties(${GENERATED_PLURALS_FILE} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/plurals")
- qt_create_translation(QM_FILES ${SRCS} ${UIS} ${GENERATED_PLURALS_FILE} OPTIONS -pluralonly -source-language en_US -target-language en_US)
+ if (WORKAROUND_BROKEN_LUPDATE)
+ add_custom_command(OUTPUT ${GENERATED_PLURALS_FILE}
+ COMMAND lupdate
+ -source-language en_US
+ -target-language en_US
+ ${SRCS}
+ ${UIS}
+ -ts ${GENERATED_PLURALS_FILE}
+ DEPENDS
+ ${SRCS}
+ ${UIS}
+ WORKING_DIRECTORY
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ else()
+ qt_create_translation(QM_FILES ${SRCS} ${UIS} ${GENERATED_PLURALS_FILE} OPTIONS -pluralonly -source-language en_US -target-language en_US)
+ endif()
add_custom_target(translation ALL DEPENDS ${YUZU_QT_LANGUAGES}/en.ts ${GENERATED_PLURALS_FILE})
endif()