diff --git a/CMakeLists.txt b/CMakeLists.txt index 24789961a7fdc1d4541f6f5cbc9ca8f5e3d1a1e5..098458c0b514115b34287707a5bc77b792f35eb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ option(TBOX_ENABLE_FLOW "build flow" ON) option(TBOX_ENABLE_ALARM "build alarm" ON) option(TBOX_ENABLE_CRYPTO "build crypto" ON) option(TBOX_ENABLE_JSONRPC "build jsonrpc" ON) +option(TBOX_ENABLE_DBUS "build dbus" ON) # # 3rd-party libraries @@ -196,6 +197,10 @@ if(TBOX_ENABLE_JSONRPC) list(APPEND TBOX_COMPONENTS jsonrpc) endif() +if(TBOX_ENABLE_DBUS) + message(STATUS "dbus module enabled") + list(APPEND TBOX_COMPONENTS dbus) +endif() foreach(item IN LISTS TBOX_COMPONENTS) add_subdirectory(modules/${item}) diff --git a/modules/dbus/CMakeLists.txt b/modules/dbus/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1cbc02fd53b8115e9cb0e4b29c29fcba360b5c8b --- /dev/null +++ b/modules/dbus/CMakeLists.txt @@ -0,0 +1,69 @@ +# +# .============. +# // M A K E / \ +# // C++ DEV / \ +# // E A S Y / \/ \ +# ++ ----------. \/\ . +# \\ \ \ /\ / +# \\ \ \ / +# \\ \ \ / +# -============' +# +# Copyright (c) 2024 Hevake and contributors, all rights reserved. +# +# This file is part of cpp-tbox (https://github.com/cpp-main/cpp-tbox) +# Use of this source code is governed by MIT license that can be found +# in the LICENSE file in the root of the source tree. All contributing +# project authors may be found in the CONTRIBUTORS.md file in the root +# of the source tree. +# + +cmake_minimum_required(VERSION 3.15) + +set(TBOX_DBUS_VERSION_MAJOR 0) +set(TBOX_DBUS_VERSION_MINOR 0) +set(TBOX_DBUS_VERSION_PATCH 1) +set(TBOX_DBUS_VERSION ${TBOX_DBUS_VERSION_MAJOR}.${TBOX_DBUS_VERSION_MINOR}.${TBOX_DBUS_VERSION_PATCH}) + +add_definitions(-DLOG_MODULE_ID="tbox.dbus") + +set(TBOX_LIBRARY_NAME tbox_dbus) + +set(TBOX_DBUS_HEADERS loop.h connection.h) +set(TBOX_DBUS_SOURCES loop.cpp connection.cpp) + +find_package(DBus1 REQUIRED) +include_directories(${DBus1_INCLUDE_DIRS}) + +add_library(${TBOX_LIBRARY_NAME} ${TBOX_BUILD_LIB_TYPE} ${TBOX_DBUS_SOURCES}) +add_library(tbox::${TBOX_LIBRARY_NAME} ALIAS ${TBOX_LIBRARY_NAME}) + +set_target_properties( + ${TBOX_LIBRARY_NAME} PROPERTIES + VERSION ${TBOX_DBUS_VERSION} + SOVERSION ${TBOX_DBUS_VERSION_MAJOR} +) + +# install the target and create export-set +install( + TARGETS ${TBOX_LIBRARY_NAME} + EXPORT ${TBOX_LIBRARY_NAME}_targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) + +# install header file +install( + FILES ${TBOX_DBUS_HEADERS} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tbox/dbus +) + +# generate and install export file +install( + EXPORT ${TBOX_LIBRARY_NAME}_targets + FILE ${TBOX_LIBRARY_NAME}_targets.cmake + NAMESPACE tbox:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/tbox +) diff --git a/modules/mqtt/CMakeLists.txt b/modules/mqtt/CMakeLists.txt index 8b9f9d1547328781fbc3b75f3d124b5a0b545489..2939bac12c3fa19dd7c7e8228b0a0b47b96e6bbd 100644 --- a/modules/mqtt/CMakeLists.txt +++ b/modules/mqtt/CMakeLists.txt @@ -57,7 +57,6 @@ install( DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tbox/mqtt ) - # generate and install export file install( EXPORT ${TBOX_LIBRARY_NAME}_targets diff --git a/version.mk b/version.mk index c66c74d4e8b9b6cd583e0c7ab492e1cc5f63d920..3a86780e2f830dbee3e085d6eb7b0c010e1ae1e0 100644 --- a/version.mk +++ b/version.mk @@ -1,4 +1,4 @@ # TBOX版本号 TBOX_VERSION_MAJOR := 1 TBOX_VERSION_MINOR := 7 -TBOX_VERSION_REVISION := 4 +TBOX_VERSION_REVISION := 5