From c572480d1085bea260e64740c7b6b71e4c88a0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Tue, 16 Dec 2025 14:40:44 +0100 Subject: [PATCH] cmake: Explicitly link in neochatplugin and use qt_* cmake commands The QML code of the various QML modules is compiled to C++ by qmlcachegen and then compiled into the final binary. Unfortunately, in the current setup, the plugin for the org.kde.neochat QML module is not linked into the app because qmlimportscanner can't find usages of it. No generated C++ code for that module is then run and the QML is interpreted from its bytecode instead. This is likely due to the project not following recommended QML structure and because it is not using qt_* variants of certain cmake commands. It should not be necessary to link against the plugins manually. As a quick fix, link against the plugin explicitly and use qt_* variants of cmake commands to help qmlimportscanner and to pick up the existing C++ code. --- src/app/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 5e468305c..6a8384230 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020-2021 Tobias Fella # SPDX-License-Identifier: BSD-2-Clause -add_library(neochat STATIC +qt_add_library(neochat STATIC controller.cpp controller.h roommanager.cpp @@ -140,10 +140,17 @@ if(WIN32) set_target_properties(neochat PROPERTIES OUTPUT_NAME "neochatlib") endif() -add_executable(neochat-app +qt_add_executable(neochat-app main.cpp ) +if(ANDROID) + set_target_properties(neochat-app PROPERTIES + OUTPUT_NAME "neochat-app" + PREFIX "lib" + ) +endif() + if(TARGET Qt::WebView) target_link_libraries(neochat-app PUBLIC Qt::WebView) target_compile_definitions(neochat-app PUBLIC -DHAVE_WEBVIEW) @@ -183,7 +190,7 @@ else() endif() target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/models) -target_link_libraries(neochat PRIVATE Loginplugin Roomsplugin RoomInfoplugin MessageContentplugin Timelineplugin Spacesplugin Chatbarplugin Settingsplugin Devtoolsplugin) +target_link_libraries(neochat PRIVATE neochatplugin Loginplugin Roomsplugin RoomInfoplugin MessageContentplugin Timelineplugin Spacesplugin Chatbarplugin Settingsplugin Devtoolsplugin) target_link_libraries(neochat PUBLIC LibNeoChat Timeline