@@ -63,18 +63,39 @@ if (ESP_PLATFORM)
6363endif ()
6464
6565# it's at this point any toolchain file is brought in
66- project (libwebsockets C CXX)
66+ project (libwebsockets C)
67+ if (LWS_WITH_SECURE_STREAMS_CPP)
68+ enable_language (CXX)
69+ endif ()
6770include (CTest)
6871
6972if (ESP_PLATFORM)
7073 include_directories (
71- ${IDF_PATH} /components/freertos/port/xtensa/include /
72- ${IDF_PATH} /components/hal/include
73- ${IDF_PATH} /components/soc/${CONFIG_IDF_TARGET} /include /
74- ${IDF_PATH} /components/soc/include /
75- ${IDF_PATH} /components/esp_hw_support/include
76- ${IDF_PATH} /components/hal/${CONFIG_IDF_TARGET} /include /
77- )
74+ $ENV{IDF_PATH} /components/esp_hw_support/include /soc/
75+ $ENV{IDF_PATH} /components/freertos/include /
76+ $ENV{IDF_PATH} /components/freertos/esp_additions/include /
77+ $ENV{IDF_PATH} /components/freertos/esp_additions/include /freertos/
78+ $ENV{IDF_PATH} /components/freertos/FreeRTOS-Kernel/include /
79+ $ENV{IDF_PATH} /components/freertos/FreeRTOS-Kernel/portable/linux/include /
80+ $ENV{IDF_PATH} /components/xtensa/${CONFIG_IDF_TARGET} /include /
81+ $ENV{IDF_PATH} /components/freertos/include /esp_additions
82+ $ENV{IDF_PATH} /components/hal/include
83+ $ENV{IDF_PATH} /components/soc/${CONFIG_IDF_TARGET} /include /
84+ $ENV{IDF_PATH} /components/soc/include /
85+ $ENV{IDF_PATH} /components/esp_hw_support/include
86+ $ENV{IDF_PATH} /components/hal/${CONFIG_IDF_TARGET} /include /
87+ )
88+
89+ if (CONFIG_IDF_TARGET_ARCH_RISCV)
90+ include_directories (
91+ $ENV{IDF_PATH} /components/freertos/port/riscv/include
92+ $ENV{IDF_PATH} /components/riscv/include )
93+ else ()
94+ include_directories (
95+ $ENV{IDF_PATH} /components/freertos/port/xtensa/include
96+ $ENV{IDF_PATH} /components/xtensa/include )
97+ endif ()
98+
7899endif ()
79100
80101
@@ -139,6 +160,8 @@ option(LWS_WITH_SECURE_STREAMS_PROXY_API "Secure Streams support to work across
139160option (LWS_WITH_SECURE_STREAMS_SYS_AUTH_API_AMAZON_COM "Auth support for api.amazon.com" OFF )
140161option (LWS_WITH_SECURE_STREAMS_STATIC_POLICY_ONLY "Secure Streams Policy is hardcoded only" OFF )
141162option (LWS_WITH_SECURE_STREAMS_AUTH_SIGV4 "Secure Streams Auth support for AWS Sigv4" OFF )
163+ option (LWS_WITH_SECURE_STREAMS_BUFFER_DUMP "Secure Streams protocol buffer dump" OFF )
164+ option (LWS_WITH_SS_DIRECT_PROTOCOL_STR "Secure Streams directly set/get metadata w/o policy" OFF )
142165
143166#
144167# CTest options
@@ -159,11 +182,12 @@ option(LWS_WITH_SSL "Include SSL support (defaults to OpenSSL or similar, mbedTL
159182option (LWS_WITH_MBEDTLS "Use mbedTLS (>=2.0) replacement for OpenSSL. When setting this, you also may need to specify LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS" OFF )
160183option (LWS_WITH_BORINGSSL "Use BoringSSL replacement for OpenSSL" OFF )
161184option (LWS_WITH_CYASSL "Use CyaSSL replacement for OpenSSL. When setting this, you also need to specify LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS" OFF )
162- option (LWS_WITH_WOLFSSL "Use wolfSSL replacement for OpenSSL. When setting this, you also need to specify LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS" OFF )
185+ option (LWS_WITH_WOLFSSL "Use wolfSSL replacement for OpenSSL. When setting this, you also may need to specify LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS" OFF )
163186option (LWS_SSL_CLIENT_USE_OS_CA_CERTS "SSL support should make use of the OS-installed CA root certs" ON )
164187option (LWS_TLS_LOG_PLAINTEXT_RX "For debugging log the received plaintext as soon as decrypted" OFF )
165188option (LWS_TLS_LOG_PLAINTEXT_TX "For debugging log the transmitted plaintext just before encryption" OFF )
166189option (LWS_WITH_TLS_SESSIONS "Enable persistent, resumable TLS sessions" ON )
190+ option (LWS_WITH_TLS_JIT_TRUST "Enable dynamically computing which trusted TLS CA is needed to be instantiated" OFF )
167191
168192#
169193# Event library options (may select multiple, or none for default poll()
@@ -195,7 +219,7 @@ option(LWS_WITH_STATIC "Build the static version of the library" ON)
195219option (LWS_WITH_SHARED "Build the shared version of the library" ON )
196220option (LWS_LINK_TESTAPPS_DYNAMIC "Link the test apps to the shared version of the library. Default is to link statically" OFF )
197221option (LWS_STATIC_PIC "Build the static version of the library with position-independent code" OFF )
198- option (LWS_SUPPRESS_DEPRECATED_API_WARNINGS "Turn off complaints about, eg, openssl deprecated api usage" OFF )
222+ option (LWS_SUPPRESS_DEPRECATED_API_WARNINGS "Turn off complaints about, eg, openssl 3 deprecated api usage" ON )
199223
200224#
201225# Specific platforms
@@ -210,11 +234,11 @@ option(LWS_PLAT_ANDROID "Android flavour of unix platform" OFF)
210234#
211235option (LWS_WITHOUT_CLIENT "Don't build the client part of the library" OFF )
212236option (LWS_WITHOUT_SERVER "Don't build the server part of the library" OFF )
213- option (LWS_WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" ON )
214- option (LWS_WITHOUT_TEST_SERVER "Don't build the test server" ON )
215- option (LWS_WITHOUT_TEST_SERVER_EXTPOLL "Don't build the test server version that uses external poll" ON )
216- option (LWS_WITHOUT_TEST_PING "Don't build the ping test application" ON )
217- option (LWS_WITHOUT_TEST_CLIENT "Don't build the client test application" ON )
237+ option (LWS_WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" OFF )
238+ option (LWS_WITHOUT_TEST_SERVER "Don't build the test server" OFF )
239+ option (LWS_WITHOUT_TEST_SERVER_EXTPOLL "Don't build the test server version that uses external poll" OFF )
240+ option (LWS_WITHOUT_TEST_PING "Don't build the ping test application" OFF )
241+ option (LWS_WITHOUT_TEST_CLIENT "Don't build the client test application" OFF )
218242#
219243# Extensions (permessage-deflate)
220244#
@@ -228,6 +252,8 @@ option(LWS_WITHOUT_BUILTIN_SHA1 "Don't build the lws sha-1 (eg, because openssl
228252option (LWS_WITHOUT_DAEMONIZE "Don't build the daemonization api" ON )
229253option (LWS_SSL_SERVER_WITH_ECDH_CERT "Include SSL server use ECDH certificate" OFF )
230254option (LWS_WITH_LEJP "With the Lightweight JSON Parser" ON )
255+ option (LWS_WITH_CBOR "With the Lightweight LECP CBOR Parser" OFF )
256+ option (LWS_WITH_CBOR_FLOAT "Build floating point types if building CBOR LECP" ON )
231257option (LWS_WITH_SQLITE3 "Require SQLITE3 support" OFF )
232258option (LWS_WITH_STRUCT_JSON "Generic struct serialization to and from JSON" OFF )
233259option (LWS_WITH_STRUCT_SQLITE3 "Generic struct serialization to and from SQLITE3" OFF )
@@ -246,7 +272,8 @@ set(LWS_LOGGING_BITFIELD_CLEAR 0 CACHE STRING "Bitfield describing which log lev
246272option (LWS_LOGS_TIMESTAMP "Timestamp at start of logs" ON )
247273option (LWS_LOG_TAG_LIFECYCLE "Log tagged object lifecycle as NOTICE" ON )
248274option (LWS_AVOID_SIGPIPE_IGN "Android 7+ reportedly needs this" OFF )
249- option (LWS_WITH_JOSE "JSON Web Signature / Encryption / Keys (RFC7515/6/) API" OFF )
275+ option (LWS_WITH_JOSE "JOSE JSON Web Signature / Encryption / Keys (RFC7515/6/) API" OFF )
276+ option (LWS_WITH_COSE "COSE CBOR Signature / Encryption / Keys (RFC8152) API" OFF )
250277option (LWS_WITH_GENCRYPTO "Enable support for Generic Crypto apis independent of TLS backend" OFF )
251278option (LWS_WITH_SELFTESTS "Selftests run at context creation" OFF )
252279option (LWS_WITH_GCOV "Build with gcc gcov coverage instrumentation" OFF )
@@ -255,13 +282,12 @@ option(LWS_REPRODUCIBLE "Build libwebsockets reproducible. It removes the build
255282option (LWS_WITH_MINIMAL_EXAMPLES "Also build the normally standalone minimal examples, for QA" OFF )
256283option (LWS_WITH_LWSAC "lwsac Chunk Allocation api" ON )
257284option (LWS_WITH_CUSTOM_HEADERS "Store and allow querying custom HTTP headers (H1 only)" ON )
258- option (LWS_WITH_DISKCACHE "Hashed cache directory with lazy LRU deletion to size limit" OFF )
285+ option (LWS_WITH_DISKCACHE "Hashed cache directory with lazy LRU deletion to size limit (unrelated to lws_cache_ttl) " OFF )
259286option (LWS_WITH_ASAN "Build with gcc runtime sanitizer options enabled (needs libasan)" OFF )
260287option (LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF )
261288option (LWS_WITH_ZLIB "Include zlib support (required for extensions)" OFF )
262289option (LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT} )
263290option (LWS_WITH_MINIZ "Use miniz instead of zlib" OFF )
264- option (LWS_WITH_DEPRECATED_THINGS "Temporary workaround for deprecated apis" OFF )
265291option (LWS_WITH_SEQUENCER "lws_seq_t support" OFF )
266292option (LWS_WITH_EXTERNAL_POLL "Support external POLL integration using callback messages (not recommended)" OFF )
267293option (LWS_WITH_LWS_DSH "Support lws_dsh_t Disordered Shared Heap" OFF )
@@ -275,6 +301,12 @@ option(LWS_HTTP_HEADERS_ALL "Override header reduction optimization and include
275301option (LWS_WITH_SUL_DEBUGGING "Enable zombie lws_sul checking on object deletion" OFF )
276302option (LWS_WITH_PLUGINS_API "Build generic lws_plugins apis (see LWS_WITH_PLUGINS to also build protocol plugins)" OFF )
277303option (LWS_WITH_CONMON "Collect introspectable connection latency stats on individual client connections" ON )
304+ option (LWS_WITHOUT_EVENTFD "Force using pipe instead of eventfd" OFF )
305+ if (UNIX OR WIN32 )
306+ option (LWS_WITH_CACHE_NSCOOKIEJAR "Build file-backed lws-cache-ttl that uses netscape cookie jar format (linux-only)" ON )
307+ else ()
308+ option (LWS_WITH_CACHE_NSCOOKIEJAR "Build file-backed lws-cache-ttl that uses netscape cookie jar format (linux-only)" OFF )
309+ endif ()
278310
279311if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
280312 option (LWS_WITH_NETLINK "Monitor Netlink for Routing Table changes" ON )
@@ -369,12 +401,16 @@ if(GIT_EXECUTABLE)
369401 message ("Git commit hash: ${LWS_BUILD_HASH} " )
370402endif ()
371403
404+ if ("${LWS_BUILD_HASH} " STREQUAL "" )
405+ set (LWS_BUILD_HASH "unknown" )
406+ endif ()
407+
372408set (PACKAGE "libwebsockets" )
373409set (CPACK_RPM_PACKAGE_LICENSE "MIT" )
374410set (CPACK_PACKAGE_NAME "${PACKAGE} " )
375411set (CPACK_PACKAGE_VERSION_MAJOR "4" )
376- set (CPACK_PACKAGE_VERSION_MINOR "2 " )
377- set (CPACK_PACKAGE_VERSION_PATCH_NUMBER "0 " )
412+ set (CPACK_PACKAGE_VERSION_MINOR "3 " )
413+ set (CPACK_PACKAGE_VERSION_PATCH_NUMBER "2 " )
378414
379415set (CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH_NUMBER} -${LWS_BUILD_HASH} " )
380416set (CPACK_PACKAGE_RELEASE 1)
@@ -383,7 +419,7 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
383419set (CPACK_PACKAGE_VENDOR
"[email protected] " )
384420set (CPACK_PACKAGE_CONTACT
"[email protected] " )
385421set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE} ${CPACK_PACKAGE_VERSION} " )
386- set (SOVERSION "18 " )
422+ set (SOVERSION "19 " )
387423if (NOT CPACK_GENERATOR)
388424 if (UNIX )
389425 set (CPACK_GENERATOR "TGZ" )
@@ -553,7 +589,14 @@ CHECK_FUNCTION_EXISTS(getgrgid_r LWS_HAVE_GETGRGID_R)
553589CHECK_FUNCTION_EXISTS(getgrnam_r LWS_HAVE_GETGRNAM_R)
554590CHECK_FUNCTION_EXISTS(getpwuid_r LWS_HAVE_GETPWUID_R)
555591CHECK_FUNCTION_EXISTS(getpwnam_r LWS_HAVE_GETPWNAM_R)
592+ CHECK_FUNCTION_EXISTS(timegm LWS_HAVE_TIMEGM)
556593
594+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin" )
595+ if (CMAKE_OSX_DEPLOYMENT_TARGET LESS "10.12" )
596+ message ("No clock_gettime found on macOS ${CMAKE_OSX_DEPLOYMENT_TARGET} . Disabling LWS_HAVE_CLOCK_GETTIME." )
597+ set (LWS_HAVE_CLOCK_GETTIME 0)
598+ endif ()
599+ endif ()
557600
558601if (NOT LWS_HAVE_GETIFADDRS)
559602 if (LWS_WITHOUT_BUILTIN_GETIFADDRS)
@@ -754,11 +797,19 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
754797
755798 # always warn all and generate debug info
756799 if (UNIX AND NOT LWS_PLAT_FREERTOS)
757- set (CMAKE_C_FLAGS "-Wall -Wconversion -Wsign-compare -Wstrict-aliasing ${VISIBILITY_FLAG} -Wundef ${GCOV_FLAGS} ${CMAKE_C_FLAGS} ${ASAN_FLAGS} " )
800+ set (CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter - Wconversion -Wsign-compare -Wstrict-aliasing ${VISIBILITY_FLAG} -Wundef ${GCOV_FLAGS} ${CMAKE_C_FLAGS} ${ASAN_FLAGS} " )
758801 else ()
759802 set (CMAKE_C_FLAGS "-Wall -Wsign-compare ${VISIBILITY_FLAG} ${GCOV_FLAGS} ${CMAKE_C_FLAGS} " )
760803 endif ()
761804
805+ if (PICO_SDK_PATH)
806+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wconversion -Wsign-compare -Wstrict-aliasing -Wundef -nolibc" )
807+ endif ()
808+
809+ if (ESP_PLATFORM AND (CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3))
810+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlongcalls" )
811+ endif ()
812+
762813 if ("${DISABLE_WERROR} " STREQUAL "OFF" )
763814 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror" )
764815 endif ()
@@ -800,6 +851,12 @@ if (MSVC)
800851 add_definitions (-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
801852 # Fail the build if any warnings
802853 add_compile_options (/W3 /WX)
854+ # Unbreak MSVC broken preprocessor __VA_ARGS__ behaviour
855+ if (MSVC_VERSION GREATER 1925)
856+ add_compile_options (/Zc:preprocessor /wd5105)
857+ else ()
858+ add_compile_options (/experimental:preprocessor /wd5105)
859+ endif ()
803860endif (MSVC )
804861
805862if (MINGW)
@@ -829,7 +886,7 @@ if (LWS_WITH_ZLIB)
829886 if (NOT ZLIB_FOUND)
830887 if (LWS_WITH_MINIZ)
831888 find_package (Miniz REQUIRED)
832- set (ZLIB_INCLUDE_DIRS ${MINIZ_INCLUDE_DIRS } )
889+ set (ZLIB_INCLUDE_DIRS ${MINIZ_INCLUDE_DIR } )
833890 set (ZLIB_LIBRARIES ${MINIZ_LIBRARIES} )
834891 else ()
835892 find_package (ZLIB REQUIRED)
@@ -1017,6 +1074,9 @@ file(RELATIVE_PATH
10171074if (DEFINED REL_INCLUDE_DIR)
10181075 set (LWS__INCLUDE_DIRS "\$ {LWS_CMAKE_DIR}/${REL_INCLUDE_DIR} " )
10191076endif ()
1077+ if (DEFINED OPENSSL_INCLUDE_DIRS)
1078+ set (LWS__INCLUDE_DIRS "${LWS__INCLUDE_DIRS} ;${OPENSSL_INCLUDE_DIRS} " )
1079+ endif ()
10201080
10211081configure_file (${PROJECT_SOURCE_DIR} /cmake/libwebsockets-config.cmake.in
10221082 ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY} /libwebsockets-config.cmake
0 commit comments