make TLS support optional
This commit is contained in:
23
examples/chat/CMakeLists.txt
Normal file
23
examples/chat/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# cmd_websocket_chat.cpp
|
||||
# Author: Benjamin Sergeant
|
||||
# Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
cmake_minimum_required (VERSION 3.4.1)
|
||||
project (cmd_websocket_chat)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
|
||||
option(USE_TLS "Add TLS support" ON)
|
||||
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/../.. ixwebsocket)
|
||||
|
||||
add_executable(cmd_websocket_chat cmd_websocket_chat.cpp)
|
||||
|
||||
if (APPLE AND USE_TLS)
|
||||
target_link_libraries(cmd_websocket_chat "-framework foundation" "-framework security")
|
||||
endif()
|
||||
|
||||
target_link_libraries(cmd_websocket_chat ixwebsocket)
|
||||
install(TARGETS cmd_websocket_chat DESTINATION bin)
|
39
examples/chat/README.md
Normal file
39
examples/chat/README.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Building
|
||||
|
||||
1. cmake -G .
|
||||
2. make
|
||||
|
||||
## Disable TLS
|
||||
|
||||
chat$ cmake -DUSE_TLS=OFF .
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /Users/bsergeant/src/foss/ixwebsocket/examples/chat
|
||||
chat$ make
|
||||
Scanning dependencies of target ixwebsocket
|
||||
[ 16%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocket.cpp.o
|
||||
[ 33%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocket.cpp.o
|
||||
[ 50%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.o
|
||||
[ 66%] Linking CXX static library libixwebsocket.a
|
||||
[ 66%] Built target ixwebsocket
|
||||
[ 83%] Linking CXX executable cmd_websocket_chat
|
||||
[100%] Built target cmd_websocket_chat
|
||||
|
||||
## Enable TLS (default)
|
||||
|
||||
```
|
||||
chat$ cmake -DUSE_TLS=ON .
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
-- Build files have been written to: /Users/bsergeant/src/foss/ixwebsocket/examples/chat
|
||||
(venv) chat$ make
|
||||
Scanning dependencies of target ixwebsocket
|
||||
[ 14%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocket.cpp.o
|
||||
[ 28%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocket.cpp.o
|
||||
[ 42%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.o
|
||||
[ 57%] Building CXX object ixwebsocket/CMakeFiles/ixwebsocket.dir/ixwebsocket/IXSocketAppleSSL.cpp.o
|
||||
[ 71%] Linking CXX static library libixwebsocket.a
|
||||
[ 71%] Built target ixwebsocket
|
||||
[ 85%] Linking CXX executable cmd_websocket_chat
|
||||
[100%] Built target cmd_websocket_chat
|
||||
```
|
@ -4,6 +4,8 @@
|
||||
# Copyright (c) 2017-2018 Machine Zone, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
# 'manual' way of building. You can also use cmake.
|
||||
|
||||
clang++ --std=c++11 --stdlib=libc++ \
|
||||
../../ixwebsocket/IXSocket.cpp \
|
||||
../../ixwebsocket/IXWebSocketTransport.cpp \
|
@ -12,7 +12,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <queue>
|
||||
#include "../../ixwebsocket/IXWebSocket.h"
|
||||
#include <ixwebsocket/IXWebSocket.h>
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
|
Reference in New Issue
Block a user