### Install Mock Library Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/WindowManager/CMakeLists.txt Defines the installation destination for the mock window management library. ```cmake install(TARGETS mockwindowmanagmentpolicy DESTINATION ${SHELL_INSTALL_QML}/mocks/WindowManager ) ``` -------------------------------- ### Install Xwayland Startup Script Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/data/systemd-user/CMakeLists.txt Configures and installs the Xwayland startup script for Lomiri to the libexec directory. ```cmake configure_file(Xwayland.lomiri.in ${CMAKE_CURRENT_BINARY_DIR}/Xwayland.lomiri @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Xwayland.lomiri DESTINATION ${CMAKE_INSTALL_FULL_LIBEXECDIR} ) ``` -------------------------------- ### Install Desktop and Configuration Files Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/data/CMakeLists.txt Installs generated desktop files and configuration files to their respective system directories. ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop ${CMAKE_CURRENT_BINARY_DIR}/${INDICATORS_CLIENT_APP}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications ) ``` ```cmake install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/greeters ) ``` ```cmake install(FILES 51-lomiri-greeter.conf DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/lightdm.conf.d ) ``` -------------------------------- ### Install Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/src/CMakeLists.txt Installs the built executable to the runtime destination directory, typically defined by CMAKE_INSTALL_BINDIR. This makes the application available after installation. ```cmake install(TARGETS ${SHELL_APP} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ``` -------------------------------- ### Install Mock Server Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/AccountsService/CMakeLists.txt Installs the mock server executable to a specific destination within the system's library execution directory. ```cmake install(TARGETS mock-server DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/AccountsService" ) ``` -------------------------------- ### Install QML and JS Files Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/qml/CMakeLists.txt Installs all QML and JavaScript files found in the current directory to the shell application's full directory. ```cmake file(GLOB QML_JS_FILES *.qml *.js qmldir) install(FILES ${QML_JS_FILES} DESTINATION ${SHELL_APP_FULL_DIR} ) ``` -------------------------------- ### Install D-Bus Interfaces and Symlinks Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/AccountsService/CMakeLists.txt Installs the D-Bus XML interface file and creates a symlink in the accountsservice directory. ```cmake set(DBUS_IFACE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/interfaces") set(ACCOUNTS_IFACE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/accountsservice/interfaces") install(FILES com.lomiri.shell.AccountsService.xml DESTINATION "${DBUS_IFACE_DIR}" ) # Create accountsservice symlink for above dbus interface install(CODE " execute_process(COMMAND mkdir -p \"$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\") execute_process(COMMAND ln -sf ../../dbus-1/interfaces/com.lomiri.shell.AccountsService.xml \"$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\") ") ``` -------------------------------- ### Copy Sample Application Files Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Lomiri/Launcher/CMakeLists.txt Copies sample application files into the build directory for shadow builds and installs them. ```cmake # copy sample application files into build directory for shadow builds file(COPY applications DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) install(DIRECTORY applications DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/Lomiri/Launcher" ) ``` -------------------------------- ### Install Lomiri Systemd Wrapper Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/data/systemd-user/CMakeLists.txt Configures and installs the lomiri-systemd-wrapper script to the libexec directory. ```cmake configure_file(lomiri-systemd-wrapper.in ${CMAKE_CURRENT_BINARY_DIR}/lomiri-systemd-wrapper @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lomiri-systemd-wrapper DESTINATION ${CMAKE_INSTALL_FULL_LIBEXECDIR} ) ``` -------------------------------- ### Define LightDMServer Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Lomiri/Session/CMakeLists.txt Builds the LightDMServer executable and installs it to the test directory. ```cmake add_executable(LightDMServer ${CMAKE_CURRENT_BINARY_DIR}/LightDMSessionAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/LogindManagerAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/LogindSessionAdaptor.cpp LightDMServer.cpp LogindServer.cpp server.cpp ) target_link_libraries(LightDMServer Qt5::Core Qt5::DBus) install(TARGETS LightDMServer DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/Lomiri/Session" ) ``` -------------------------------- ### Configure MockLightDM Library Build Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/liblightdm/CMakeLists.txt Defines sources, builds a shared library, sets include directories, adds compile definitions based on version, links against Qt5 libraries, sets output name and SOVERSION, and installs the library. ```cmake set(MockLightDM_SOURCES MockController.cpp MockGreeter.cpp MockSessionsModel.cpp MockUsersModel.cpp ) add_library(MockLightDM SHARED ${MockLightDM_SOURCES}) target_include_directories(MockLightDM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) if (${LIBLIGHTDM_VERSION} VERSION_LESS 1.32.0) target_compile_definitions(MockLightDM PUBLIC LIGHTDM_COMPAT_QT4) endif() target_link_libraries(MockLightDM Qt5::DBus Qt5::Gui) set_target_properties(MockLightDM PROPERTIES OUTPUT_NAME lightdm-qt5-3 SOVERSION 0) install(TARGETS MockLightDM DESTINATION ${SHELL_INSTALL_QML}/mocks/liblightdm ) ``` -------------------------------- ### Install QML Directories Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/qml/CMakeLists.txt Installs specified QML directories to the shell application's full directory. These directories contain various UI components and application elements. ```cmake set(QML_DIRS ApplicationMenus Components graphics Greeter Launcher Notifications Panel Stage Rotation Tutorial Wizard ) install(DIRECTORY ${QML_DIRS} DESTINATION ${SHELL_APP_FULL_DIR} ) ``` -------------------------------- ### Install Accounts Service Test Client Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/AccountsService/CMakeLists.txt Installs the Accounts Service test client executable to a specific destination within the system's library execution directory. ```cmake install(TARGETS test-accountsservice DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/AccountsService" ) ``` -------------------------------- ### Install Lomiri Mock Data Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/CMakeLists.txt Installs mock data directories to the specified destination for Lomiri applications. ```cmake install( DIRECTORY data DESTINATION ${SHELL_APP_FULL_DIR}/mocks ) ``` -------------------------------- ### Install Test Data Directories Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/CMakeLists.txt Installs the 'data' and 'graphics' directories to the test location within the shell application's full directory. ```cmake install(DIRECTORY data graphics DESTINATION "${SHELL_APP_FULL_DIR}/tests" ) ``` -------------------------------- ### Install Application File in CMake Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tools/CMakeLists.txt Installs a file to a specified destination within the application's full directory during the build process. Ensure the destination path is correctly defined. ```cmake install(FILES unlock-device DESTINATION ${SHELL_APP_FULL_DIR}) ``` -------------------------------- ### Install DragHandle Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/qmltests/Components/CMakeLists.txt Installs the DragHandle test executable to the specified destination. This is typically used for deploying test binaries. ```cmake install(TARGETS DragHandleTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/qmltests/Components" ) ``` -------------------------------- ### Input Device Manager Example Source: https://context7.com/ubports/development/llms.txt This QML snippet demonstrates how to use the InputDeviceManager to detect and react to input devices. It filters for specific device types and logs when devices are added or removed. It also exposes properties for checking the presence of mice, keyboards, and touchscreens, and lists all detected devices with their properties. ```qml import QtQuick 2.15 import Lomiri.InputInfo 0.1 import Lomiri.Components 1.3 Item { // Input device manager InputDeviceManager { id: inputManager deviceFilter: InputDevice.Mouse | InputDevice.Keyboard | InputDevice.TouchScreen onDeviceAdded: console.log("Device added:", devicePath) onDeviceRemoved: console.log("Device removed:", devicePath) onReady: console.log("Input manager ready, devices:", deviceCount) } // Derived properties for shell behavior property bool hasMouse: inputManager.deviceCount(InputDevice.Mouse) > 0 property bool hasKeyboard: inputManager.deviceCount(InputDevice.Keyboard) > 0 property bool hasTouchscreen: inputManager.deviceCount(InputDevice.TouchScreen) > 0 Column { spacing: units.gu(2) Label { text: "Total devices: " + inputManager.deviceCount } Label { text: "Has mouse: " + hasMouse } Label { text: "Has keyboard: " + hasKeyboard } Label { text: "Has touchscreen: " + hasTouchscreen } // List all devices Repeater { model: inputManager.deviceListOfType(InputDevice.Unknown | InputDevice.Mouse | InputDevice.Keyboard | InputDevice.TouchScreen | InputDevice.TouchPad) delegate: Column { spacing: units.gu(0.5) Label { text: "Name: " + modelData.name; font.bold: true } Label { text: "Path: " + modelData.devicePath; fontSize: "small" } Label { text: "Type: " + deviceTypeString(modelData.type); fontSize: "small" } } } } function deviceTypeString(type) { var types = [] if (type & InputDevice.Mouse) types.push("Mouse") if (type & InputDevice.Keyboard) types.push("Keyboard") if (type & InputDevice.TouchScreen) types.push("TouchScreen") if (type & InputDevice.TouchPad) types.push("TouchPad") if (type & InputDevice.Button) types.push("Button") if (type & InputDevice.Switch) types.push("Switch") return types.length > 0 ? types.join(", ") : "Unknown" } // Adapt UI based on input devices states: [ State { name: "desktop" when: hasMouse && hasKeyboard && !hasTouchscreen PropertyChanges { target: shell; usageScenario: "desktop" } }, State { name: "tablet" when: hasTouchscreen && (hasMouse || hasKeyboard) PropertyChanges { target: shell; usageScenario: "tablet" } }, State { name: "phone" when: hasTouchscreen && !hasMouse && !hasKeyboard PropertyChanges { target: shell; usageScenario: "phone" } } ] } ``` -------------------------------- ### Set Install RPATH for LomiriTestQml Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/utils/modules/Lomiri/SelfTest/CMakeLists.txt Configures the installation runtime path (RPATH) for the LomiriTestQml library to find libLomiriGestures.so. ```cmake set_target_properties(LomiriTestQml PROPERTIES INSTALL_RPATH "${SHELL_PRIVATE_FULL_LIBDIR}") ``` -------------------------------- ### CMake Build Configuration for uqmlscene Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/uqmlscene/CMakeLists.txt Defines the executable target, handles XCB dependencies, sets include paths, links required libraries, and configures installation. ```cmake add_executable(uqmlscene ${shellapplication_MOC_SRCS} main.cpp ${CMAKE_SOURCE_DIR}/src/DebuggingController.cpp ) pkg_check_modules(XCB REQUIRED xcb) if (NOT "${XCB_INCLUDE_DIRS}" STREQUAL "") set_target_properties(uqmlscene PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS}) endif() include_directories( SYSTEM ${Qt5Quick_PRIVATE_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/libs/LomiriGestures ${liblomiri-private_SOURCE_DIR} ) target_link_libraries(uqmlscene Qt5::Qml Qt5::Quick Qt5::Test Qt5::DBus ${Qt5Qml_LIBRARIES} ${Qt5Quick_LIBRARIES} ${XCB_LDFLAGS} LomiriGestures lomiri-private ) install(TARGETS uqmlscene RUNTIME DESTINATION ${SHELL_PRIVATE_FULL_LIBEXECDIR} ) ``` -------------------------------- ### Manage Project Versioning Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/data/CMakeLists.txt Generates a version file containing the project version and installs it to the local state directory. ```cmake add_custom_target(pkgversion ALL COMMAND echo ${PROJECT_VERSION} | head -n1 > ${CMAKE_CURRENT_BINARY_DIR}/version) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version DESTINATION ${CMAKE_INSTALL_LOCALSTATEDIR}/lib/lomiri) ``` -------------------------------- ### Define FakeQtMirApplicationQml Library Sources Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/QtMir/Application/CMakeLists.txt Lists source files for the FakeQtMirApplicationQml library. This setup is for applications that integrate with Mir. ```cmake set(FakeQtMirApplicationQml_SOURCES plugin.cpp ApplicationInfo.cpp ApplicationManager.cpp MirSurface.cpp MirSurfaceItem.cpp MirSurfaceListModel.cpp MirMock.cpp ObjectListModel.h SurfaceManager.cpp VirtualKeyboard.cpp ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/ApplicationInfoInterface.h ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/ApplicationManagerInterface.h ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/Mir.h ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/MirSurfaceInterface.h ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/MirSurfaceItemInterface.h ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/MirSurfaceListInterface.h ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/SurfaceManagerInterface.h resources/surfaces.qrc ) ``` -------------------------------- ### Configure and Install Lomiri Systemd Services Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/data/systemd-user/CMakeLists.txt Detects systemd, determines the appropriate unit directory based on version, and installs service files for different Lomiri modes. ```cmake pkg_check_modules(SYSTEMD systemd) if (${SYSTEMD_FOUND}) find_program(DUAE_BIN dbus-update-activation-environment REQUIRED) find_program(XWAYLAND_BIN Xwayland REQUIRED) if (${SYSTEMD_VERSION} VERSION_LESS 247) pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir) else() pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemd_user_unit_dir) endif() # lomiri-.service set(MODES full-greeter full-shell greeter shell) foreach(MODE ${MODES}) configure_file( lomiri-MODE.service.in ${CMAKE_CURRENT_BINARY_DIR}/lomiri-${MODE}.service @ONLY ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lomiri-${MODE}.service DESTINATION ${SYSTEMD_USER_UNIT_DIR} ) endforeach() # lomiri-indicators.target install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/lomiri-indicators.target" DESTINATION "${SYSTEMD_USER_UNIT_DIR}") endif() ``` -------------------------------- ### Add Executable for Wizard System Test Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Wizard/CMakeLists.txt Configures the build system to create an executable for the Wizard System unit tests. It specifies source files, links against Qt5 libraries including DBus, and defines the installation destination. ```cmake add_executable(tst-wizard-system tst_system.cpp ${CMAKE_SOURCE_DIR}/plugins/Wizard/System.cpp ) target_link_libraries(tst-wizard-system Qt5::Core Qt5::DBus Qt5::Qml Qt5::Test) install(TARGETS tst-wizard-system DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/Wizard" ) add_lomiri_unittest(WizardSystem tst-wizard-system) ``` -------------------------------- ### Configure Lomiri ProcessControl Plugin Build Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/ProcessControl/CMakeLists.txt Defines the library module, links Qt5 dependencies, and sets up installation paths for D-Bus interfaces. ```cmake add_definitions(-DSM_BUSNAME=sessionBus) add_library(ProcessControl-qml MODULE LocationWatcher.cpp ProcessControl.cpp plugin.cpp ) target_link_libraries(ProcessControl-qml Qt5::DBus Qt5::Qml ) target_include_directories(ProcessControl-qml PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) add_lomiri_plugin(ProcessControl 0.1 ProcessControl TARGETS ProcessControl-qml) set(DBUS_IFACE_DIR "${CMAKE_INSTALL_DATADIR}/dbus-1/interfaces") install(FILES com.lomiri.ProcessControl.xml DESTINATION "${DBUS_IFACE_DIR}" ) ``` -------------------------------- ### Add Lomiri Mock Plugin Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/CMakeLists.txt Use this macro to set up and optionally install a mock plugin for Lomiri. It handles exporting QML files and plugins with custom prefixes. ```cmake macro(add_lomiri_mock PLUGIN VERSION PATH) set(single PREFIX) cmake_parse_arguments(MOCK "" "${single}" "" ${ARGN}) if (NOT MOCK_PREFIX) set(MOCK_PREFIX mocks) endif() export_qmlfiles(${PLUGIN} ${PATH} DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX} TARGET_PREFIX ${MOCK_PREFIX}-Mock ${MOCK_UNPARSED_ARGUMENTS} ) export_qmlplugin(${PLUGIN} ${VERSION} ${PATH} DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX} TARGET_PREFIX ${MOCK_PREFIX}-Mock ${MOCK_UNPARSED_ARGUMENTS} ) endmacro() ``` -------------------------------- ### Add Executable for Wizard PageList Test Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Wizard/CMakeLists.txt Configures the build system to create an executable for the Wizard PageList unit tests. It specifies source files, links against Qt5 libraries, and defines the installation destination. ```cmake include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/plugins/Wizard ) add_executable(tst-wizard-pagelist tst_pagelist.cpp ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp ) target_link_libraries(tst-wizard-pagelist Qt5::Core Qt5::Qml Qt5::Test) install(TARGETS tst-wizard-pagelist DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/Wizard" ) add_lomiri_unittest(WizardPageList tst-wizard-pagelist ENVIRONMENT WIZARD_TESTING=1) ``` -------------------------------- ### Install Integrated Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt Installs the integrated test executable to a specific private libexec directory for testing purposes. The destination path is relative to the build directory. ```cmake install(TARGETS GreeterIntegratedTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/LightDM/IntegratedLightDM" ) ``` -------------------------------- ### Install QML Files for Non-Mir QtMir Application Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/Wizard/QtMir/Application/CMakeLists.txt Installs QML files (qmldir and OSKController.qml) to the specified plugin directory for non-Mir environments. ```cmake set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Lomiri/SystemSettings/Wizard/NonMir/QtMir/Application) install(FILES qmldir OSKController.qml DESTINATION ${PLUG_DIR}) ``` -------------------------------- ### Configure Qt5 DBus and Include Directories Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/Lomiri/ApplicationMenu/CMakeLists.txt Finds the Qt5 DBus module and sets include directories for the plugin build. Ensure Qt5 DBus is installed and accessible. ```cmake find_package(Qt5DBus REQUIRED) include_directories( ${CMAKE_SOURCE_DIR}/plugins/Lomiri/ApplicationMenu ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) ``` -------------------------------- ### Define add_lomiri_plugin macro Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/CMakeLists.txt Use this macro to export QML files and plugins to the shell installation directory. It requires the plugin name, version, and path as arguments. ```cmake macro(add_lomiri_plugin PLUGIN VERSION PATH) export_qmlfiles(${PLUGIN} ${PATH} DESTINATION ${SHELL_INSTALL_QML} ${ARGN}) export_qmlplugin(${PLUGIN} ${VERSION} ${PATH} DESTINATION ${SHELL_INSTALL_QML} ${ARGN}) endmacro() ``` -------------------------------- ### Configure Greeter D-Bus Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt Defines the GreeterDBusTestExec target, linking necessary libraries and installing the executable. This is used for D-Bus related tests. ```cmake include_directories( ${GLIB_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) add_executable(GreeterDBusTestExec dbus.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/PromptsModel.cpp ) # This add_dependencies is needed since we're linking with with -L and -l below # make seems to work but ninja breaks without it add_dependencies(GreeterDBusTestExec MockLightDM) target_link_libraries(GreeterDBusTestExec ${Intl_LIBRARIES} Qt5::Core Qt5::DBus Qt5::Quick Qt5::Test MockLightDM ) target_include_directories(GreeterDBusTestExec PUBLIC ${CMAKE_SOURCE_DIR}/plugins/LightDM ) set_target_properties(GreeterDBusTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm") install(TARGETS GreeterDBusTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/LightDM/IntegratedLightDM" ) install(FILES greeter.qml DESTINATION "${SHELL_APP_FULL_DIR}/tests/plugins/LightDM/IntegratedLightDM" ) add_lomiri_uitest(GreeterDBus dbus-test-runner ARG_PREFIX "--parameter" ARGS --task $ DEPENDS MockLightDM ) ``` -------------------------------- ### Build Gesture Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Lomiri/Gestures/CMakeLists.txt Defines a macro to create a test executable for gestures, linking necessary Qt and Lomiri Gestures libraries. It also specifies the installation destination and runtime path. ```cmake macro(build_gesture_test CLASSNAME) add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp) target_link_libraries(${CLASSNAME}TestExec Qt5::Test Qt5::Core Qt5::Qml Qt5::Gui Qt5::Quick LomiriGesturesQml ${LOMIRIGESTURES_LIBRARIES} ) install(TARGETS ${CLASSNAME}TestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/Lomiri/Gestures" ) # To find libLomiriGestures.so set_target_properties(${CLASSNAME}TestExec PROPERTIES INSTALL_RPATH "${SHELL_PRIVATE_FULL_LIBDIR}") endmacro() ``` -------------------------------- ### Add Executable for Utility Tests Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Utils/CMakeLists.txt Defines a test executable for utility components. This involves linking necessary Qt and custom libraries, and installing the executable to a specific test directory. ```cmake foreach(util_test QLimitProxyModel LomiriSortFilterProxyModel WindowInputMonitor WindowStateStorage ) add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp) target_link_libraries(${util_test}TestExec Qt5::Test Qt5::Core Qt5::Qml Utils-qml) install(TARGETS ${util_test}TestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/Utils" ) add_lomiri_unittest(${util_test} ${util_test}TestExec ADD_TEST ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Utils HOME=${TMPDIR} ) endforeach() ``` -------------------------------- ### Configure MockBroadcastServer Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/SessionBroadcast/CMakeLists.txt Sets up include directories, library links, and the executable target for the mock D-Bus server. ```cmake add_definitions(-DSM_BUSNAME=sessionBus) include_directories( ${GLIB_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/plugins/SessionBroadcast ) link_libraries( ${GLIB_LIBRARIES} ) add_executable(MockBroadcastServer ${CMAKE_CURRENT_BINARY_DIR}/BroadcastAdaptor.cpp server.cpp BroadcastServer.cpp ) target_link_libraries(MockBroadcastServer Qt5::Core Qt5::DBus) install(TARGETS MockBroadcastServer DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/SessionBroadcast" ) ``` -------------------------------- ### Configure Include Directories Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/Utils/CMakeLists.txt Sets up the include paths for the current source and binary directories, as well as system-level private Qt and device info headers. ```cmake include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( SYSTEM ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ${Qt5Quick_PRIVATE_INCLUDE_DIRS} ${DEVICEINFO_INCLUDE_DIRS} ) ``` -------------------------------- ### Clone and Navigate to Lomiri Repository Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/README.md Initial steps to obtain the source code and enter the project directory. ```bash git clone https://gitlab.com/ubports/development/core/lomiri.git ``` ```bash cd lomiri ``` -------------------------------- ### Configure Include Directories Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/Lomiri/InputInfo/CMakeLists.txt Sets up include directories for the build. This includes the current source and binary directories, as well as the InputInfo plugin directory. ```cmake include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/plugins/Lomiri/InputInfo/ ) ``` -------------------------------- ### Install EdgeDragEvaluator Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/qmltests/Components/CMakeLists.txt Installs the EdgeDragEvaluator test executable to its designated location within the build system. This is crucial for test deployment. ```cmake install(TARGETS EdgeDragEvaluatorTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/qmltests/Components" ) ``` -------------------------------- ### Build Mock Server Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/AccountsService/CMakeLists.txt Creates an executable for the mock D-Bus server, including generated adaptor sources and server implementation files. Links against Qt Core and Qt DBus. ```cmake add_executable(mock-server ${CMAKE_CURRENT_BINARY_DIR}/AccountsAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/AccountsPrivateAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/AccountsUserAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/InputAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/PropertiesAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/LocationAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/SecurityPrivacyAdaptor.cpp ${CMAKE_CURRENT_BINARY_DIR}/LscInputAdaptor.cpp server.cpp AccountsServer.cpp PropertiesServer.cpp LscServer.cpp ) target_link_libraries(mock-server Qt5::Core Qt5::DBus) ``` -------------------------------- ### Configure Lomiri Mock Library with CMake Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/GSettings.1.0/CMakeLists.txt Sets up include directories, defines source files, links Qt5 dependencies, and registers the mock module. ```cmake include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Quick_INCLUDE_DIRS} ) set(GSettingsQML_SOURCES fake_gsettings.cpp plugin.cpp ) add_library(FakeGSettingsQml MODULE ${GSettingsQML_SOURCES}) target_link_libraries(FakeGSettingsQml ${Qt5Core_LIBRARIES} ${Qt5Quick_LIBRARIES} Qt5::Qml ) add_lomiri_mock(GSettings 1.0 GSettings.1.0 TARGETS FakeGSettingsQml) ``` -------------------------------- ### Configure SessionsModel Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt Sets up the GreeterSessionsModelTestExec target for testing the SessionsModel, including linking QtTest and MockLightDM. ```cmake # SessionsModelTest add_executable(GreeterSessionsModelTestExec sessionsmodel.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp ${CMAKE_SOURCE_DIR}/plugins/Utils/lomirisortfilterproxymodelqml.cpp ) add_dependencies(GreeterSessionsModelTestExec MockLightDM) target_link_libraries(GreeterSessionsModelTestExec Qt5::Core Qt5::Test MockLightDM ) target_include_directories(GreeterSessionsModelTestExec PUBLIC ${CMAKE_SOURCE_DIR}/plugins/LightDM ${CMAKE_SOURCE_DIR}/plugins/Utils ) install(TARGETS GreeterSessionsModelTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/LightDM/IntegratedLightDM" ) add_lomiri_uitest(GreeterSessions GreeterSessionsModelTestExec DEPENDS MockLightDM ) ``` -------------------------------- ### Configure Global Shortcut Plugin Build Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/GlobalShortcut/CMakeLists.txt Defines source files, creates a shared library, and links necessary Qt modules for the Global Shortcut plugin. Use this to set up the build for a Lomiri plugin. ```cmake set(globalshortcutplugin_SRCS globalshortcut.cpp globalshortcutregistry.cpp plugin.cpp) add_library(GlobalShortcut-qml SHARED ${globalshortcutplugin_SRCS}) target_link_libraries(GlobalShortcut-qml Qt5::Quick Qt5::Gui) add_lomiri_plugin(GlobalShortcut 1.0 GlobalShortcut TARGETS GlobalShortcut-qml) ``` -------------------------------- ### Set EdgeDragEvaluator Executable Properties Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/qmltests/Components/CMakeLists.txt Configures installation properties for the EdgeDragEvaluator test executable, specifying the library installation path. This ensures proper runtime library linking. ```cmake set_target_properties(EdgeDragEvaluatorTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/Lomiri/Gestures:${SHELL_PRIVATE_FULL_LIBDIR}" ) ``` -------------------------------- ### CMake Project Configuration Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/Lomiri/InputInfo/CMakeLists.txt Sets up the CMake project for InputInfo, finds required Qt5 modules, and checks for libudev and libevdev packages. Includes directories for headers and defines the library sources. ```cmake project(InputInfo) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) pkg_check_modules(LIBUDEV REQUIRED libudev) pkg_check_modules(LIBEVDEV REQUIRED libevdev) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${LIBUDEV_INCLUDE_DIRS} ${LIBEVDEV_INCLUDE_DIRS} ) set(InputInfo_SOURCES plugin.cpp qinputinfo.cpp qdeclarativeinputdevicemodel.cpp linux/qinputdeviceinfo_linux.cpp ) add_library(InputInfo SHARED ${InputInfo_SOURCES} ) target_link_libraries(InputInfo ${LIBUDEV_LDFLAGS} ${LIBEVDEV_LDFLAGS} Qt5::Core Qt5::Qml Qt5::Quick ) add_lomiri_plugin(Lomiri.InputInfo 0.1 Lomiri/InputInfo TARGETS InputInfo) ``` -------------------------------- ### Implement LightDM Greeter UI in QML Source: https://context7.com/ubports/development/llms.txt Uses LightDM.Greeter, UsersModel, and SessionsModel to handle authentication flow and display user information. ```qml import QtQuick 2.15 import LightDM.FullLightDM 0.1 as LightDM import Lomiri.Components 1.3 Item { // Greeter singleton access property var greeter: LightDM.Greeter Connections { target: LightDM.Greeter function onShowGreeter() { // Display the greeter UI greeterUI.visible = true } function onHideGreeter() { greeterUI.visible = false } function onIsAuthenticatedChanged() { if (LightDM.Greeter.isAuthenticated) { // Start the session LightDM.Greeter.startSessionSync() } } function onLoginError(automatic) { errorLabel.text = "Login failed" errorLabel.visible = true } function onLoginSuccess(automatic) { console.log("Login successful") } } Column { id: greeterUI anchors.centerIn: parent spacing: units.gu(2) // User list from UsersModel ListView { width: units.gu(30) height: units.gu(20) model: LightDM.UsersModel delegate: Item { width: parent.width height: units.gu(6) Row { spacing: units.gu(1) Image { source: model.image || "" width: units.gu(5) height: units.gu(5) } Column { Label { text: model.realName || model.name } Label { text: model.session; fontSize: "small" } } } MouseArea { anchors.fill: parent onClicked: { // Start authentication for this user LightDM.Greeter.authenticate(model.name) } } } } // Password input TextField { id: passwordField width: units.gu(30) placeholderText: "Password" echoMode: TextInput.Password onAccepted: { LightDM.Greeter.respond(text) text = "" } } Label { id: errorLabel visible: false color: "red" } // Session selector ComboBox { width: units.gu(30) model: LightDM.SessionsModel textRole: "name" } // Greeter properties Label { text: "Default session: " + LightDM.Greeter.defaultSession } Label { text: "Has guest account: " + LightDM.Greeter.hasGuestAccount } } } ``` -------------------------------- ### Build Accounts Service Test Client Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/AccountsService/CMakeLists.txt Creates an executable for testing the Accounts Service, linking against Qt Core, Qt DBus, and Qt Test libraries. ```cmake add_executable(test-accountsservice ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp client.cpp ) target_link_libraries(test-accountsservice Qt5::Core Qt5::DBus Qt5::Test) ``` -------------------------------- ### Configure SessionBroadcastTest Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/SessionBroadcast/CMakeLists.txt Defines the test executable target and installation path for the SessionBroadcast unit tests. ```cmake add_executable(sessionbroadcasttestExec ${CMAKE_SOURCE_DIR}/plugins/SessionBroadcast/SessionBroadcast.cpp sessionbroadcasttest.cpp ) target_link_libraries(sessionbroadcasttestExec Qt5::Test Qt5::Core Qt5::Qml Qt5::DBus) install(TARGETS sessionbroadcasttestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/SessionBroadcast" ) ``` -------------------------------- ### Build and Link Library Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/Utils/CMakeLists.txt Creates the shared library and links it against necessary Qt modules and device info flags. ```cmake add_library(Utils-qml SHARED ${QMLPLUGIN_SRC} ) target_link_libraries(Utils-qml Qt5::Qml Qt5::Quick Qt5::DBus Qt5::Network Qt5::Gui Qt5::Sql Qt5::Concurrent ${DEVICEINFO_LDFLAGS} ) ``` -------------------------------- ### Configure GlobalShortcut Test Build Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/GlobalShortcut/CMakeLists.txt Sets up include directories, definitions, and executable targets for the GlobalShortcut test suite. ```cmake include_directories( ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut ${CMAKE_CURRENT_BINARY_DIR} ) add_definitions(-DTEST_DIR="plugins/GlobalShortcut") add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp) target_link_libraries(GlobalShortcutTestExec Qt5::Test Qt5::Quick ${Qt5Quick_LIBRARIES} GlobalShortcut-qml) install(TARGETS GlobalShortcutTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/GlobalShortcut" ) install(FILES shortcut.qml DESTINATION "${SHELL_APP_FULL_DIR}/tests/plugins/GlobalShortcut" ) add_lomiri_uitest(GlobalShortcut GlobalShortcutTestExec DEPENDS GlobalShortcut-qml ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/GlobalShortcut ) ``` -------------------------------- ### Configure CMake for Indicators Client Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tools/indicatorsclient/CMakeLists.txt Defines the project structure, source files, executable target, dependencies, and installation path. ```cmake project(indicators_client) set(INDICATORS_CLIENT_SRC main.cpp indicatorsclient.cpp ) set(INDICATORS_CLIENT_HEADERS indicatorsclient.h ) add_executable(${INDICATORS_CLIENT_APP} ${INDICATORS_CLIENT_SRC} ${INDICATORS_CLIENT_HEADERS} ) target_link_libraries(${INDICATORS_CLIENT_APP} Qt5::Core Qt5::Widgets Qt5::Quick) install(TARGETS ${INDICATORS_CLIENT_APP} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ``` -------------------------------- ### Implement LauncherModel in QML Source: https://context7.com/ubports/development/llms.txt Demonstrates binding the LauncherModel to a ListView and utilizing management functions like pinning and moving applications. ```qml import QtQuick 2.15 import Lomiri.Components 1.3 import Lomiri.Launcher 0.1 Item { width: 800 height: 600 // Access the launcher model singleton ListView { id: launcherList anchors.fill: parent model: LauncherModel delegate: Item { width: parent.width height: units.gu(8) Row { spacing: units.gu(2) anchors.verticalCenter: parent.verticalCenter // App icon from model Image { source: model.icon width: units.gu(6) height: units.gu(6) } Column { Label { text: model.name } Label { text: model.running ? "Running" : "Not running" fontSize: "small" } Label { visible: model.countVisible text: "Badge: " + model.count fontSize: "small" } } } MouseArea { anchors.fill: parent onClicked: { // Get the launcher item and activate var item = LauncherModel.get(index) if (item) { console.log("Launching: " + item.appId) // Signal to shell to launch the app } } } } } // Configure the launcher Component.onCompleted: { LauncherModel.applicationManager = ApplicationManager LauncherModel.setUser("phablet") // Set user for settings } // Pin an app to the launcher at a specific position function pinApp(appId) { LauncherModel.pin(appId, 0) // Pin at first position } // Move an app within the launcher function moveApp(fromIndex, toIndex) { LauncherModel.move(fromIndex, toIndex) } // Trigger a quick list action function invokeQuickAction(appId, actionIndex) { LauncherModel.quickListActionInvoked(appId, actionIndex) } // Send an alert to an app's launcher icon function alertApp(appId) { LauncherModel.alert(appId) } } ``` -------------------------------- ### Configure UsersModel Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt Configures the GreeterUsersModelTestExec target for testing the UsersModel, specifying source files, dependencies, and installation paths. ```cmake # UsersModelTest add_executable(GreeterUsersModelTestExec usersmodel.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/PromptsModel.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp ${CMAKE_SOURCE_DIR}/plugins/Utils/lomirisortfilterproxymodelqml.cpp ) # This add_dependencies is needed since we're linking with with -L and -l below # make seems to work but ninja breaks without it add_dependencies(GreeterUsersModelTestExec MockLightDM) target_link_libraries(GreeterUsersModelTestExec ${Intl_LIBRARIES} Qt5::Core Qt5::Test MockLightDM ) target_include_directories(GreeterUsersModelTestExec PUBLIC ${CMAKE_SOURCE_DIR}/plugins/LightDM ${CMAKE_SOURCE_DIR}/plugins/Utils ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm ) set_target_properties(GreeterUsersModelTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm") install(TARGETS GreeterUsersModelTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/LightDM/IntegratedLightDM" ) add_lomiri_uitest(GreeterUsers GreeterUsersModelTestExec DEPENDS MockLightDM ) ``` -------------------------------- ### Set DragHandle Executable Properties Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/qmltests/Components/CMakeLists.txt Configures installation properties for the DragHandle test executable, including the runtime search path for libraries. ```cmake set_target_properties(DragHandleTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/Lomiri/Gestures:${SHELL_PRIVATE_FULL_LIBDIR}" ) ``` -------------------------------- ### Configure Build Directories and Definitions Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Lomiri/Session/CMakeLists.txt Sets include directories and preprocessor definitions for the build environment. ```cmake include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/plugins/Lomiri/Session ${liblomiri-private_SOURCE_DIR} ${GLIB_INCLUDE_DIRS} ) add_definitions(-DSM_BUSNAME=sessionBus) add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DSESSION_TESTING) ``` -------------------------------- ### Configure MockUserMetrics Library with CMake Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/mocks/libusermetrics/CMakeLists.txt Defines the build process for the MockUserMetrics shared library, including source files, dependencies, and installation destination. ```cmake set(mock_SOURCES ColorTheme.cpp UserMetrics.cpp ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp ) add_library(MockUserMetrics SHARED ${mock_SOURCES}) target_link_libraries(MockUserMetrics Qt5::Gui) include_directories( ${CMAKE_SOURCE_DIR}/plugins/Utils ${CMAKE_CURRENT_BINARY_DIR} ) set_target_properties(MockUserMetrics PROPERTIES OUTPUT_NAME usermetricsoutput VERSION 1) install(TARGETS MockUserMetrics DESTINATION ${SHELL_INSTALL_QML}/mocks/libusermetrics ) ``` -------------------------------- ### Configure Greeter PAM Test Executable Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt Defines the GreeterPamTestExec target for PAM integration tests, linking required Qt modules and the integratedLightDM library. ```cmake add_executable(GreeterPamTestExec pam.cpp ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp ) target_link_libraries(GreeterPamTestExec Qt5::Concurrent Qt5::Core Qt5::Test integratedLightDM ) target_include_directories(GreeterPamTestExec PUBLIC ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm ) install(TARGETS GreeterPamTestExec DESTINATION "${SHELL_PRIVATE_FULL_LIBEXECDIR}/tests/plugins/LightDM/IntegratedLightDM" ) add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $) ``` -------------------------------- ### Configure CMake for WizardUtils-qml Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/Wizard/Utils/CMakeLists.txt Defines the build process for the WizardUtils-qml shared library, including source files, visibility settings, and installation targets. ```cmake include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ) set(QMLPLUGIN_SRC qsortfilterproxymodelqml.cpp plugin.cpp system.cpp ) add_library(WizardUtils-qml SHARED ${QMLPLUGIN_SRC} ) # Because this is an internal support library, we want # to expose all symbols in it. Consider changing this # either to a static library or just using the # files directly in targets. set_target_properties(WizardUtils-qml PROPERTIES COMPILE_FLAGS -fvisibility=default) target_link_libraries(WizardUtils-qml Qt5::DBus Qt5::Qml Qt5::Quick) set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Lomiri/SystemSettings/Wizard/Utils) install(FILES qmldir DESTINATION ${PLUG_DIR}) install(TARGETS WizardUtils-qml DESTINATION ${PLUG_DIR}) ``` -------------------------------- ### Define Plugin Source Files Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/plugins/Greeter/Lomiri/Launcher/CMakeLists.txt Lists all source files required to build the Lomiri Launcher QML plugin. This includes C++ files and interface header files. ```cmake set(QMLLAUNCHERPLUGINAS_SRC plugin.cpp launchermodelas.cpp launcheritem.cpp quicklistmodel.cpp quicklistentry.cpp ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp ${APPLICATION_API_INCLUDEDIR}/lomiri/shell/application/ApplicationManagerInterface.h ${LAUNCHER_API_INCLUDEDIR}/lomiri/shell/launcher/LauncherItemInterface.h ${LAUNCHER_API_INCLUDEDIR}/lomiri/shell/launcher/LauncherModelInterface.h ${LAUNCHER_API_INCLUDEDIR}/lomiri/shell/launcher/QuickListModelInterface.h ) ``` -------------------------------- ### Configure GSettings Qt Module Source: https://gitlab.com/ubports/development/core/lomiri/-/blob/main/tests/plugins/Lomiri/Launcher/CMakeLists.txt Checks for the GSettings Qt module and sets up include directories for system headers. ```cmake pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/plugins/AccountsService ${CMAKE_SOURCE_DIR}/plugins/Lomiri/Launcher ${liblomiri-private_SOURCE_DIR} ) include_directories( SYSTEM ${GSETTINGS_QT_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${UAL_INCLUDE_DIRS} ) ```