Skip to content

Commit 1d848e5

Browse files
authored
feat: Use object libraries. (#99)
1 parent a33daac commit 1d848e5

File tree

147 files changed

+18914
-61
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+18914
-61
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ add_subdirectory(libs/internal)
8282
add_subdirectory(libs/server-sent-events)
8383
add_subdirectory(bindings/c)
8484

85+
set(ORIGINAL_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}")
86+
87+
set(BUILD_TESTING OFF)
88+
add_subdirectory(vendor/foxy)
89+
90+
set(BUILD_TESTING "${ORIGINAL_BUILD_TESTING}")
91+
8592
set(BUILD_SHARED_LIBS "${ORIGINAL_BUILD_SHARED_LIBS}")
8693

94+
8795
add_subdirectory(apps)

apps/sdk-contract-tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ project(
99
)
1010

1111
include(${CMAKE_FILES}/json.cmake)
12-
include(${CMAKE_FILES}/foxy.cmake)
1312

1413
add_executable(sdk-tests
1514
src/main.cpp

apps/sdk-contract-tests/include/server.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
1919

2020
class server {
2121
EntityManager manager_;
22-
foxy::listener listener_;
22+
launchdarkly::foxy::listener listener_;
2323
std::vector<std::string> caps_;
2424
launchdarkly::Logger& logger_;
2525

apps/sdk-contract-tests/include/session.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Session : boost::asio::coroutine {
3333
* @param caps Test service capabilities to advertise.
3434
* @param logger Logger.
3535
*/
36-
Session(foxy::server_session& session,
36+
Session(launchdarkly::foxy::server_session& session,
3737
EntityManager& manager,
3838
std::vector<std::string>& caps,
3939
launchdarkly::Logger& logger);
@@ -85,7 +85,7 @@ class Session : boost::asio::coroutine {
8585
std::optional<Response> generate_response(Request& req);
8686

8787
private:
88-
foxy::server_session& session_;
88+
launchdarkly::foxy::server_session& session_;
8989
EntityManager& manager_;
9090
std::unique_ptr<Frame> frame_;
9191
std::vector<std::string>& caps_;

apps/sdk-contract-tests/src/session.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const std::string kEntityPath = "/entity/";
77

88
namespace net = boost::asio;
99

10-
Session::Session(foxy::server_session& session,
10+
Session::Session(launchdarkly::foxy::server_session& session,
1111
EntityManager& manager,
1212
std::vector<std::string>& caps,
1313
launchdarkly::Logger& logger)

apps/sse-contract-tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ project(
99
)
1010

1111
include(${CMAKE_FILES}/json.cmake)
12-
include(${CMAKE_FILES}/foxy.cmake)
1312

1413
add_executable(sse-tests
1514
src/main.cpp

apps/sse-contract-tests/include/server.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace net = boost::asio; // from <boost/asio.hpp>
1616
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
1717

1818
class server {
19-
foxy::listener listener_;
19+
launchdarkly::foxy::listener listener_;
2020
EntityManager entity_manager_;
2121
std::vector<std::string> caps_;
2222
launchdarkly::Logger& logger_;

apps/sse-contract-tests/include/session.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Session : boost::asio::coroutine {
3232
* @param caps Test service capabilities to advertise.
3333
* @param logger Logger.
3434
*/
35-
Session(foxy::server_session& session,
35+
Session(launchdarkly::foxy::server_session& session,
3636
EntityManager& manager,
3737
std::vector<std::string>& caps,
3838
launchdarkly::Logger& logger);
@@ -84,7 +84,7 @@ class Session : boost::asio::coroutine {
8484
std::optional<Response> generate_response(Request& req);
8585

8686
private:
87-
foxy::server_session& session_;
87+
launchdarkly::foxy::server_session& session_;
8888
std::unique_ptr<Frame> frame_;
8989
EntityManager& manager_;
9090
std::vector<std::string>& caps_;

apps/sse-contract-tests/src/session.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const std::string kEntityPath = "/entity/";
77

88
namespace net = boost::asio;
99

10-
Session::Session(foxy::server_session& session,
10+
Session::Session(launchdarkly::foxy::server_session& session,
1111
EntityManager& manager,
1212
std::vector<std::string>& caps,
1313
launchdarkly::Logger& logger)

cmake/foxy.cmake

Lines changed: 0 additions & 25 deletions
This file was deleted.

libs/client-sdk/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ add_library(${LIBNAME}
4545

4646
target_link_libraries(${LIBNAME}
4747
PUBLIC launchdarkly::common
48-
PRIVATE Boost::headers launchdarkly::sse launchdarkly::internal)
48+
PRIVATE Boost::headers launchdarkly::sse launchdarkly::internal foxy)
4949

5050
add_library(launchdarkly::client ALIAS ${LIBNAME})
5151

libs/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ endif ()
2525
include(FetchContent)
2626

2727
include(${CMAKE_FILES}/expected.cmake)
28-
include(${CMAKE_FILES}/foxy.cmake)
28+
#include(${CMAKE_FILES}/foxy.cmake)
2929

3030
# Add main SDK sources.
3131
add_subdirectory(src)

libs/common/src/CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11

22
file(GLOB HEADER_LIST CONFIGURE_DEPENDS
33
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/*.hpp"
4-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/bindings/c/*.h"
5-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/bindings/c/config/*.h"
6-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/bindings/c/data/*.h"
7-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/config/*.hpp"
8-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/config/*.hpp"
9-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/data/*.hpp"
10-
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/logging/*.hpp"
4+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/*.hpp"
5+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/bindings/c/*.h"
6+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/bindings/c/config/*.h"
7+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/bindings/c/data/*.h"
8+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/config/client_side/*.hpp"
9+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/config/shared/*.hpp"
10+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/config/shared/builders/*.hpp"
11+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/config/shared/built/*.hpp"
12+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/data/*.hpp"
13+
"${LaunchDarklyCommonSdk_SOURCE_DIR}/include/launchdarkly/logging/*.hpp"
1114
)
1215

1316
# Automatic library: static or dynamic based on user config.
14-
add_library(${LIBNAME}
17+
add_library(${LIBNAME} OBJECT
1518
${HEADER_LIST}
1619
attribute_reference.cpp
1720
context.cpp
@@ -48,7 +51,6 @@ add_library(${LIBNAME}
4851
bindings/c/memory_routines.cpp
4952
config/logging_builder.cpp)
5053

51-
5254
add_library(launchdarkly::common ALIAS ${LIBNAME})
5355

5456
install(TARGETS ${LIBNAME})

libs/common/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}../")
1616

1717
add_executable(gtest_${LIBNAME}
1818
${tests})
19-
target_link_libraries(gtest_${LIBNAME} launchdarkly::common launchdarkly::internal GTest::gtest_main)
19+
target_link_libraries(gtest_${LIBNAME} launchdarkly::common launchdarkly::internal foxy GTest::gtest_main)
2020

2121
gtest_discover_tests(gtest_${LIBNAME})

libs/internal/include/launchdarkly/network/asio_requester.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class FoxyClient
129129
std::chrono::milliseconds response_timeout_;
130130
ResponseHandler handler_;
131131
http::response<http::string_body> resp_;
132-
foxy::client_session session_;
132+
launchdarkly::foxy::client_session session_;
133133

134134
public:
135135
FoxyClient(net::any_io_executor const& exec,
@@ -148,7 +148,7 @@ class FoxyClient
148148
response_timeout_(response_timeout),
149149
handler_(std::move(handler)),
150150
session_(exec,
151-
foxy::session_opts{ToOptRef(ssl_context_.get()),
151+
launchdarkly::foxy::session_opts{ToOptRef(ssl_context_.get()),
152152
connect_timeout_}),
153153
resp_() {}
154154

@@ -251,7 +251,7 @@ class AsioRequester {
251251
AsioRequester(net::any_io_executor ctx)
252252
: ctx_(std::move(ctx)),
253253
ssl_ctx_(std::make_shared<net::ssl::context>(
254-
foxy::make_ssl_ctx(ssl::context::tlsv12_client))) {
254+
launchdarkly::foxy::make_ssl_ctx(ssl::context::tlsv12_client))) {
255255
ssl_ctx_->set_default_verify_paths();
256256
}
257257

libs/internal/src/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ file(GLOB HEADER_LIST CONFIGURE_DEPENDS
88
)
99

1010
# Automatic library: static or dynamic based on user config.
11-
add_library(${LIBNAME}
11+
add_library(${LIBNAME} OBJECT
1212
${HEADER_LIST}
1313
context_filter.cpp
1414
events/asio_event_processor.cpp
@@ -34,7 +34,6 @@ add_library(${LIBNAME}
3434
encoding/base_64.cpp
3535
encoding/sha_256.cpp)
3636

37-
3837
add_library(launchdarkly::internal ALIAS ${LIBNAME})
3938

4039
install(TARGETS ${LIBNAME})

libs/internal/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}../")
1414

1515
add_executable(gtest_${LIBNAME}
1616
${tests})
17-
target_link_libraries(gtest_${LIBNAME} launchdarkly::common launchdarkly::internal GTest::gtest_main)
17+
target_link_libraries(gtest_${LIBNAME} launchdarkly::common launchdarkly::internal foxy GTest::gtest_main)
1818

1919
gtest_discover_tests(gtest_${LIBNAME})

libs/server-sent-events/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ endif ()
2727
# Needed to fetch external dependencies.
2828
include(FetchContent)
2929

30-
include(${CMAKE_FILES}/foxy.cmake)
30+
#include(${CMAKE_FILES}/foxy.cmake)
3131

3232
add_subdirectory(src)
3333

libs/server-sent-events/src/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
file(GLOB HEADER_LIST CONFIGURE_DEPENDS
3-
"${LaunchDarklySSEClient_SOURCE_DIR}/include/launchdarkly/*.hpp")
3+
"${LaunchDarklySSEClient_SOURCE_DIR}/include/launchdarkly/*.hpp"
4+
"${LaunchDarklySSEClient_SOURCE_DIR}/include/launchdarkly/sse/*.hpp"
5+
)
46

57
# Automatic library: static or dynamic based on user config.
6-
add_library(${LIBNAME}
8+
add_library(${LIBNAME} OBJECT
79
${HEADER_LIST}
810
client.cpp
911
parser.cpp

libs/server-sent-events/src/client.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ class FoxyClient : public Client,
5959
write_timeout_(write_timeout),
6060
req_(std::move(req)),
6161
session_(std::move(executor),
62-
foxy::session_opts{ToOptRef(ssl_context_),
63-
connect_timeout.value_or(kNoTimeout)}),
62+
launchdarkly::foxy::session_opts{
63+
ToOptRef(ssl_context_),
64+
connect_timeout.value_or(kNoTimeout)}),
6465
logger_(std::move(logger)) {
6566
// SSE body will never end unless an error occurs, so we shouldn't set a
6667
// size limit.
@@ -159,7 +160,7 @@ class FoxyClient : public Client,
159160
using cb = std::function<void(launchdarkly::sse::Event)>;
160161
using body = launchdarkly::sse::detail::EventBody<cb>;
161162
http::response_parser<body> body_parser_;
162-
foxy::client_session session_;
163+
launchdarkly::foxy::client_session session_;
163164
Builder::LogCallback logger_;
164165
};
165166

@@ -252,7 +253,7 @@ std::shared_ptr<Client> Builder::build() {
252253

253254
std::optional<ssl::context> ssl;
254255
if (service == "https") {
255-
ssl = foxy::make_ssl_ctx(ssl::context::tlsv12_client);
256+
ssl = launchdarkly::foxy::make_ssl_ctx(ssl::context::tlsv12_client);
256257
ssl->set_default_verify_paths();
257258
}
258259

libs/server-sent-events/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}../")
1414

1515
add_executable(gtest_${LIBNAME}
1616
${tests})
17-
target_link_libraries(gtest_${LIBNAME} launchdarkly::sse GTest::gtest_main)
17+
target_link_libraries(gtest_${LIBNAME} launchdarkly::sse foxy GTest::gtest_main)
1818

1919
gtest_discover_tests(gtest_${LIBNAME})

0 commit comments

Comments
 (0)