add object store and provide to plugins

This commit is contained in:
Green Sky 2024-04-12 22:53:40 +02:00
parent 4b7ef79f38
commit 71d93329c5
No known key found for this signature in database
3 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,15 @@ if (NOT TARGET solanaceae_plugin)
FetchContent_MakeAvailable(solanaceae_plugin)
endif()
if (NOT TARGET solanaceae_object_store)
FetchContent_Declare(solanaceae_object_store
GIT_REPOSITORY https://github.com/Green-Sky/solanaceae_object_store.git
GIT_TAG master
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(solanaceae_object_store)
endif()
add_subdirectory(./toxcore)
if (NOT TARGET solanaceae_toxcore)

View File

@ -37,6 +37,8 @@ target_link_libraries(totato PUBLIC
solanaceae_tox_contacts
solanaceae_tox_messages
solanaceae_object_store
nlohmann_json::nlohmann_json
)

View File

@ -1,3 +1,4 @@
#include <solanaceae/object_store/object_store.hpp>
#include <solanaceae/util/simple_config_model.hpp>
#include <solanaceae/contact/contact_model3.hpp>
#include <solanaceae/message3/registry_message_model.hpp>
@ -137,6 +138,8 @@ int main(int argc, char** argv) {
const auto started_at = std::chrono::steady_clock::now();
auto last_time_tick = std::chrono::steady_clock::now();
ObjectStore2 os;
std::string config_path {"config.json"};
// totato <config.json> -p <path/to/plugin.so>
@ -224,6 +227,8 @@ int main(int argc, char** argv) {
PluginManager pm;
{ // setup plugin instances
g_provideInstance<ObjectStore2>("ObjectStore2", "host", &os);
g_provideInstance<ConfigModelI>("ConfigModelI", "host", &conf);
g_provideInstance<Contact3Registry>("Contact3Registry", "1", "host", &cr);
g_provideInstance<RegistryMessageModel>("RegistryMessageModel", "host", &rmm);