move snake code to its own subfolder like ixcobra, ixcrypto, etc...

This commit is contained in:
Benjamin Sergeant 2019-09-23 11:46:16 -07:00
parent cd3c9d879c
commit 1cde26771a
21 changed files with 47 additions and 26 deletions

View File

@ -216,6 +216,7 @@ if (USE_WS OR USE_TEST)
add_subdirectory(ixcore)
add_subdirectory(ixcrypto)
add_subdirectory(ixcobra)
add_subdirectory(ixsnake)
if (USE_WS)
add_subdirectory(ws)

33
ixsnake/CMakeLists.txt Normal file
View File

@ -0,0 +1,33 @@
#
# Author: Benjamin Sergeant
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
#
set (IXSNAKE_SOURCES
ixsnake/IXSnakeServer.cpp
ixsnake/IXSnakeProtocol.cpp
ixsnake/IXAppConfig.cpp
ixsnake/IXRedisClient.cpp
)
set (IXSNAKE_HEADERS
ixsnake/IXSnakeServer.h
ixsnake/IXSnakeProtocol.h
ixsnake/IXAppConfig.h
ixsnake/IXRedisClient.h
)
add_library(ixsnake STATIC
${IXSNAKE_SOURCES}
${IXSNAKE_HEADERS}
)
set(IXSNAKE_INCLUDE_DIRS
.
..
../ixcore
../ixcrypto
../ixwebsocket
../third_party)
target_include_directories( ixsnake PUBLIC ${IXSNAKE_INCLUDE_DIRS} )

View File

@ -9,10 +9,10 @@ install: brew
# on osx it is good practice to make /usr/local user writable
# sudo chown -R `whoami`/staff /usr/local
brew:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j install)
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4 install)
ws:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; make -j)
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; make -j 4)
uninstall:
xargs rm -fv < build/install_manifest.txt
@ -58,7 +58,7 @@ test_server:
# env TEST=Websocket_chat make test
# env TEST=heartbeat make test
test:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j)
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=1 -DUSE_TEST=1 .. ; make -j 4)
(cd test ; python2.7 run.py -r)
ws_test: ws

View File

@ -15,15 +15,12 @@ if (MAC)
option(USE_TLS "Add TLS support" ON)
endif()
set (WS ../ws)
include_directories(
${PROJECT_SOURCE_DIR}/Catch2/single_include
../third_party
../third_party/msgpack11
../third_party/spdlog/include
../ws
../ws/snake
)
# Shared sources
@ -34,12 +31,6 @@ set (SOURCES
../third_party/msgpack11/msgpack11.cpp
../third_party/jsoncpp/jsoncpp.cpp
${WS}/snake/IXSnakeServer.cpp
${WS}/snake/IXSnakeProtocol.cpp
${WS}/snake/IXAppConfig.cpp
${WS}/IXRedisClient.cpp
IXSocketTest.cpp
IXSocketConnectTest.cpp
IXWebSocketServerTest.cpp
@ -83,12 +74,13 @@ if (MAC)
endif()
if (APPLE AND USE_TLS)
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
endif()
target_link_libraries(ixwebsocket_unittest ixcore)
target_link_libraries(ixwebsocket_unittest ixcrypto)
target_link_libraries(ixwebsocket_unittest ixcobra)
target_link_libraries(ixwebsocket_unittest ixwebsocket)
target_link_libraries(ixwebsocket_unittest ixsnake)
install(TARGETS ixwebsocket_unittest DESTINATION bin)

View File

@ -4,7 +4,7 @@
* Copyright (c) 2017 Machine Zone. All rights reserved.
*/
#include "IXSnakeServer.h"
#include <ixsnake/IXSnakeServer.h>
#include "IXTest.h"
#include "catch.hpp"
#include <chrono>

View File

@ -3,12 +3,12 @@
* Copyright (c) 2018 Machine Zone. All rights reserved.
*/
#include "IXSnakeServer.h"
#include "IXTest.h"
#include "catch.hpp"
#include <iostream>
#include <ixcobra/IXCobraMetricsPublisher.h>
#include <ixcrypto/IXUuid.h>
#include <ixsnake/IXSnakeServer.h>
#include <set>
using namespace ix;

View File

@ -6,7 +6,7 @@
#pragma once
#include "IXAppConfig.h"
#include <ixsnake/IXAppConfig.h>
#include "IXGetFreePort.h"
#include <iostream>
#include <ixwebsocket/IXWebSocketServer.h>

View File

@ -24,7 +24,6 @@ include_directories(ws ../third_party)
include_directories(ws ../third_party/statsd-client-cpp/src)
include_directories(ws ../third_party/spdlog/include)
include_directories(ws ../third_party/cpp-linenoise)
include_directories(ws snake)
if (UNIX)
set( STATSD_CLIENT_SOURCES ../third_party/statsd-client-cpp/src/statsd_client.cpp)
@ -35,11 +34,6 @@ add_executable(ws
../third_party/jsoncpp/jsoncpp.cpp
${STATSD_CLIENT_SOURCES}
snake/IXSnakeServer.cpp
snake/IXSnakeProtocol.cpp
snake/IXAppConfig.cpp
IXRedisClient.cpp
IXSentryClient.cpp
ws_http_client.cpp
@ -53,12 +47,12 @@ add_executable(ws
ws_receive.cpp
ws_redis_publish.cpp
ws_redis_subscribe.cpp
ws_snake.cpp
ws_cobra_subscribe.cpp
ws_cobra_metrics_publish.cpp
ws_cobra_publish.cpp
ws_cobra_to_statsd.cpp
ws_cobra_to_sentry.cpp
ws_snake.cpp
ws_httpd.cpp
ws_autobahn.cpp
ws.cpp)
@ -67,6 +61,7 @@ target_link_libraries(ws ixcore)
target_link_libraries(ws ixcrypto)
target_link_libraries(ws ixcobra)
target_link_libraries(ws ixwebsocket)
target_link_libraries(ws ixsnake)
if(NOT APPLE AND NOT USE_MBED_TLS)
find_package(OpenSSL REQUIRED)

View File

@ -4,7 +4,7 @@
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
*/
#include "IXRedisClient.h"
#include <ixsnake/IXRedisClient.h>
#include <iostream>
#include <sstream>

View File

@ -4,7 +4,7 @@
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
*/
#include "IXRedisClient.h"
#include <ixsnake/IXRedisClient.h>
#include <atomic>
#include <chrono>
#include <iostream>

View File

@ -4,7 +4,7 @@
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
*/
#include "IXSnakeServer.h"
#include <ixsnake/IXSnakeServer.h>
#include <fstream>
#include <iostream>
#include <sstream>