From 77bd2cb8b953774be98f17025c2ba9ba4385fb55 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Wed, 3 Jan 2024 18:02:49 -0300 Subject: [PATCH] Add KDSME as submodule for CI testing --- .github/workflows/build.yml | 15 ++++---- .gitmodules | 12 +++++++ 3rdparty/CMakeLists.txt | 36 +++++++++++++++++++ 3rdparty/KDStateMachineEditor | 1 + CMakeLists.txt | 7 +++- cmake/GammaRayMacrosInternal.cmake | 16 +++++++++ plugins/statemachineviewer/CMakeLists.txt | 16 +-------- .../statemachineviewerwidget.cpp | 16 ++++----- 8 files changed, 89 insertions(+), 30 deletions(-) create mode 100644 .gitmodules create mode 100644 3rdparty/CMakeLists.txt create mode 160000 3rdparty/KDStateMachineEditor diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 622a85cf3b..3d90f79229 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,6 +48,14 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Dependencies on Linux + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt update -qq + sudo apt install -y gdb doxygen libgraphviz-dev - name: Install ninja-build tool (must be after Qt due PATH changes) uses: turtlesec-no/get-ninja@main @@ -59,17 +67,12 @@ jobs: - name: Configure project run: > cmake -S . -G Ninja --preset ${{ matrix.config.preset }} + -DGAMMARAY_WITH_KDSME=${{ runner.os == 'Linux' }} -DGAMMARAY_BUILD_DOCS=${{ runner.os == 'Linux' }} - name: Build Project run: cmake --build ./build-${{ matrix.config.preset }} - - name: Install dependencies on Ubuntu - if: ${{ runner.os == 'Linux' }} - run: | - sudo apt update -qq - sudo apt install -y gdb - - name: Enable gdb attaching if: ${{ runner.os == 'Linux' }} run: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..bf70c4472a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +# This file is part of GammaRay, the Qt application inspection and manipulation tool. +# +# SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Contact KDAB at for commercial licensing options. +# + +[submodule "3rdparty/KDStateMachineEditor"] + path = 3rdparty/KDStateMachineEditor + url = https://github.com/KDAB/KDStateMachineEditor.git diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt new file mode 100644 index 0000000000..ddfb9b55c1 --- /dev/null +++ b/3rdparty/CMakeLists.txt @@ -0,0 +1,36 @@ +# This file is part of GammaRay, the Qt application inspection and manipulation tool. +# +# SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Contact KDAB at for commercial licensing options. +# + +if(GAMMARAY_WITH_KDSME) + function(add_ksme_subdirectory) + # Function creates extra scope to keep these variables local + set(BUILD_DOCS OFF) + set(BUILD_EXAMPLES OFF) + set(BUILD_TESTS OFF) + + set(KDSME_PACKAGE_NAME KDSME) + if(QT_VERSION_MAJOR GREATER_EQUAL 6) + set(KDSME_PACKAGE_NAME KDSME-qt6) + set(BUILD_QT6 ON) + endif() + set_package_properties( + ${KDSME_PACKAGE_NAME} PROPERTIES + URL "https://github.com/KDAB/KDStateMachineEditor" + DESCRIPTION "KDAB State Machine Editor framework" + TYPE RECOMMENDED + PURPOSE "Graphical state machine debugging." + ) + + gammaray_ensure_submodule_exists(KDStateMachineEditor) + add_subdirectory(KDStateMachineEditor) + endfunction() + add_ksme_subdirectory() +endif() + +add_subdirectory(kde) diff --git a/3rdparty/KDStateMachineEditor b/3rdparty/KDStateMachineEditor new file mode 160000 index 0000000000..2567f49288 --- /dev/null +++ b/3rdparty/KDStateMachineEditor @@ -0,0 +1 @@ +Subproject commit 2567f49288575d837fe7273557fa099a814e274f diff --git a/CMakeLists.txt b/CMakeLists.txt index 7172963f6f..16613c71f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,10 @@ # Enable Precompiled Headers support # Default=false # +# -DGAMMARAY_WITH_KDSME=[true|false] +# Enable State Machine Viewer Plugin UI by requiring KDAB State Machine Editor +# Default=false +# # -DENABLE_GOLD_LINKER=[true|false] # Use GNU gold linker # Default=false @@ -250,6 +254,7 @@ endif() gammaray_option(GAMMARAY_INSTALL_QT_LAYOUT "Install into Qt directory layout." OFF) gammaray_option(GAMMARAY_MULTI_BUILD "Build multiple applicable probe configurations." ON) gammaray_option(GAMMARAY_BUILD_CLI_INJECTOR "Build command line injector on Windows." ON) +gammaray_option(GAMMARAY_WITH_KDSME "Enable State Machine UI with KDSME" OFF) set(GAMMARAY_BUILD_DOCS_DEFAULT ON) set(GAMMARAY_DISABLE_FEEDBACK_DEFAULT OFF) @@ -810,7 +815,7 @@ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/3rdparty ${CMAKE_BIN include(KDQtInstallPaths) #to set QT_INSTALL_FOO variables add_subdirectory(cmake) -add_subdirectory(3rdparty/kde) +add_subdirectory(3rdparty) add_subdirectory(common) add_subdirectory(core) add_subdirectory(probe) diff --git a/cmake/GammaRayMacrosInternal.cmake b/cmake/GammaRayMacrosInternal.cmake index 73c4a264de..09571b75bb 100644 --- a/cmake/GammaRayMacrosInternal.cmake +++ b/cmake/GammaRayMacrosInternal.cmake @@ -132,3 +132,19 @@ macro(gammaray_add_dummy_package _package _found) list(APPEND _packages ${_package}) set_property(GLOBAL PROPERTY ${_property_name} "${_packages}") endmacro() + +# Check if some required submodule is initialized +function(gammaray_ensure_submodule_exists submodule) + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${submodule}/.git") + if(EXISTS "${appframework_SOURCE_DIR}/.git") + message( + FATAL_ERROR + "The git submodule ${submodule} is not initialized.\n" + "Please run the following command in the source directory (${appframework_SOURCE_DIR}):\n" + " git submodule update --init --recursive ${CMAKE_CURRENT_SOURCE_DIR}/${submodule}\n" + ) + else() + message(FATAL_ERROR "The submodules are missing - please report a broken source package.\n") + endif() + endif() +endfunction() diff --git a/plugins/statemachineviewer/CMakeLists.txt b/plugins/statemachineviewer/CMakeLists.txt index 9a654edd27..10d13596ac 100644 --- a/plugins/statemachineviewer/CMakeLists.txt +++ b/plugins/statemachineviewer/CMakeLists.txt @@ -54,22 +54,8 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD) endif() endif() -# UI part - dependencies -set(KDSME_PACKAGE_NAME KDSME) -if(QT_VERSION_MAJOR GREATER_EQUAL 6) - set(KDSME_PACKAGE_NAME KDSME-qt6) -endif() -set_package_properties( - ${KDSME_PACKAGE_NAME} PROPERTIES - URL "https://github.com/KDAB/KDStateMachineEditor" - DESCRIPTION "KDAB State Machine Editor framework" - TYPE RECOMMENDED - PURPOSE "Graphical state machine debugging." -) -find_package(${KDSME_PACKAGE_NAME} 1.2 CONFIG QUIET) - # UI part -if(GAMMARAY_BUILD_UI AND ${KDSME_PACKAGE_NAME}_FOUND) +if(GAMMARAY_BUILD_UI AND GAMMARAY_WITH_KDSME) set(gammaray_statemachineviewer_ui_plugin_srcs statemachineviewerclient.cpp diff --git a/plugins/statemachineviewer/statemachineviewerwidget.cpp b/plugins/statemachineviewer/statemachineviewerwidget.cpp index d9d6e08940..23772d617b 100644 --- a/plugins/statemachineviewer/statemachineviewerwidget.cpp +++ b/plugins/statemachineviewer/statemachineviewerwidget.cpp @@ -25,14 +25,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include