2018-12-29 18:33:15 -08:00
|
|
|
#
|
|
|
|
# Author: Benjamin Sergeant
|
|
|
|
# Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
|
|
|
|
#
|
2019-01-07 18:04:28 -08:00
|
|
|
cmake_minimum_required (VERSION 3.4.1)
|
|
|
|
project (ixwebsocket_unittest)
|
2018-12-29 18:33:15 -08:00
|
|
|
|
2019-01-11 21:25:06 -08:00
|
|
|
set (CMAKE_CXX_STANDARD 14)
|
2018-12-29 18:33:15 -08:00
|
|
|
|
2019-06-23 14:54:21 -07:00
|
|
|
if (MAC)
|
2019-05-13 04:37:22 +03:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../third_party/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
|
|
|
|
find_package(Sanitizers)
|
2019-05-06 19:13:42 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
|
|
|
set(CMAKE_LD_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
2019-01-04 17:28:13 -08:00
|
|
|
option(USE_TLS "Add TLS support" ON)
|
|
|
|
endif()
|
2018-12-29 18:33:15 -08:00
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/Catch2/single_include
|
2019-09-05 20:48:38 -07:00
|
|
|
../third_party
|
2019-02-21 21:24:53 -08:00
|
|
|
../third_party/msgpack11
|
2019-05-09 15:30:44 -07:00
|
|
|
../third_party/spdlog/include
|
|
|
|
../ws
|
2018-12-29 18:33:15 -08:00
|
|
|
)
|
|
|
|
|
2019-12-25 09:03:57 -08:00
|
|
|
add_definitions(-DSPDLOG_COMPILED_LIB=1)
|
|
|
|
|
2019-12-03 16:01:46 -08:00
|
|
|
find_package(JsonCpp)
|
|
|
|
if (NOT JSONCPP_FOUND)
|
|
|
|
include_directories(../third_party/jsoncpp)
|
|
|
|
set(JSONCPP_SOURCES ../third_party/jsoncpp/jsoncpp.cpp)
|
|
|
|
endif()
|
|
|
|
|
2019-01-05 14:40:17 -08:00
|
|
|
# Shared sources
|
2019-09-17 12:08:52 -07:00
|
|
|
set (SOURCES
|
2019-12-03 16:01:46 -08:00
|
|
|
${JSONCPP_SOURCES}
|
|
|
|
|
2018-12-29 18:33:15 -08:00
|
|
|
test_runner.cpp
|
|
|
|
IXTest.cpp
|
2019-06-23 14:54:21 -07:00
|
|
|
IXGetFreePort.cpp
|
2019-02-21 21:24:53 -08:00
|
|
|
../third_party/msgpack11/msgpack11.cpp
|
2019-09-05 20:48:38 -07:00
|
|
|
|
2020-03-22 19:39:28 -07:00
|
|
|
IXSocketTest.cpp
|
|
|
|
IXSocketConnectTest.cpp
|
|
|
|
IXWebSocketServerTest.cpp
|
|
|
|
IXWebSocketTestConnectionDisconnection.cpp
|
|
|
|
IXUrlParserTest.cpp
|
|
|
|
IXWebSocketServerTest.cpp
|
|
|
|
IXHttpClientTest.cpp
|
|
|
|
IXHttpServerTest.cpp
|
|
|
|
IXUnityBuildsTest.cpp
|
|
|
|
IXHttpTest.cpp
|
|
|
|
IXDNSLookupTest.cpp
|
|
|
|
IXWebSocketSubProtocolTest.cpp
|
|
|
|
IXSentryClientTest.cpp
|
|
|
|
IXWebSocketChatTest.cpp
|
2020-03-30 22:27:41 -07:00
|
|
|
IXWebSocketBroadcastTest.cpp
|
2018-12-29 18:33:15 -08:00
|
|
|
)
|
|
|
|
|
2019-01-05 14:40:17 -08:00
|
|
|
# Some unittest don't work on windows yet
|
2020-03-22 19:36:29 -07:00
|
|
|
# Windows without TLS does not have hmac yet
|
2019-05-13 16:51:58 -07:00
|
|
|
if (UNIX)
|
2019-05-06 22:22:57 +03:00
|
|
|
list(APPEND SOURCES
|
2020-03-22 19:39:28 -07:00
|
|
|
IXWebSocketCloseTest.cpp
|
|
|
|
IXCobraChatTest.cpp
|
|
|
|
IXCobraMetricsPublisherTest.cpp
|
|
|
|
IXCobraToSentryBotTest.cpp
|
2020-03-22 19:36:29 -07:00
|
|
|
IXCobraToStatsdBotTest.cpp
|
2020-04-16 21:58:10 -07:00
|
|
|
IXCobraToStdoutBotTest.cpp
|
2019-01-05 14:40:17 -08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-06-01 17:41:48 -07:00
|
|
|
# Ping test fails intermittently, disabling them for now
|
|
|
|
# IXWebSocketPingTest.cpp
|
|
|
|
# IXWebSocketPingTimeoutTest.cpp
|
|
|
|
|
2019-05-15 19:19:13 -07:00
|
|
|
# Disable tests for now that are failing or not reliable
|
2019-05-13 17:01:22 -07:00
|
|
|
|
2019-01-05 14:40:17 -08:00
|
|
|
add_executable(ixwebsocket_unittest ${SOURCES})
|
2019-05-13 04:37:22 +03:00
|
|
|
|
2019-06-23 14:54:21 -07:00
|
|
|
if (MAC)
|
2019-05-13 04:37:22 +03:00
|
|
|
add_sanitizers(ixwebsocket_unittest)
|
|
|
|
endif()
|
2019-01-05 14:40:17 -08:00
|
|
|
|
2018-12-29 18:33:15 -08:00
|
|
|
if (APPLE AND USE_TLS)
|
2019-09-23 11:46:16 -07:00
|
|
|
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
|
2018-12-29 18:33:15 -08:00
|
|
|
endif()
|
|
|
|
|
2019-12-03 16:01:46 -08:00
|
|
|
if (JSONCPP_FOUND)
|
|
|
|
target_include_directories(ixwebsocket_unittest PUBLIC ${JSONCPP_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(ixwebsocket_unittest ${JSONCPP_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2020-03-22 21:57:58 -07:00
|
|
|
# library with the most dependencies come first
|
|
|
|
target_link_libraries(ixwebsocket_unittest ixbots)
|
2019-09-23 12:30:46 -07:00
|
|
|
target_link_libraries(ixwebsocket_unittest ixsnake)
|
2019-09-10 12:19:22 -07:00
|
|
|
target_link_libraries(ixwebsocket_unittest ixcobra)
|
2020-03-22 21:57:58 -07:00
|
|
|
target_link_libraries(ixwebsocket_unittest ixsentry)
|
2018-12-29 18:33:15 -08:00
|
|
|
target_link_libraries(ixwebsocket_unittest ixwebsocket)
|
2019-09-23 12:30:46 -07:00
|
|
|
target_link_libraries(ixwebsocket_unittest ixcrypto)
|
|
|
|
target_link_libraries(ixwebsocket_unittest ixcore)
|
2019-09-10 12:19:22 -07:00
|
|
|
|
2019-12-25 09:03:57 -08:00
|
|
|
target_link_libraries(ixwebsocket_unittest spdlog)
|
|
|
|
|
2018-12-29 18:33:15 -08:00
|
|
|
install(TARGETS ixwebsocket_unittest DESTINATION bin)
|