add uWebsockets in CMakeList.txt
This commit is contained in:
parent
edb8f4a3ae
commit
e57d8ed546
@ -73,6 +73,62 @@ if (SPDLOG_LIBRARY)
|
|||||||
add_compile_definitions(PUBLIC USE_SPDLOG_LIBRARY)
|
add_compile_definitions(PUBLIC USE_SPDLOG_LIBRARY)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
option(USE_UWEBSOCKET "Use of uWebsocket library for websocket-related staff" ON)
|
||||||
|
|
||||||
|
if (USE_UWEBSOCKET)
|
||||||
|
include(FetchContent)
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
FetchContent_Declare(uwebsockets
|
||||||
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/uWebsockets
|
||||||
|
BINARY_DIR ${CMAKE_BINARY_DIR}
|
||||||
|
GIT_REPOSITORY "https://github.com/uNetworking/uWebSockets.git"
|
||||||
|
GIT_TAG "v20.67.0"
|
||||||
|
GIT_SHALLOW TRUE
|
||||||
|
GIT_SUBMODULES ""
|
||||||
|
GIT_PROGRESS TRUE
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(uwebsockets)
|
||||||
|
FetchContent_GetProperties(uwebsockets SOURCE_DIR uwebsockets_SOURCE_DIR)
|
||||||
|
|
||||||
|
set(UWEBSOCKET_INCLUDE_DIR ${uwebsockets_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
FetchContent_Declare(usockets
|
||||||
|
SOURCE_DIR ${uwebsockets_SOURCE_DIR}/uSockets
|
||||||
|
BINARY_DIR ${CMAKE_BINARY_DIR}
|
||||||
|
GIT_REPOSITORY "https://github.com/uNetworking/uSockets.git"
|
||||||
|
GIT_TAG "v0.8.8"
|
||||||
|
GIT_SHALLOW TRUE
|
||||||
|
GIT_SUBMODULES ""
|
||||||
|
GIT_PROGRESS TRUE
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(usockets)
|
||||||
|
FetchContent_GetProperties(usockets SOURCE_DIR usockets_SOURCE_DIR)
|
||||||
|
|
||||||
|
set(USOCKETS_INCLUDE_DIR ${usockets_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
ExternalProject_Add(LIBUS
|
||||||
|
SOURCE_DIR ${usockets_SOURCE_DIR}
|
||||||
|
PREFIX ${CMAKE_BINARY_DIR}/_deps
|
||||||
|
BUILD_IN_SOURCE TRUE
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ${CMAKE_COMMAND} -E env "WITH_OPENSSL=1" make
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
BUILD_BYPRODUCTS ${usockets_SOURCE_DIR}/uSockets.a
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(LIBUS_LIB STATIC IMPORTED)
|
||||||
|
set_target_properties(LIBUS_LIB PROPERTIES IMPORTED_LOCATION ${usockets_SOURCE_DIR}/uSockets.a)
|
||||||
|
get_target_property(LIBUS_LIB_PATH LIBUS_LIB IMPORTED_LOCATION)
|
||||||
|
|
||||||
|
include_directories(${USOCKETS_INCLUDE_DIR})
|
||||||
|
include_directories(${UWEBSOCKETS_INCLUDE_DIR})
|
||||||
|
|
||||||
|
endif(USE_UWEBSOCKET)
|
||||||
|
|
||||||
option(BUILD_TESTS "Build tests" ON)
|
option(BUILD_TESTS "Build tests" ON)
|
||||||
|
|
||||||
if (BUILD_TESTS)
|
if (BUILD_TESTS)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user