IXWebSocket/test/CMakeLists.txt

116 lines
3.1 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.
#
cmake_minimum_required (VERSION 3.14)
2019-01-08 03:04:28 +01:00
project (ixwebsocket_unittest)
2018-12-30 03:33:15 +01:00
set (CMAKE_CXX_STANDARD 14)
2018-12-30 03:33:15 +01:00
option(USE_TLS "Add TLS support" ON)
2018-12-30 03:33:15 +01:00
include_directories(
${PROJECT_SOURCE_DIR}/Catch2/single_include
../third_party
../third_party/msgpack11
../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
../third_party/msgpack11/msgpack11.cpp
2020-03-23 03:39:28 +01:00
IXSocketTest.cpp
IXSocketConnectTest.cpp
# 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
IXWebSocketBroadcastTest.cpp
IXWebSocketPerMessageDeflateCompressorTest.cpp
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
# Windows without TLS does not have hmac yet
if (UNIX)
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
IXCobraToStatsdBotTest.cpp
IXCobraToStdoutBotTest.cpp
2019-01-05 23:40:17 +01:00
)
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()
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}")
endif()
2020-03-23 05:57:58 +01:00
# library with the most dependencies come first
target_link_libraries(ixwebsocket_unittest ixbots)
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)
target_link_libraries(ixwebsocket_unittest ixredis)
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)
2019-09-10 21:19:22 +02:00
target_link_libraries(ixwebsocket_unittest spdlog)
if (USE_PYTHON)
target_link_libraries(ixwebsocket_unittest ${Python_LIBRARIES})
endif()
2018-12-30 03:33:15 +01:00
install(TARGETS ixwebsocket_unittest DESTINATION bin)