77 lines
2.5 KiB
CMake
77 lines
2.5 KiB
CMake
include_guard(GLOBAL)
|
|
block()
|
|
set(libwebsockets_opts
|
|
# Library
|
|
-DLWS_WITH_STATIC=ON
|
|
-DLWS_WITH_SHARED=OFF
|
|
# WebTransport / HTTP3 / QUIC
|
|
-DLWS_WITH_HTTP3=ON
|
|
-DLWS_ROLE_QUIC=ON
|
|
-DLWS_WITH_UDP=ON
|
|
# Keep HTTP / WebSocket available
|
|
-DLWS_ROLE_H1=ON
|
|
-DLWS_ROLE_WS=ON
|
|
-DLWS_WITH_HTTP2=ON
|
|
# Client + Server
|
|
-DLWS_WITHOUT_CLIENT=OFF
|
|
-DLWS_WITHOUT_SERVER=OFF
|
|
# No tests / examples
|
|
-DLWS_WITHOUT_TESTAPPS=ON
|
|
-DLWS_WITH_MINIMAL_EXAMPLES=OFF
|
|
-DLWS_WITH_SELFTESTS=OFF
|
|
# No plugins
|
|
-DLWS_WITH_PLUGINS=OFF
|
|
-DLWS_WITH_PLUGINS_BUILTIN=OFF
|
|
# Export installed CMake targets
|
|
-DLWS_WITH_EXPORT_LWSTARGETS=ON
|
|
# Misc
|
|
-DLWS_WITHOUT_EXTENSIONS=ON
|
|
-DLWS_WITH_LWSWS=OFF
|
|
-DLWS_WITH_CGI=OFF
|
|
-DLWS_WITH_THREADPOOL=OFF
|
|
-DLWS_WITH_LIBUV=OFF
|
|
-DLWS_WITH_LIBEVENT=OFF
|
|
-DLWS_WITH_LIBEV=OFF
|
|
)
|
|
# Windows v5.0+ WebTransport / QUIC can use native SChannel.
|
|
if (WIN32)
|
|
list(APPEND libwebsockets_opts
|
|
-DLWS_WITH_SCHANNEL=ON
|
|
# The cl.bat compiler wrapper can report a failed include probe
|
|
# as successful. MSVC does not provide sys/types.h.
|
|
-DLWS_HAVE_SYS_TYPES_H=OFF
|
|
# Upstream C sources contain UTF-8 text and build with /WX.
|
|
-DCMAKE_C_FLAGS=-utf-8
|
|
)
|
|
endif ()
|
|
set(cmake_library_output_message_log TRUE)
|
|
_register_git_cmake_library(global::libwebsockets
|
|
"https://github.com/warmcat/libwebsockets.git"
|
|
"v5.0.0"
|
|
)
|
|
rcl_get_effective_install_dir(
|
|
global::libwebsockets
|
|
LIBWEBSOCKETS_ROOT
|
|
)
|
|
set(libwebsockets_DIR
|
|
"${LIBWEBSOCKETS_ROOT}/lib/cmake/libwebsockets"
|
|
)
|
|
rcl_cmake_library_set_cmake_options(
|
|
global::libwebsockets
|
|
${libwebsockets_opts}
|
|
)
|
|
rcl_cmake_library_set_other_use_opt(
|
|
global::libwebsockets
|
|
"-Dlibwebsockets_DIR=\"${libwebsockets_DIR}\""
|
|
)
|
|
rcl_cmake_library_set_init_script(
|
|
global::libwebsockets
|
|
"set(libwebsockets_DIR \"${libwebsockets_DIR}\")"
|
|
"find_package(libwebsockets 5.0 CONFIG REQUIRED)"
|
|
)
|
|
rcl_cmake_library_set_clear_script(
|
|
global::libwebsockets
|
|
"unset(libwebsockets_DIR)"
|
|
)
|
|
endblock()
|