restructure project

This commit is contained in:
Benjamin Sergeant committed 2019-09-10 12:19:22 -07:00
1 parent 65c5c5f894
commit 2453f5b717
26 files changed
+107 -32

No files matched your search

+10 -2
View File
@@ -12,8 +12,7 @@ set (CMAKE_CXX_STANDARD 14)
set (CXX_STANDARD_REQUIRED ON) set (CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF) set (CMAKE_CXX_EXTENSIONS OFF)
# -Wshorten-64-to-32 does not work with clang if (UNIX)
if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif() endif()
@@ -211,6 +210,15 @@ install(TARGETS ixwebsocket
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ixwebsocket/ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ixwebsocket/
) )
if (USE_WS OR USE_TEST)
add_subdirectory(ixcore)
add_subdirectory(ixcrypto)
add_subdirectory(ixcobra)
if (USE_WS) if (USE_WS)
add_subdirectory(ws) add_subdirectory(ws)
endif() endif()
if (USE_TEST)
add_subdirectory(test)
endif()
endif()
+30
View File
@@ -0,0 +1,30 @@
#
# Author: Benjamin Sergeant
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
#
set (IXCOBRA_SOURCES
ixcobra/IXCobraConnection.cpp
ixcobra/IXCobraMetricsThreadedPublisher.cpp
ixcobra/IXCobraMetricsPublisher.cpp
)
set (IXCOBRA_HEADERS
ixcobra/IXCobraConnection.h
ixcobra/IXCobraMetricsThreadedPublisher.h
ixcobra/IXCobraMetricsPublisher.h
)
add_library(ixcobra STATIC
${IXCOBRA_SOURCES}
${IXCOBRA_HEADERS}
)
set(IXCOBRA_INCLUDE_DIRS
.
../ixcore
../ixcrypto
../ixwebsocket
../third_party)
target_include_directories( ixcobra PUBLIC ${IXCOBRA_INCLUDE_DIRS} )
File renamed without changes.
File renamed without changes.
File renamed without changes.
+19
View File
@@ -0,0 +1,19 @@
#
# Author: Benjamin Sergeant
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
#
set (IXCORE_SOURCES
ixcore/utils/IXCoreLogger.cpp
)
set (IXCORE_HEADERS
ixcore/utils/IXCoreLogger.h
)
add_library(ixcore STATIC
${IXCORE_SOURCES}
${IXCORE_HEADERS}
)
target_include_directories( ixcore PUBLIC . )
File renamed without changes.
File renamed without changes.
+29
View File
@@ -0,0 +1,29 @@
#
# Author: Benjamin Sergeant
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
#
set (IXCRYPTO_SOURCES
ixcrypto/IXHMac.cpp
ixcrypto/IXBase64.cpp
ixcrypto/IXUUid.cpp
ixcrypto/IXHash.cpp
)
set (IXCRYPTO_HEADERS
ixcrypto/IXHMac.h
ixcrypto/IXBase64.h
ixcrypto/IXUUid.h
ixcrypto/IXHash.h
)
add_library(ixcrypto STATIC
${IXCRYPTO_SOURCES}
${IXCRYPTO_HEADERS}
)
set(IXCRYPTO_INCLUDE_DIRS
.
../ixcore)
target_include_directories( ixcrypto PUBLIC ${IXCRYPTO_INCLUDE_DIRS} )
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+4 -3
View File
@@ -9,7 +9,7 @@ install: brew
# on osx it is good practice to make /usr/local user writable # on osx it is good practice to make /usr/local user writable
# sudo chown -R `whoami`/staff /usr/local # sudo chown -R `whoami`/staff /usr/local
brew: brew:
mkdir -p build && (cd build ; cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_WS=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 install)
ws: 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)
@@ -57,8 +57,9 @@ test_server:
# env TEST=Websocket_server make test # env TEST=Websocket_server make test
# env TEST=Websocket_chat make test # env TEST=Websocket_chat make test
# env TEST=heartbeat make test # env TEST=heartbeat make test
test: test: brew
python2.7 test/run.py # (cd test ; ../build/test/ixwebsocket_unittest)
(cd test ; python2.7 run.py -r)
ws_test: ws ws_test: ws
(cd ws ; env DEBUG=1 PATH=../ws/build:$$PATH bash test_ws.sh) (cd ws ; env DEBUG=1 PATH=../ws/build:$$PATH bash test_ws.sh)
+4 -13
View File
@@ -15,8 +15,6 @@ if (MAC)
option(USE_TLS "Add TLS support" ON) option(USE_TLS "Add TLS support" ON)
endif() endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/.. ixwebsocket)
set (WS ../ws) set (WS ../ws)
include_directories( include_directories(
@@ -36,17 +34,6 @@ set (SOURCES
../third_party/msgpack11/msgpack11.cpp ../third_party/msgpack11/msgpack11.cpp
../third_party/jsoncpp/jsoncpp.cpp ../third_party/jsoncpp/jsoncpp.cpp
${WS}/ixcore/utils/IXCoreLogger.cpp
${WS}/ixcrypto/IXBase64.cpp
${WS}/ixcrypto/IXHash.cpp
${WS}/ixcrypto/IXUuid.cpp
${WS}/ixcrypto/IXHMac.cpp
${WS}/ixcobra/IXCobraConnection.cpp
${WS}/ixcobra/IXCobraMetricsPublisher.cpp
${WS}/ixcobra/IXCobraMetricsThreadedPublisher.cpp
${WS}/snake/IXSnakeServer.cpp ${WS}/snake/IXSnakeServer.cpp
${WS}/snake/IXSnakeProtocol.cpp ${WS}/snake/IXSnakeProtocol.cpp
${WS}/snake/IXAppConfig.cpp ${WS}/snake/IXAppConfig.cpp
@@ -99,5 +86,9 @@ if (APPLE AND USE_TLS)
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security") target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
endif() 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 ixwebsocket)
install(TARGETS ixwebsocket_unittest DESTINATION bin) install(TARGETS ixwebsocket_unittest DESTINATION bin)
+2
View File
@@ -309,6 +309,7 @@ TEST_CASE("Cobra_chat", "[cobra_chat]")
timeout -= 10; timeout -= 10;
if (timeout <= 0) if (timeout <= 0)
{ {
snakeServer.stop();
REQUIRE(false); // timeout REQUIRE(false); // timeout
} }
} }
@@ -332,6 +333,7 @@ TEST_CASE("Cobra_chat", "[cobra_chat]")
timeout -= 10; timeout -= 10;
if (timeout <= 0) if (timeout <= 0)
{ {
snakeServer.stop();
REQUIRE(false); // timeout REQUIRE(false); // timeout
} }
} }
+6 -3
View File
@@ -350,10 +350,11 @@ def generateXmlOutput(results, xmlOutput, testRunName, runTime):
def run(testName, buildDir, sanitizer, xmlOutput, def run(testName, buildDir, sanitizer, xmlOutput,
testRunName, buildOnly, useLLDB, cpuCount): testRunName, buildOnly, useLLDB, cpuCount, runOnly):
'''Main driver. Run cmake, compiles, execute and validate the testsuite.''' '''Main driver. Run cmake, compiles, execute and validate the testsuite.'''
# gen build files with CMake # gen build files with CMake
if not runOnly:
runCMake(sanitizer, buildDir) runCMake(sanitizer, buildDir)
if platform.system() == 'Linux': if platform.system() == 'Linux':
@@ -454,6 +455,8 @@ def main():
help='Validate XML output.') help='Validate XML output.')
parser.add_argument('--build_only', '-b', action='store_true', parser.add_argument('--build_only', '-b', action='store_true',
help='Stop after building. Do not run the unittest.') help='Stop after building. Do not run the unittest.')
parser.add_argument('--run_only', '-r', action='store_true',
help='Only run the test, do not build anything.')
parser.add_argument('--output', '-o', help='Output XML file.') parser.add_argument('--output', '-o', help='Output XML file.')
parser.add_argument('--lldb', action='store_true', parser.add_argument('--lldb', action='store_true',
help='Run the test through lldb.') help='Run the test through lldb.')
@@ -492,7 +495,7 @@ def main():
if platform.system() == 'Windows': if platform.system() == 'Windows':
TEST_EXE_PATH = os.path.join(buildDir, BUILD_TYPE, 'ixwebsocket_unittest.exe') TEST_EXE_PATH = os.path.join(buildDir, BUILD_TYPE, 'ixwebsocket_unittest.exe')
else: else:
TEST_EXE_PATH = os.path.join(buildDir, 'ixwebsocket_unittest') TEST_EXE_PATH = '../build/test/ixwebsocket_unittest'
if args.list: if args.list:
# catch2 exit with a different error code when requesting the list of files # catch2 exit with a different error code when requesting the list of files
@@ -511,7 +514,7 @@ def main():
args.lldb = False args.lldb = False
return run(args.test, buildDir, sanitizer, xmlOutput, return run(args.test, buildDir, sanitizer, xmlOutput,
testRunName, args.build_only, args.lldb, args.cpu_count) testRunName, args.build_only, args.lldb, args.cpu_count, args.run_only)
if __name__ == '__main__': if __name__ == '__main__':
+3 -11
View File
@@ -35,17 +35,6 @@ add_executable(ws
../third_party/jsoncpp/jsoncpp.cpp ../third_party/jsoncpp/jsoncpp.cpp
${STATSD_CLIENT_SOURCES} ${STATSD_CLIENT_SOURCES}
ixcore/utils/IXCoreLogger.cpp
ixcrypto/IXBase64.cpp
ixcrypto/IXHash.cpp
ixcrypto/IXUuid.cpp
ixcrypto/IXHMac.cpp
ixcobra/IXCobraConnection.cpp
ixcobra/IXCobraMetricsPublisher.cpp
ixcobra/IXCobraMetricsThreadedPublisher.cpp
snake/IXSnakeServer.cpp snake/IXSnakeServer.cpp
snake/IXSnakeProtocol.cpp snake/IXSnakeProtocol.cpp
snake/IXAppConfig.cpp snake/IXAppConfig.cpp
@@ -73,6 +62,9 @@ add_executable(ws
ws_autobahn.cpp ws_autobahn.cpp
ws.cpp) ws.cpp)
target_link_libraries(ws ixcore)
target_link_libraries(ws ixcrypto)
target_link_libraries(ws ixcobra)
target_link_libraries(ws ixwebsocket) target_link_libraries(ws ixwebsocket)
if(NOT APPLE AND NOT USE_MBED_TLS) if(NOT APPLE AND NOT USE_MBED_TLS)