-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
find_package(PkgConfig REQUIRED) | ||
|
||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
pkg_check_modules(URING REQUIRED liburing) | ||
endif () | ||
pkg_check_modules(OPENSSL openssl) | ||
|
||
set(SOURCES | ||
socket.cpp | ||
sockutils.cpp | ||
poll.cpp | ||
select.cpp | ||
epoll.cpp | ||
uring.cpp | ||
kqueue.cpp | ||
resolver.cpp | ||
ssl.cpp | ||
iocp.cpp | ||
win32_pipe.cpp | ||
) | ||
|
||
if (WIN32) | ||
list(APPEND SOURCES | ||
wepoll.c | ||
) | ||
set_source_files_properties(wepoll.c PROPERTIES COMPILE_FLAGS "-w") | ||
endif () | ||
|
||
add_library(coroio ${SOURCES}) | ||
|
||
target_include_directories(coroio PUBLIC ${URING_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/..) | ||
|
||
target_link_directories(coroio PUBLIC ${URING_LIBRARY_DIRS} ${OPENSSL_LIBRARY_DIRS}) | ||
target_link_libraries(coroio PUBLIC ${URING_LIBRARIES} ${OPENSSL_LIBRARIES}) | ||
if (WIN32) | ||
target_link_libraries(coroio PUBLIC ws2_32) | ||
endif() | ||
|
||
if(MSVC) | ||
target_compile_options(coroio PRIVATE /W4 /WX) | ||
else() | ||
target_compile_options(coroio PRIVATE -Wall -Wextra -Wpedantic -Werror) | ||
endif() | ||
|
||
target_compile_features(coroio PUBLIC cxx_std_20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
macro(target name source) | ||
add_executable(${name} ${source}) | ||
target_link_libraries(${name} coroio) | ||
endmacro() | ||
|
||
target(timers timers.cpp) | ||
target(echotest echotest.cpp) | ||
target(echoserver echoserver.cpp) | ||
target(echoclient echoclient.cpp) | ||
target(sslechoclient sslechoclient.cpp) | ||
target(sslechoserver sslechoserver.cpp) | ||
target(resolver resolver.cpp) | ||
target(bench bench.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(CMOCKA cmocka) | ||
|
||
macro(ut name source) | ||
add_executable(ut_${name} ${source}) | ||
target_include_directories(ut_${name} PRIVATE ${CMOCKA_INCLUDE_DIRS}) | ||
target_link_directories(ut_${name} PRIVATE ${CMOCKA_LIBRARY_DIRS}) | ||
target_link_libraries(ut_${name} PRIVATE coroio ${CMOCKA_LIBRARIES}) | ||
|
||
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ut_${name}) | ||
set_tests_properties(${name} PROPERTIES ENVIRONMENT "CMOCKA_MESSAGE_OUTPUT=xml;CMOCKA_XML_FILE=${name}.xml") | ||
endmacro() | ||
|
||
if (CMOCKA_FOUND) | ||
ut(tests tests.cpp) | ||
endif () |