cmake_minimum_required(VERSION 3.10)
project(joyinside)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG)

option(LWS_WITH_TLS "Build with TLS support" ON)
option(LWS_WITH_MINIMAL_EXAMPLES "Build with examples" OFF)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")

set(LWS_WITHOUT_TESTAPPS ON CACHE BOOL "Don't build the libwebsocket-test-apps")
set(LWS_WITH_STATIC ON CACHE BOOL "Build the static version of the library")
set(LWS_WITH_SHARED OFF CACHE BOOL "Do not build the shared version of the library")

include_directories(
    thirdparty/spdlog/include
    thirdparty/libwebsockets/include
    src
)

add_subdirectory(thirdparty/libwebsockets)
add_subdirectory(thirdparty/spdlog)

set(SRC_LIST
    src/websocket_client.cpp
)

add_library(joyinside SHARED ${SRC_LIST})

find_package(Threads REQUIRED)

target_link_libraries(joyinside PRIVATE Threads::Threads websockets spdlog)
