switch to use system gammaray, and CPack DEB packaging

This commit is contained in:
2026-07-09 20:04:43 +08:00
parent a3380dbab5
commit e60b19acaf
5 changed files with 67 additions and 28 deletions

View File

@@ -29,10 +29,13 @@ FetchContent_Declare(
# Qt-prefixed vars (NOT BUILD_EXAMPLES) — verified to suppress example/test build.
set(QT_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(QT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
# qtmcp is built as shared libs + plugins (Qt plugin system requires this).
# For a distribution deb, the package includes the qtmcp shared libs and
# stdio plugin alongside the bridge binary. CPACK_DEBIAN_PACKAGE_SHLIBDEPS
# auto-detects the required system dependencies (gammaray, qt6, etc.).
FetchContent_MakeAvailable(qtmcp)
# --- GammaRay (built & installed in ../install-prefix by Step 1) ---
# Pass -DCMAKE_PREFIX_PATH=$(pwd)/../install-prefix at configure.
# --- GammaRay (system package: gammaray-dev >= 3.4.0) ---
find_package(GammaRay REQUIRED)
# --- Qt6 components for the bridge target (Qt6 already found globally by qtmcp) ---
@@ -68,17 +71,30 @@ target_link_libraries(gammaray-mcp-bridge PRIVATE
Qt6::McpCommon
)
# Add GammaRay source common/ for message.h (not in installed headers)
target_include_directories(gammaray-mcp-bridge PRIVATE
/home/blumia/Sources/GammaRay/common
install(TARGETS gammaray-mcp-bridge RUNTIME DESTINATION bin)
install(PROGRAMS run.sh DESTINATION bin)
# Runtime: qtmcp shared libs and stdio plugin are built in the build tree.
# For development, run.sh sets LD_LIBRARY_PATH and QT_PLUGIN_PATH.
# For distribution, CPack bundles qtmcp's install rules automatically.
set_target_properties(gammaray-mcp-bridge PROPERTIES
BUILD_RPATH "$<TARGET_FILE_DIR:Qt6::McpServer>"
INSTALL_RPATH "$ORIGIN/../lib/x86_64-linux-gnu"
)
# Runtime: qtmcp builds SHARED libs + the stdio backend plugin into the build
# tree. Set RPATH so the bridge finds libQt6Mcp*.so, and set QT_PLUGIN_PATH at
# run time (see run.sh) so Qt loads mcpserverbackend/libqmcpserverstdio.so.
# Also add GammaRay's install lib dir for libgammaray_*.so.
set(_GR_LIBDIR "$<TARGET_PROPERTY:gammaray_client,IMPORTED_LOCATION>")
set_target_properties(gammaray-mcp-bridge PROPERTIES
BUILD_RPATH "$<TARGET_FILE_DIR:Qt6::McpServer>;${CMAKE_SOURCE_DIR}/../install-prefix/lib"
INSTALL_RPATH "$ORIGIN/../lib"
)
# --- CPack packaging ---
set(CPACK_PACKAGE_NAME "gammaray-mcp-bridge")
set(CPACK_PACKAGE_VERSION "0.1.0")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GammaRay MCP bridge")
set(CPACK_PACKAGE_DESCRIPTION "MCP server that exposes GammaRay probe introspection data (QML SceneGraph, QML items, and Qt Widgets) to LLMs for assisted debugging.")
set(CPACK_PACKAGE_CONTACT "Blumia <blumia@example.com>")
set(CPACK_PACKAGE_VENDOR "gammaray-mcp")
set(CPACK_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Blumia <blumia@example.com>")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/blumia/gammaray-mcp")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "gammaray-plugin-quickinspector")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_GENERATOR "DEB")
include(CPack)