Multiple Linux fixes

This commit is contained in:
Kevin Dewald
2025-06-24 12:15:14 -07:00
parent 2e5c67cc7f
commit 75d9194158
7 changed files with 47 additions and 6 deletions

2
Cargo.lock generated
View File

@@ -460,7 +460,7 @@ dependencies = [
[[package]]
name = "simplersble"
version = "0.10.2-dev1"
version = "0.10.3-dev1"
dependencies = [
"cmake",
"cxx",

View File

@@ -49,4 +49,6 @@ performed:
- ``VERSION``
- ``Cargo.toml`` (and include a ``-dev1`` suffix)
- ``docs/changelog.rst``
- ``docs/changelog.rst``
#. Run ``cargo build`` to ensure that Cargo.toml is correct.

View File

@@ -15,6 +15,10 @@ else()
find_package(simplebluez CONFIG REQUIRED)
endif()
add_compile_definitions(FMT_HEADER_ONLY)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../dependencies/external)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../dependencies/internal)
add_subdirectory(list_adapters)
add_subdirectory(list_paired)
add_subdirectory(scan)
@@ -22,4 +26,4 @@ add_subdirectory(connect)
add_subdirectory(pair)
add_subdirectory(read)
add_subdirectory(notify)
add_subdirectory(ble_nus)
add_subdirectory(ble_nus)

View File

@@ -164,6 +164,10 @@ if(SIMPLEBLUEZ_TEST)
${CMAKE_CURRENT_SOURCE_DIR}/test/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/src/helpers/PythonRunner.cpp)
target_compile_definitions(simplebluez_test PRIVATE FMT_HEADER_ONLY)
target_include_directories(simplebluez_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/external)
target_include_directories(simplebluez_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/internal)
set_target_properties(simplebluez_test PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES

View File

@@ -125,6 +125,10 @@ if(SIMPLEDBUS_TEST)
${CMAKE_CURRENT_SOURCE_DIR}/test/src/test_path.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/src/helpers/PythonRunner.cpp)
target_compile_definitions(simpledbus_test PRIVATE FMT_HEADER_ONLY)
target_include_directories(simpledbus_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/external)
target_include_directories(simpledbus_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/internal)
set_target_properties(simpledbus_test PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES

View File

@@ -8,8 +8,7 @@
#include <simpledbus/base/Connection.h>
#include <simpledbus/base/Holder.h>
#include <fmt/core.h>
#include <simpledbus/base/Logging.h>
namespace SimpleDBus {
@@ -58,7 +57,7 @@ struct AutoRegisterInterface {
AutoRegisterInterface(const std::string& key, CreatorFunction creator) {
static_assert(std::is_base_of<Interface, T>::value, "T must inherit from Interface");
InterfaceRegistry::getInstance().registerClass<T>(key, creator);
fmt::print("Registered class with key {}\n", key);
LOG_DEBUG("Registered class with key {}", key);
}
};

View File

@@ -1,9 +1,37 @@
#include <gtest/gtest.h>
#include <simpledbus/advanced/Proxy.h>
#include <simpledbus/advanced/InterfaceRegistry.h>
using namespace SimpleDBus;
const AutoRegisterInterface<Interface> registry_i1{
"i.1",
// clang-format off
[](std::shared_ptr<Connection> conn, const std::string& bus_name, const std::string& path, const Holder& options) -> std::shared_ptr<SimpleDBus::Interface> {
return std::make_shared<Interface>(conn, bus_name, path, "i.1");
}
// clang-format on
};
const AutoRegisterInterface<Interface> registry_i2{
"i.2",
// clang-format off
[](std::shared_ptr<Connection> conn, const std::string& bus_name, const std::string& path, const Holder& options) -> std::shared_ptr<SimpleDBus::Interface> {
return std::make_shared<Interface>(conn, bus_name, path, "i.2");
}
// clang-format on
};
const AutoRegisterInterface<Interface> registry_i3{
"i.3",
// clang-format off
[](std::shared_ptr<Connection> conn, const std::string& bus_name, const std::string& path, const Holder& options) -> std::shared_ptr<SimpleDBus::Interface> {
return std::make_shared<Interface>(conn, bus_name, path, "i.3");
}
// clang-format on
};
TEST(ProxyInterfaces, LoadInterfaces) {
Holder managed_interfaces = Holder::create_dict();
managed_interfaces.dict_append(Holder::STRING, "i.1", Holder());