Skip to content

Commit

Permalink
Clean up library dependencies; more to do for network support
Browse files Browse the repository at this point in the history
  • Loading branch information
0xg0nz0 committed Feb 23, 2024
1 parent d214dd2 commit b2044d3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 18 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ endif()
find_package(benchmark CONFIG REQUIRED)
find_package(cpptoml CONFIG REQUIRED)
find_package(libuv CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(unofficial-sodium CONFIG REQUIRED)

# these do not correctly support CMake
find_path(SODIUM_INCLUDE_DIR sodium.h REQUIRED)
find_path(USOCKETS_INCLUDE_DIR libusockets.h REQUIRED)
find_library(USOCKETS_LIB uSockets REQUIRED)

add_library(
iggy

Expand All @@ -24,7 +30,7 @@ add_library(
sdk/serialization.cc
)
target_compile_features(iggy PRIVATE cxx_std_17)
target_include_directories(iggy PRIVATE ${unofficial-sodium_DIR}/../../include)
target_include_directories(iggy PRIVATE ${SODIUM_INCLUDE_DIR} ${USOCKETS_INCLUDE_DIR})

if (BUILD_TESTS)
add_subdirectory(tests)
Expand Down
14 changes: 14 additions & 0 deletions sdk/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@
#include <string>
#include <vector>

/* Loop wakeup handler */
void on_wakeup(struct us_loop_t* loop) {}

/* Loop pre iteration handler */
void on_pre(struct us_loop_t* loop) {}

/* Loop post iteration handler */
void on_post(struct us_loop_t* loop) {}

iggy::client::Client::Client(Options& options) {
// to make more natural interface for setting options we use a struct, so need to validate it.
options.validate();

// does nothing for now, but will be used to set up the client connection with uSockets
struct us_loop_t* loop = us_create_loop(0, on_wakeup, on_pre, on_post, 0);
us_loop_run(loop);
us_loop_free(loop);
}

void iggy::client::Client::ping() {
Expand Down
1 change: 1 addition & 0 deletions sdk/client.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <libusockets.h>
#include <sodium.h>
#include <stdexcept>
#include <string>
Expand Down
10 changes: 10 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ if(BUILD_TESTS)

iggy
GTest::gtest_main
libuv::uv_a
reproc++
unofficial-sodium::sodium
${USOCKETS_LIB}
OpenSSL::SSL
OpenSSL::Crypto
)

add_executable(
Expand All @@ -38,10 +42,16 @@ if(BUILD_TESTS)
target_link_libraries(
iggy_e2e_test

PRIVATE

iggy
GTest::gtest_main
libuv::uv_a
reproc++
unofficial-sodium::sodium
${USOCKETS_LIB}
OpenSSL::SSL
OpenSSL::Crypto
)

include(GoogleTest)
Expand Down
14 changes: 0 additions & 14 deletions vcpkg-configuration.json

This file was deleted.

9 changes: 6 additions & 3 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
"fmt",
"icu",
"libsodium",
"libuv",
"nlohmann-json",
"reproc",
"spdlog",
"uwebsockets",
"wolfssl"
{
"name": "usockets",
"features": [
"ssl"
]
}
]
}

0 comments on commit b2044d3

Please sign in to comment.