From 1fc4cce5de90b2db6cbc523f7833734a0e524813 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Tue, 8 Feb 2022 16:20:24 -0500 Subject: [PATCH] CMake: Set OUTPUT_NAME on plugin libraries to the correct language name Work around CMake's handling of @ inside argument names that then end up getting defined as variable names in language_plugin as well. We also need to set the OUTPUT_NAME of these plugins back to the unmodified language value, so that the plugins can be properly loaded by the keyboard. --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edd340b1..2233e11b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,6 +205,13 @@ target_include_directories(westernsupport PUBLIC src/lib/logic plugins/westernsu target_compile_definitions(westernsupport PRIVATE ${maliit-keyboard-definitions}) function(language_plugin _language _full_language _ebook) + # To support layout style variations such as en@dv we need to avoid using + # the @ character in variables, so split and replace it with _ + set(_target ${_language}) + if(${_language} MATCHES "^(.*)\@(.*)$") + set(_target ${CMAKE_MATCH_1}_${CMAKE_MATCH_2}) + endif() + set(PLUGIN_SOURCES plugins/${_language}/src/${_full_language}plugin.h plugins/${_language}/src/${_full_language}plugin.json) @@ -212,14 +219,15 @@ if(enable-presage) add_ngram(TEXT plugins/${_language}/src/${_ebook} DATABASE database_${_language}.db) list(APPEND PLUGIN_SOURCES database_${_language}.db) endif() - add_library(${_language}plugin MODULE ${PLUGIN_SOURCES}) - target_link_libraries(${_language}plugin maliit-keyboard-common westernsupport) + add_library(${_target}plugin MODULE ${PLUGIN_SOURCES}) + set_target_properties(${_target}plugin PROPERTIES OUTPUT_NAME ${_language}plugin) + target_link_libraries(${_target}plugin maliit-keyboard-common westernsupport) install(FILES plugins/${_language}/qml/Keyboard_${_language}.qml plugins/${_language}/qml/Keyboard_${_language}_email.qml plugins/${_language}/qml/Keyboard_${_language}_url.qml plugins/${_language}/qml/Keyboard_${_language}_url_search.qml DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language}) - install(TARGETS ${_language}plugin + install(TARGETS ${_target}plugin LIBRARY DESTINATION ${MALIIT_KEYBOARD_LANGUAGES_DIR}/${_language}) if(enable-presage) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/database_${_language}.db @@ -277,6 +285,7 @@ function(abstract_language_plugin _language _full_language) list(APPEND PLUGIN_SOURCES database_${_language}.db) endif() add_library(${_target}plugin MODULE ${PLUGIN_SOURCES}) + set_target_properties(${_target}plugin PROPERTIES OUTPUT_NAME ${_language}plugin) target_link_libraries(${_target}plugin Qt5::Core Maliit::Plugins maliit-keyboard-common ${abstract_language_plugin_LIBRARIES}) target_include_directories(${_target}plugin PRIVATE src/lib/logic ${abstract_language_plugin_INCLUDE_DIRS}) target_compile_definitions(${_target}plugin PRIVATE ${abstract_language_plugin_DEFINITIONS})