refactor: enable compile-time D-Bus signature generation (#425)

Since sdbus-c++ knows types of D-Bus call/signal/property input/output parameters at compile time, why not assemble the D-Bus signature strings at compile time, too, instead of assembling them at run time as std::string with likely cost of (unnecessary) heap allocations...

std::array is well supported constexpr type in C++20, so we harness it to build the D-Bus signature string and store it into the binary at compile time.
This commit is contained in:
Stanislav Angelovič
2024-04-16 15:40:43 +02:00
parent 32a97f214f
commit d856969051
9 changed files with 294 additions and 319 deletions

View File

@@ -15,9 +15,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
compiler: [g++, clang]
compiler: [g++]
build: [shared-libsystemd]
include:
- os: ubuntu-22.04
compiler: clang
build: shared-libsystemd
- os: ubuntu-22.04
compiler: g++
build: embedded-static-libsystemd
@@ -94,7 +97,7 @@ jobs:
cd build
cpack -G DEB
- name: 'Upload Artifact'
if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-20.04' && matrix.compiler == 'g++'
if: matrix.build == 'shared-libsystemd' && matrix.os == 'ubuntu-22.04' && matrix.compiler == 'g++'
uses: actions/upload-artifact@v3
with:
name: "debian-packages-${{ matrix.os }}-${{ matrix.compiler }}"