diff --git a/CMakeLists.txt b/CMakeLists.txt index a9497b0d..f6443703 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,96 @@ cmake_minimum_required(VERSION 2.8.9) # For selecting between DEBUG / RELEASE, use -DCMAKE_BUILD_TYPE=DEBUG or =RELEASE # debug builds include source level debug info and extra logging +set(LWS_WITH_BUNDLED_ZLIB_DEFAULT OFF) +if(WIN32) + set(LWS_WITH_BUNDLED_ZLIB_DEFAULT ON) +endif() + +# +# Major individual features +# +option(LWS_WITH_HTTP2 "Compile with server support for HTTP/2" OFF) +option(LWS_WITH_LWSWS "Libwebsockets Webserver" OFF) +option(LWS_WITH_CGI "Include CGI (spawn process with network-connected stdin/out/err) APIs" OFF) +option(LWS_IPV6 "Compile with support for ipv6" OFF) +option(LWS_UNIX_SOCK "Compile with support for UNIX domain socket" OFF) +option(LWS_WITH_PLUGINS "Support plugins for protocols and extensions" OFF) +option(LWS_WITH_HTTP_PROXY "Support for rewriting HTTP proxying (requires libhubbub)" OFF) +option(LWS_WITH_ZIP_FOPS "Support serving pre-zipped files" ON) +option(LWS_WITH_SOCKS5 "Allow use of SOCKS5 proxy on client connections" OFF) +option(LWS_WITH_GENERIC_SESSIONS "With the Generic Sessions plugin" OFF) +option(LWS_WITH_PEER_LIMITS "Track peers and restrict resources a single peer can allocate" OFF) +option(LWS_WITH_ACCESS_LOG "Support generating Apache-compatible access logs" OFF) +option(LWS_WITH_RANGES "Support http ranges (RFC7233)" ON) +option(LWS_WITH_SERVER_STATUS "Support json + jscript server monitoring" OFF) +# +# TLS library options... all except mbedTLS are basically OpenSSL variants. +# +option(LWS_WITH_SSL "Include SSL support (defaults to OpenSSL or similar, mbedTLS if LWS_WITH_MBEDTLS is set)" ON) +option(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) +option(LWS_WITH_BORINGSSL "Use BoringSSL replacement for OpenSSL" OFF) +option(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) +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) +option(LWS_SSL_CLIENT_USE_OS_CA_CERTS "SSL support should make use of the OS-installed CA root certs" ON) +# +# Event library options (may select multiple, or none for default poll() +# +option(LWS_WITH_LIBEV "Compile with support for libev" OFF) +option(LWS_WITH_LIBUV "Compile with support for libuv" OFF) +option(LWS_WITH_LIBEVENT "Compile with support for libevent" OFF) +# +# Static / Dynamic build options +# +option(LWS_WITH_STATIC "Build the static version of the library" ON) +option(LWS_WITH_SHARED "Build the shared version of the library" ON) +option(LWS_LINK_TESTAPPS_DYNAMIC "Link the test apps to the shared version of the library. Default is to link statically" OFF) +option(LWS_STATIC_PIC "Build the static version of the library with position-independent code" OFF) +# +# Specific platforms +# +option(LWS_WITH_ESP8266 "Build for ESP8266" OFF) +option(LWS_WITH_ESP32 "Build for ESP32" OFF) +option(LWS_PLAT_OPTEE "Build for OPTEE" OFF) +# +# Client / Server / Test Apps build control +# +option(LWS_WITHOUT_CLIENT "Don't build the client part of the library" OFF) +option(LWS_WITHOUT_SERVER "Don't build the server part of the library" OFF) +option(LWS_WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" OFF) +option(LWS_WITHOUT_TEST_SERVER "Don't build the test server" OFF) +option(LWS_WITHOUT_TEST_SERVER_EXTPOLL "Don't build the test server version that uses external poll" OFF) +option(LWS_WITHOUT_TEST_PING "Don't build the ping test application" OFF) +option(LWS_WITHOUT_TEST_ECHO "Don't build the echo test application" OFF) +option(LWS_WITHOUT_TEST_CLIENT "Don't build the client test application" OFF) +option(LWS_WITHOUT_TEST_FRAGGLE "Don't build the ping test application" OFF) +# +# Extensions (permessage-deflate) +# +option(LWS_WITHOUT_EXTENSIONS "Don't compile with extensions" OFF) +option(LWS_WITH_ZLIB "Include zlib support (required for extensions)" ON) +option(LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT}) +# +# Helpers + misc +# +option(LWS_WITHOUT_BUILTIN_GETIFADDRS "Don't use the BSD getifaddrs implementation from libwebsockets if it is missing (this will result in a compilation error) ... The default is to assume that your libc provides it. On some systems such as uclibc it doesn't exist." OFF) +option(LWS_FALLBACK_GETHOSTBYNAME "Also try to do dns resolution using gethostbyname if getaddrinfo fails" OFF) +option(LWS_WITHOUT_BUILTIN_SHA1 "Don't build the lws sha-1 (eg, because openssl will provide it" OFF) +option(LWS_WITH_LATENCY "Build latency measuring code into the library" OFF) +option(LWS_WITHOUT_DAEMONIZE "Don't build the daemonization api" ON) +option(LWS_SSL_SERVER_WITH_ECDH_CERT "Include SSL server use ECDH certificate" OFF) +option(LWS_WITH_LEJP "With the Lightweight JSON Parser" OFF) +option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF) +option(LWS_WITH_SQLITE3 "Require SQLITE3 support" OFF) +option(LWS_WITH_SMTP "Provide SMTP support" OFF) +option(LWS_WITH_NO_LOGS "Disable all logging from being compiled in" OFF) +option(LWS_AVOID_SIGPIPE_IGN "Android 7+ reportedly needs this" OFF) +option(LWS_WITH_STATS "Keep statistics of lws internal operations" OFF) +option(LWS_WITH_JWS "JSON Web Signature (RFC7515) API" OFF) +option(LWS_WITH_SELFTESTS "Selftests run at context creation" OFF) +# +# End of user settings +# + if(NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type") endif() @@ -66,69 +156,6 @@ if(GIT_EXECUTABLE) message("Git commit hash: ${LWS_BUILD_HASH}") endif() -set(LWS_WITH_BUNDLED_ZLIB_DEFAULT OFF) -if(WIN32) - set(LWS_WITH_BUNDLED_ZLIB_DEFAULT ON) -endif() - -option(LWS_WITH_STATIC "Build the static version of the library" ON) -option(LWS_WITH_SHARED "Build the shared version of the library" ON) -option(LWS_WITH_SSL "Include SSL support (default OpenSSL, wolfSSL if LWS_WITH_WOLFSSL is set)" ON) -option(LWS_WITH_BORINGSSL "Use BoringSSL replacement for OpenSSL" OFF) -option(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) -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) -option(LWS_WITH_MBEDTLS "Use mbedTLS (>=2.0) replacement for OpenSSL. When setting this, you also need to specify LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS" OFF) -option(LWS_WITH_ZLIB "Include zlib support (required for extensions)" ON) -option(LWS_WITH_LIBEV "Compile with support for libev" OFF) -option(LWS_WITH_LIBUV "Compile with support for libuv" OFF) -option(LWS_WITH_LIBEVENT "Compile with support for libevent" OFF) -option(LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT}) -option(LWS_SSL_CLIENT_USE_OS_CA_CERTS "SSL support should make use of the OS-installed CA root certs" ON) -option(LWS_WITHOUT_BUILTIN_GETIFADDRS "Don't use the BSD getifaddrs implementation from libwebsockets if it is missing (this will result in a compilation error) ... The default is to assume that your libc provides it. On some systems such as uclibc it doesn't exist." OFF) -option(LWS_WITHOUT_BUILTIN_SHA1 "Don't build the lws sha-1 (eg, because openssl will provide it" OFF) -option(LWS_WITHOUT_CLIENT "Don't build the client part of the library" OFF) -option(LWS_WITHOUT_SERVER "Don't build the server part of the library" OFF) -option(LWS_LINK_TESTAPPS_DYNAMIC "Link the test apps to the shared version of the library. Default is to link statically" OFF) -option(LWS_WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" OFF) -option(LWS_WITHOUT_TEST_SERVER "Don't build the test server" OFF) -option(LWS_WITHOUT_TEST_SERVER_EXTPOLL "Don't build the test server version that uses external poll" OFF) -option(LWS_WITHOUT_TEST_PING "Don't build the ping test application" OFF) -option(LWS_WITHOUT_TEST_ECHO "Don't build the echo test application" OFF) -option(LWS_WITHOUT_TEST_CLIENT "Don't build the client test application" OFF) -option(LWS_WITHOUT_TEST_FRAGGLE "Don't build the ping test application" OFF) -option(LWS_WITHOUT_EXTENSIONS "Don't compile with extensions" OFF) -option(LWS_WITH_LATENCY "Build latency measuring code into the library" OFF) -option(LWS_WITHOUT_DAEMONIZE "Don't build the daemonization api" ON) -option(LWS_IPV6 "Compile with support for ipv6" OFF) -option(LWS_UNIX_SOCK "Compile with support for UNIX domain socket" OFF) -option(LWS_WITH_HTTP2 "Compile with server support for HTTP/2" OFF) -option(LWS_SSL_SERVER_WITH_ECDH_CERT "Include SSL server use ECDH certificate" OFF) -option(LWS_WITH_CGI "Include CGI (spawn process with network-connected stdin/out/err) APIs" OFF) -option(LWS_WITH_HTTP_PROXY "Support for rewriting HTTP proxying (requires libhubbub)" OFF) -option(LWS_WITH_LWSWS "Libwebsockets Webserver" OFF) -option(LWS_WITH_PLUGINS "Support plugins for protocols and extensions" OFF) -option(LWS_WITH_ACCESS_LOG "Support generating Apache-compatible access logs" OFF) -option(LWS_WITH_SERVER_STATUS "Support json + jscript server monitoring" OFF) -option(LWS_WITH_LEJP "With the Lightweight JSON Parser" OFF) -option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF) -option(LWS_WITH_GENERIC_SESSIONS "With the Generic Sessions plugin" OFF) -option(LWS_WITH_SQLITE3 "Require SQLITE3 support" OFF) -option(LWS_WITH_SMTP "Provide SMTP support" OFF) -option(LWS_WITH_ESP8266 "Build for ESP8266" OFF) -option(LWS_WITH_ESP32 "Build for ESP32" OFF) -option(LWS_PLAT_OPTEE "Build for OPTEE" OFF) -option(LWS_WITH_NO_LOGS "Disable all logging from being compiled in" OFF) -option(LWS_STATIC_PIC "Build the static version of the library with position-independent code" OFF) -option(LWS_WITH_RANGES "Support http ranges (RFC7233)" ON) -option(LWS_FALLBACK_GETHOSTBYNAME "Also try to do dns resolution using gethostbyname if getaddrinfo fails" OFF) -option(LWS_WITH_ZIP_FOPS "Support serving pre-zipped files" ON) -option(LWS_AVOID_SIGPIPE_IGN "Android 7+ seems to need this" OFF) -option(LWS_WITH_STATS "Keep statistics of lws internal operations" OFF) -option(LWS_WITH_SOCKS5 "Allow use of SOCKS5 proxy on client connections" OFF) -option(LWS_WITH_PEER_LIMITS "Track peers and restrict resources a single peer can allocate" OFF) -option(LWS_WITH_JWS "JSON Web Signature (RFC7515) API" OFF) -option(LWS_WITH_SELFTESTS "Selftests run at context creation" OFF) - macro(confirm_command CMD NOCMD) find_program (HAVE_CMD_${CMD} ${CMD} ) if (NOT HAVE_CMD_${CMD})