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