2020-10-15 05:35:44 -04:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src/)
|
|
|
|
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/lib/mbedtls/include)
|
2015-01-09 09:07:59 -05:00
|
|
|
|
2020-05-21 18:52:19 -04:00
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2015-01-17 17:33:59 -05:00
|
|
|
# Create a single Network library that contains all the networking code:
|
2015-01-18 05:57:16 -05:00
|
|
|
set (Network_SRCS
|
2020-10-15 05:35:44 -04:00
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/Event.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/HostnameLookup.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/IPLookup.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/IsThread.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/NetworkInterfaceEnum.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/NetworkLookup.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/NetworkSingleton.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/ServerHandleImpl.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/StackTrace.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/TCPLinkImpl.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/WinStackWalker.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/CtrDrbgContext.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/CryptoKey.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/EntropyContext.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/SslConfig.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/SslContext.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/X509Cert.cpp
|
|
|
|
${PROJECT_SOURCE_DIR}/src/StringUtils.cpp
|
2015-01-12 09:45:30 -05:00
|
|
|
)
|
|
|
|
|
2015-01-18 05:57:16 -05:00
|
|
|
set (Network_HDRS
|
2020-10-15 05:35:44 -04:00
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/CriticalSection.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/Event.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/GetAddressInfoError.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/HostnameLookup.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/IPLookup.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/IsThread.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/Network.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/NetworkLookup.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/NetworkSingleton.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/ServerHandleImpl.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/StackTrace.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/TCPLinkImpl.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/Queue.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/OSSupport/WinStackWalker.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/CtrDrbgContext.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/CryptoKey.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/EntropyContext.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/SslConfig.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/SslContext.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/mbedTLS++/X509Cert.h
|
|
|
|
${PROJECT_SOURCE_DIR}/src/StringUtils.h
|
2015-01-18 05:57:16 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(Network
|
|
|
|
${Network_SRCS}
|
|
|
|
${Network_HDRS}
|
|
|
|
)
|
|
|
|
|
2018-01-03 12:41:16 -05:00
|
|
|
target_link_libraries(Network event_core event_extra fmt::fmt mbedtls)
|
2020-05-21 18:52:19 -04:00
|
|
|
if(NOT WIN32)
|
|
|
|
target_link_libraries(Network event_pthreads Threads::Threads)
|
2015-01-11 05:21:18 -05:00
|
|
|
endif()
|
2015-01-09 09:07:59 -05:00
|
|
|
|
2016-08-24 15:45:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-01-17 17:33:59 -05:00
|
|
|
|
|
|
|
# Define individual tests:
|
|
|
|
|
|
|
|
# Google: download the google.com frontpage using http client socket:
|
2015-01-09 09:07:59 -05:00
|
|
|
add_executable(Google-exe Google.cpp)
|
|
|
|
target_link_libraries(Google-exe Network)
|
|
|
|
add_test(NAME Google-test COMMAND Google-exe)
|
2015-01-11 05:21:18 -05:00
|
|
|
|
2015-01-17 17:33:59 -05:00
|
|
|
# EchoServer: Listen on port 9876, echo everything back:
|
2015-01-11 05:21:18 -05:00
|
|
|
add_executable(EchoServer EchoServer.cpp)
|
|
|
|
target_link_libraries(EchoServer Network)
|
|
|
|
|
2015-01-17 17:33:59 -05:00
|
|
|
# NameLookup: Lookup hostname-to-IP and IP-to-hostname:
|
2015-01-11 05:21:18 -05:00
|
|
|
add_executable(NameLookup NameLookup.cpp)
|
|
|
|
target_link_libraries(NameLookup Network)
|
2016-03-13 13:12:33 -04:00
|
|
|
|
|
|
|
# EnumInterfaces: List all network interfaces:
|
|
|
|
add_executable(EnumInterfaces-exe EnumInterfaces.cpp)
|
|
|
|
target_link_libraries(EnumInterfaces-exe Network)
|
|
|
|
add_test(NAME EnumInterfaces-test COMMAND EnumInterfaces-exe)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Put all the tests into a solution folder (MSVC):
|
|
|
|
set_target_properties(
|
|
|
|
EchoServer
|
|
|
|
Google-exe
|
|
|
|
NameLookup
|
|
|
|
EnumInterfaces-exe
|
2016-03-13 13:22:35 -04:00
|
|
|
PROPERTIES FOLDER Tests/Network
|
|
|
|
)
|
|
|
|
set_target_properties(
|
|
|
|
Network
|
2020-05-16 15:59:10 -04:00
|
|
|
PROPERTIES FOLDER Tests/Libraries
|
2016-03-13 13:12:33 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|