Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6bf0af0
update catch2 to version 2.13.7
d12fk Apr 11, 2022
01e1118
update pkg-config file
d12fk Apr 11, 2022
b035a2c
add validating types for basic DBus names
d12fk Apr 11, 2022
a541905
extend and overhaul MatchRule type
d12fk Apr 11, 2022
ba23113
add option to use standalone ASIO
d12fk Apr 12, 2022
c06503d
add DBus::Error type as a generic error wrapper
d12fk Apr 12, 2022
b75c100
make Log::writeHex display ASCII on the side
d12fk Apr 12, 2022
1ea92a0
redesign DBus type system
d12fk Apr 13, 2022
0bd6757
add support for the UnixFd DBus type
d12fk Apr 13, 2022
cef30ba
overhaul DBus::Message
d12fk Apr 13, 2022
62caac1
use Type::Signature in Introspectable
d12fk Apr 13, 2022
37fc555
overhaul DBus::Transport
d12fk Apr 13, 2022
46582f7
overhaul DBus::AuthenticationProtocol
d12fk Apr 13, 2022
693ab55
overhaul DBus::MessageProtocol
d12fk Apr 13, 2022
4d13147
add DBus::Connection
d12fk Apr 13, 2022
ad41751
convert example programs to use the new API
d12fk Apr 14, 2022
17b8560
remove no longer needed dependencies
d12fk Apr 14, 2022
ac36dfa
also build asio standalone in github action
d12fk Apr 23, 2022
a04eed3
add default c'tor to some dbus names
d12fk May 13, 2022
2008378
use singular for enum RequestNameFlag
d12fk May 13, 2022
2c9c335
add convenience connect API and connected() method
d12fk May 13, 2022
91345d2
add method to cancel receiving signal(s)
d12fk May 13, 2022
01120f1
add variadic template, copy and move c'tors to Parameters
d12fk May 13, 2022
2391617
move more initialization into Message c'tor
d12fk May 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ on:

jobs:
build:
name: ${{matrix.compiler.compiler}} ${{matrix.build_type}}
name: ${{matrix.compiler.name}} ${{matrix.asio.name}} ${{matrix.build_type}}
runs-on: ubuntu-latest
# run in docker until jammy is ubuntu-latest
container: ubuntu:jammy
strategy:
matrix:
compiler:
- { compiler: GCC, CC: gcc, CXX: g++ }
- { compiler: Clang, CC: clang, CXX: clang++ }
- { name: GCC, CC: gcc, CXX: g++ }
- { name: Clang, CC: clang, CXX: clang++ }
asio:
- { name: asio-boost, pkg: libboost-dev, standalone: OFF }
- { name: asio-standalone, pkg: libasio-dev, standalone: ON }
build_type: [ Debug, Release ]
steps:
- uses: actions/checkout@v2
Expand All @@ -23,21 +28,25 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt update && sudo apt install -yq libboost-all-dev ninja-build
apt update && apt install --no-install-recommends -yq ${{matrix.asio.pkg}} cmake g++ clang ninja-build
# sudo apt update && sudo apt install --no-install-recommends -yq ${{matrix.asio.pkg}} ninja-build

- name: Configure CMake
env:
CC: ${{matrix.compiler.CC}}
CXX: ${{matrix.compiler.CXX}}
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
run: |
cmake -G Ninja -B ${{github.workspace}}/build \
-DDBUS_ASIO_STANDALONE=${{matrix.asio.standalone}} \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{matrix.build_type}}
run: |
cd ${{github.workspace}}/build; ctest -C ${{matrix.build_type}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/dbus_asio.h
66 changes: 34 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ set(CMAKE_CXX_VISIBILITY_PRESET protected)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")

set(HEADER_FILES
src/dbus_asio.h
src/dbus_auth.h
src/dbus_connection.h
src/dbus_error.h
src/dbus.h
src/dbus_introspectable.h
src/dbus_log.h
Expand All @@ -15,17 +18,17 @@ set(HEADER_FILES
src/dbus_messageprotocol.h
src/dbus_messageostream.h
src/dbus_messageistream.h
src/dbus_native.h
src/dbus_names.h
src/dbus_octetbuffer.h
src/dbus_platform.h
src/dbus_transport.h
src/dbus_type.h
src/dbus_type_any.h
src/dbus_type_array.h
src/dbus_type_base.h
src/dbus_type_boolean.h
src/dbus_type_byte.h
src/dbus_type_dictentry.h
src/dbus_type_double.h
src/dbus_type.h
src/dbus_type_int16.h
src/dbus_type_int32.h
src/dbus_type_int64.h
Expand All @@ -36,9 +39,9 @@ set(HEADER_FILES
src/dbus_type_uint16.h
src/dbus_type_uint32.h
src/dbus_type_uint64.h
src/dbus_type_unixfd.h
src/dbus_type_variant.h
src/dbus_utils.h
src/dbus_validation.h
)

add_library(dbus-asio SHARED
Expand All @@ -47,22 +50,17 @@ add_library(dbus-asio SHARED
src/dbus_log.cpp
src/dbus_matchrule.cpp
src/dbus_message.cpp
src/dbus_message_error.cpp
src/dbus_messageistream.cpp
src/dbus_message_methodcall.cpp
src/dbus_message_methodreturn.cpp
src/dbus_messageprotocol.cpp
src/dbus_message_signal.cpp
src/dbus_native.cpp
src/dbus_native_messages.cpp
src/dbus_names.cpp
src/dbus_octetbuffer.cpp
src/dbus_platform.cpp
src/dbus_transport.cpp
src/dbus_type.cpp
src/dbus_type_any.cpp
src/dbus_type_array.cpp
src/dbus_type_base.cpp
src/dbus_type_boolean.cpp
src/dbus_type_byte.cpp
src/dbus_type.cpp
src/dbus_type_dictentry.cpp
src/dbus_type_double.cpp
src/dbus_type_int16.cpp
Expand All @@ -75,37 +73,41 @@ add_library(dbus-asio SHARED
src/dbus_type_uint16.cpp
src/dbus_type_uint32.cpp
src/dbus_type_uint64.cpp
src/dbus_type_unixfd.cpp
src/dbus_type_variant.cpp
src/dbus_utils.cpp
src/dbus_validation.cpp
)

# DBUS DEPENDENCIES
find_package(Boost COMPONENTS chrono system thread REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
set (PRIVATE_LIBS ${Boost_LIBRARIES})
link_directories(${Boost_LIBRARY_DIRS})

# PTHREAD DEPENDENCIES
find_package (Threads REQUIRED)

target_link_libraries (dbus-asio ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
# ASIO
option(DBUS_ASIO_STANDALONE "Use ASIO standalone library (non-boost)" OFF)
if(DBUS_ASIO_STANDALONE)
add_compile_definitions(ASIO_STANDALONE)
set(DBUS_ASIO_INCLUDE "asio.hpp")
set(DBUS_ASIO_NAMESPACE "::asio")
set(DBUS_ERROR_CODE_NAMESPACE "::std")
set(DBUS_ERROR_CODE_ERRC "::std::errc")
set(DBUS_MAKE_ERROR_CODE "::std::make_error_code")
else()
set(DBUS_ASIO_INCLUDE "boost/asio.hpp")
set(DBUS_ASIO_NAMESPACE "::boost::asio")
set(DBUS_ERROR_CODE_NAMESPACE "::boost::system")
set(DBUS_ERROR_CODE_ERRC "::boost::system::errc::errc_t")
set(DBUS_MAKE_ERROR_CODE "::boost::asio::error::make_error_code")

find_package (Threads REQUIRED)
target_link_libraries(dbus-asio Threads::Threads)
endif()
set(DBUS_ASIO_H ${CMAKE_CURRENT_SOURCE_DIR}/src/dbus_asio.h)
configure_file(${DBUS_ASIO_H}.in ${DBUS_ASIO_H})
unset(DBUS_ASIO_H)

set_target_properties(dbus-asio PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER "${HEADER_FILES}")

foreach(LIB ${PRIVATE_LIBS})
get_filename_component(BARE_LIB ${LIB} NAME)
string(REGEX REPLACE ".so$" "" BARE_LIB "${BARE_LIB}")
string(REGEX REPLACE "^lib" "-l" BARE_LIB "${BARE_LIB}")
set(PLATFORM_LIBS "${PLATFORM_LIBS} ${BARE_LIB}")
endforeach()

set(PLATFORM_LIBS "${PLATFORM_LIBS} -ldbus-asio")
set(PLATFORM_LIBS "-ldbus-asio")

message(${PLATFORM_LIBS})
configure_file(dbus-asio.pc.in dbus-asio.pc @ONLY)

target_include_directories(dbus-asio PUBLIC src)
Expand Down
3 changes: 1 addition & 2 deletions dbus-asio.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/libdbus-asio

Name: @PROJECT_NAME@
Description: "D-Bus ASIO Library"
Description: asynchronous C++ DBus library
Version: @PROJECT_VERSION@

Requires:
Libs: -L${libdir} @PLATFORM_LIBS@
Cflags: -I${includedir}
Loading