IXWebSocket/test/CMakeLists.txt

110 lines
2.8 KiB
CMake
Raw Normal View History

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
set (CMAKE_CXX_STANDARD 14)
2018-12-30 03:33:15 +01:00
if (MAC)
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
../third_party
../third_party/msgpack11
../third_party/spdlog/include
../ws
2018-12-30 03:33:15 +01:00
)
add_definitions(-DSPDLOG_COMPILED_LIB=1)
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
set (SOURCES
${JSONCPP_SOURCES}
2018-12-30 03:33:15 +01:00
test_runner.cpp
IXTest.cpp
IXGetFreePort.cpp
../third_party/msgpack11/msgpack11.cpp
2019-01-06 02:02:39 +01:00
IXSocketTest.cpp
2019-03-21 18:06:59 +01:00
IXSocketConnectTest.cpp
IXWebSocketServerTest.cpp
IXWebSocketTestConnectionDisconnection.cpp
IXUrlParserTest.cpp
IXWebSocketServerTest.cpp
IXHttpClientTest.cpp
IXHttpServerTest.cpp
IXUnityBuildsTest.cpp
IXHttpTest.cpp
2019-09-27 23:34:47 +02:00
IXDNSLookupTest.cpp
IXWebSocketSubProtocolTest.cpp
IXSentryClientTest.cpp
2020-01-14 01:44:10 +01:00
IXWebSocketChatTest.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
if (UNIX)
list(APPEND SOURCES
IXWebSocketCloseTest.cpp
# Windows without TLS does not have hmac yet
IXCobraChatTest.cpp
IXCobraMetricsPublisherTest.cpp
IXCobraToSentryBotTest.cpp
2019-01-05 23:40:17 +01:00
)
endif()
# Some unittest fail for dubious reason on Ubuntu Xenial with TSAN
if (MAC OR WIN32)
list(APPEND SOURCES
IXWebSocketMessageQTest.cpp
)
endif()
# Ping test fails intermittently, disabling them for now
# IXWebSocketPingTest.cpp
# IXWebSocketPingTimeoutTest.cpp
# Disable tests for now that are failing or not reliable
2019-01-05 23:40:17 +01:00
add_executable(ixwebsocket_unittest ${SOURCES})
if (MAC)
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)
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
2018-12-30 03:33:15 +01:00
endif()
if (JSONCPP_FOUND)
target_include_directories(ixwebsocket_unittest PUBLIC ${JSONCPP_INCLUDE_DIRS})
target_link_libraries(ixwebsocket_unittest ${JSONCPP_LIBRARIES})
endif()
target_link_libraries(ixwebsocket_unittest ixsnake)
2019-09-10 21:19:22 +02:00
target_link_libraries(ixwebsocket_unittest ixcobra)
2018-12-30 03:33:15 +01:00
target_link_libraries(ixwebsocket_unittest ixwebsocket)
target_link_libraries(ixwebsocket_unittest ixcrypto)
target_link_libraries(ixwebsocket_unittest ixcore)
target_link_libraries(ixwebsocket_unittest ixsentry)
2020-03-12 17:07:01 +01:00
target_link_libraries(ixwebsocket_unittest ixbots)
2019-09-10 21:19:22 +02:00
target_link_libraries(ixwebsocket_unittest spdlog)
2018-12-30 03:33:15 +01:00
install(TARGETS ixwebsocket_unittest DESTINATION bin)