2019-02-20 18:59:07 -08:00
|
|
|
#
|
|
|
|
# Author: Benjamin Sergeant
|
|
|
|
# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
|
2020-09-26 13:51:19 -07:00
|
|
|
cmake_minimum_required (VERSION 3.14)
|
2019-02-21 21:24:53 -08:00
|
|
|
project (ws)
|
2019-02-20 18:59:07 -08:00
|
|
|
|
|
|
|
# There's -Weverything too for clang
|
2019-04-16 18:51:57 +03:00
|
|
|
if (NOT WIN32)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
|
|
|
|
endif()
|
2019-02-20 18:59:07 -08:00
|
|
|
|
2019-04-22 17:24:01 -07:00
|
|
|
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
|
|
|
# set(CMAKE_LD_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
2019-04-11 16:03:05 -07:00
|
|
|
|
2020-11-15 21:08:45 -08:00
|
|
|
set (CMAKE_CXX_STANDARD 11)
|
2019-02-20 18:59:07 -08:00
|
|
|
|
|
|
|
option(USE_TLS "Add TLS support" ON)
|
|
|
|
|
2019-02-21 21:24:53 -08:00
|
|
|
include_directories(ws .)
|
2019-02-22 20:49:26 -08:00
|
|
|
include_directories(ws ..)
|
2019-07-25 11:54:50 -07:00
|
|
|
include_directories(ws ../third_party/cpp-linenoise)
|
2019-02-20 18:59:07 -08:00
|
|
|
|
2020-09-30 14:24:04 -07:00
|
|
|
find_package(JsonCpp)
|
|
|
|
if (NOT JSONCPP_FOUND)
|
|
|
|
include_directories(../third_party/jsoncpp)
|
|
|
|
set(JSONCPP_SOURCES ../third_party/jsoncpp/jsoncpp.cpp)
|
|
|
|
endif()
|
|
|
|
|
2020-06-25 10:05:02 -07:00
|
|
|
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}")
|
2020-06-24 23:21:19 -07:00
|
|
|
endif()
|
|
|
|
|
2020-03-21 19:31:38 -07:00
|
|
|
add_executable(ws
|
2019-02-21 21:24:53 -08:00
|
|
|
../third_party/msgpack11/msgpack11.cpp
|
2020-06-11 18:01:45 -07:00
|
|
|
../third_party/cpp-linenoise/linenoise.cpp
|
2019-12-03 16:01:46 -08:00
|
|
|
${JSONCPP_SOURCES}
|
2019-02-21 21:24:53 -08:00
|
|
|
ws.cpp)
|
2019-02-20 18:59:07 -08:00
|
|
|
|
2020-03-22 21:57:58 -07:00
|
|
|
# library with the most dependencies come first
|
|
|
|
target_link_libraries(ws ixbots)
|
2019-09-23 12:30:46 -07:00
|
|
|
target_link_libraries(ws ixsnake)
|
2019-09-10 12:19:22 -07:00
|
|
|
target_link_libraries(ws ixcobra)
|
2020-03-22 21:57:58 -07:00
|
|
|
target_link_libraries(ws ixsentry)
|
2020-06-10 22:30:55 -07:00
|
|
|
target_link_libraries(ws ixredis)
|
2019-02-21 21:24:53 -08:00
|
|
|
target_link_libraries(ws ixwebsocket)
|
2019-09-23 12:30:46 -07:00
|
|
|
target_link_libraries(ws ixcrypto)
|
|
|
|
target_link_libraries(ws ixcore)
|
2019-04-16 18:51:57 +03:00
|
|
|
|
2019-12-25 09:03:57 -08:00
|
|
|
target_link_libraries(ws spdlog)
|
2020-06-25 10:05:02 -07:00
|
|
|
if (USE_PYTHON)
|
2020-06-24 23:21:19 -07:00
|
|
|
target_link_libraries(ws ${Python_LIBRARIES})
|
|
|
|
endif()
|
2019-12-25 09:03:57 -08:00
|
|
|
|
2020-09-30 14:24:04 -07:00
|
|
|
if (JSONCPP_FOUND)
|
|
|
|
target_include_directories(ws PUBLIC ${JSONCPP_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(ws ${JSONCPP_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2019-02-21 22:05:30 -08:00
|
|
|
install(TARGETS ws RUNTIME DESTINATION bin)
|