Skip to content

Commit a6cb4ca

Browse files
committed
Adds high-level functionality to connection::async_run.
1 parent 5ac4f7e commit a6cb4ca

Some content is hidden

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

59 files changed

+2617
-2142
lines changed

CMakeLists.txt

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ include_directories(include)
5858
# Main function for the examples.
5959
#=======================================================================
6060

61+
add_library(test_common STATIC
62+
tests/common.cpp
63+
)
64+
target_compile_features(test_common PUBLIC cxx_std_17)
65+
if (MSVC)
66+
target_compile_options(test_common PRIVATE /bigobj)
67+
target_compile_definitions(test_common PRIVATE _WIN32_WINNT=0x0601)
68+
endif()
69+
70+
#=======================================================================
71+
6172
add_library(common STATIC
6273
examples/start.cpp
6374
examples/main.cpp
@@ -81,15 +92,6 @@ if (MSVC)
8192
target_compile_definitions(cpp20_intro PRIVATE _WIN32_WINNT=0x0601)
8293
endif()
8394

84-
add_executable(cpp20_intro_awaitable_ops examples/cpp20_intro_awaitable_ops.cpp)
85-
target_link_libraries(cpp20_intro_awaitable_ops common)
86-
target_compile_features(cpp20_intro_awaitable_ops PUBLIC cxx_std_20)
87-
add_test(cpp20_intro_awaitable_ops cpp20_intro_awaitable_ops)
88-
if (MSVC)
89-
target_compile_options(cpp20_intro_awaitable_ops PRIVATE /bigobj)
90-
target_compile_definitions(cpp20_intro_awaitable_ops PRIVATE _WIN32_WINNT=0x0601)
91-
endif()
92-
9395
add_executable(cpp17_intro examples/cpp17_intro.cpp)
9496
target_compile_features(cpp17_intro PUBLIC cxx_std_17)
9597
add_test(cpp17_intro cpp17_intro)
@@ -156,10 +158,12 @@ if (Protobuf_FOUND)
156158
endif()
157159
endif()
158160

159-
if (NOT MSVC)
160161
add_executable(cpp20_subscriber examples/cpp20_subscriber.cpp)
161162
target_compile_features(cpp20_subscriber PUBLIC cxx_std_20)
162163
target_link_libraries(cpp20_subscriber common)
164+
if (MSVC)
165+
target_compile_options(cpp20_subscriber PRIVATE /bigobj)
166+
target_compile_definitions(cpp20_subscriber PRIVATE _WIN32_WINNT=0x0601)
163167
endif()
164168

165169
add_executable(cpp20_intro_tls examples/cpp20_intro_tls.cpp)
@@ -205,6 +209,7 @@ endif()
205209

206210
add_executable(test_conn_exec tests/conn_exec.cpp)
207211
target_compile_features(test_conn_exec PUBLIC cxx_std_20)
212+
target_link_libraries(test_conn_exec test_common)
208213
add_test(test_conn_exec test_conn_exec)
209214
if (MSVC)
210215
target_compile_options(test_conn_exec PRIVATE /bigobj)
@@ -213,6 +218,7 @@ endif()
213218

214219
add_executable(test_conn_exec_retry tests/conn_exec_retry.cpp)
215220
target_compile_features(test_conn_exec_retry PUBLIC cxx_std_20)
221+
target_link_libraries(test_conn_exec_retry test_common)
216222
add_test(test_conn_exec_retry test_conn_exec_retry)
217223
if (MSVC)
218224
target_compile_options(test_conn_exec_retry PRIVATE /bigobj)
@@ -221,6 +227,7 @@ endif()
221227

222228
add_executable(test_conn_push tests/conn_push.cpp)
223229
target_compile_features(test_conn_push PUBLIC cxx_std_20)
230+
target_link_libraries(test_conn_push test_common)
224231
add_test(test_conn_push test_conn_push)
225232
if (MSVC)
226233
target_compile_options(test_conn_push PRIVATE /bigobj)
@@ -237,7 +244,7 @@ endif()
237244

238245
add_executable(test_conn_reconnect tests/conn_reconnect.cpp)
239246
target_compile_features(test_conn_reconnect PUBLIC cxx_std_20)
240-
target_link_libraries(test_conn_reconnect common)
247+
target_link_libraries(test_conn_reconnect common test_common)
241248
add_test(test_conn_reconnect test_conn_reconnect)
242249
if (MSVC)
243250
target_compile_options(test_conn_reconnect PRIVATE /bigobj)
@@ -271,16 +278,25 @@ endif()
271278

272279
add_executable(test_conn_exec_cancel tests/conn_exec_cancel.cpp)
273280
target_compile_features(test_conn_exec_cancel PUBLIC cxx_std_20)
274-
target_link_libraries(test_conn_exec_cancel common)
281+
target_link_libraries(test_conn_exec_cancel common test_common)
275282
add_test(test_conn_exec_cancel test_conn_exec_cancel)
276283
if (MSVC)
277284
target_compile_options(test_conn_exec_cancel PRIVATE /bigobj)
278285
target_compile_definitions(test_conn_exec_cancel PRIVATE _WIN32_WINNT=0x0601)
279286
endif()
280287

288+
add_executable(test_conn_exec_cancel2 tests/conn_exec_cancel2.cpp)
289+
target_compile_features(test_conn_exec_cancel2 PUBLIC cxx_std_20)
290+
target_link_libraries(test_conn_exec_cancel2 common test_common)
291+
add_test(test_conn_exec_cancel2 test_conn_exec_cancel2)
292+
if (MSVC)
293+
target_compile_options(test_conn_exec_cancel2 PRIVATE /bigobj)
294+
target_compile_definitions(test_conn_exec_cancel2 PRIVATE _WIN32_WINNT=0x0601)
295+
endif()
296+
281297
add_executable(test_conn_exec_error tests/conn_exec_error.cpp)
282298
target_compile_features(test_conn_exec_error PUBLIC cxx_std_17)
283-
target_link_libraries(test_conn_exec_error common)
299+
target_link_libraries(test_conn_exec_error common test_common)
284300
add_test(test_conn_exec_error test_conn_exec_error)
285301
if (MSVC)
286302
target_compile_options(test_conn_exec_error PRIVATE /bigobj)
@@ -289,7 +305,7 @@ endif()
289305

290306
add_executable(test_conn_echo_stress tests/conn_echo_stress.cpp)
291307
target_compile_features(test_conn_echo_stress PUBLIC cxx_std_20)
292-
target_link_libraries(test_conn_echo_stress common)
308+
target_link_libraries(test_conn_echo_stress common test_common)
293309
add_test(test_conn_echo_stress test_conn_echo_stress)
294310
if (MSVC)
295311
target_compile_options(test_conn_echo_stress PRIVATE /bigobj)
@@ -304,22 +320,27 @@ if (MSVC)
304320
target_compile_definitions(test_request PRIVATE _WIN32_WINNT=0x0601)
305321
endif()
306322

307-
if (NOT MSVC)
308323
add_executable(test_issue_50 tests/issue_50.cpp)
309324
target_compile_features(test_issue_50 PUBLIC cxx_std_20)
310325
target_link_libraries(test_issue_50 common)
311326
add_test(test_issue_50 test_issue_50)
327+
if (MSVC)
328+
target_compile_options(test_issue_50 PRIVATE /bigobj)
329+
target_compile_definitions(test_issue_50 PRIVATE _WIN32_WINNT=0x0601)
312330
endif()
313331

314-
if (NOT MSVC)
315332
add_executable(test_conn_check_health tests/conn_check_health.cpp)
316333
target_compile_features(test_conn_check_health PUBLIC cxx_std_17)
317334
target_link_libraries(test_conn_check_health common)
318335
add_test(test_conn_check_health test_conn_check_health)
336+
if (MSVC)
337+
target_compile_options(test_conn_check_health PRIVATE /bigobj)
338+
target_compile_definitions(test_conn_check_health PRIVATE _WIN32_WINNT=0x0601)
319339
endif()
320340

321341
add_executable(test_run tests/run.cpp)
322342
target_compile_features(test_run PUBLIC cxx_std_17)
343+
target_link_libraries(test_run test_common)
323344
add_test(test_run test_run)
324345
if (MSVC)
325346
target_compile_options(test_run PRIVATE /bigobj)

0 commit comments

Comments
 (0)