1# 2# Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> 3# 4# This software is supplied under the terms of the MIT License, a 5# copy of which should be located in the distribution where this 6# file was obtained (LICENSE.txt). A copy of the license may also be 7# found online at https://opensource.org/licenses/MIT. 8# 9 10# NNG Options. These are user configurable knobs. 11 12include(CMakeDependentOption) 13 14if (CMAKE_CROSSCOMPILING) 15 set(NNG_NATIVE_BUILD OFF) 16else () 17 set(NNG_NATIVE_BUILD ON) 18endif () 19 20# Global options. 21option(BUILD_SHARED_LIBS "Build shared library" ${BUILD_SHARED_LIBS}) 22 23# We only build command line tools and tests if we are not in a 24# cross-compile situation. Cross-compiling users who still want to 25# build these must enable them explicitly. Some of these switches 26# must be enabled rather early as we use their values later. 27option(NNG_TESTS "Build and run tests." ${NNG_NATIVE_BUILD}) 28option(NNG_TOOLS "Build extra tools." ${NNG_NATIVE_BUILD}) 29option(NNG_ENABLE_NNGCAT "Enable building nngcat utility." ${NNG_TOOLS}) 30option(NNG_ENABLE_COVERAGE "Enable coverage reporting." OFF) 31# Eliding deprecated functionality can be used to build a slimmed down 32# version of the library, or alternatively to test for application 33# preparedness for expected feature removals (in the next major release.) 34# Applications can also set the NNG_ELIDE_DEPRECATED preprocessor symbol 35# before including <nng/nng.h> -- this will prevent declarations from 36# being exposed to applications, but it will not affect their ABI 37# availability for existing compiled applications. 38# Note: Currently this breaks the test suite, so we only do it 39# for the public library. 40option(NNG_ELIDE_DEPRECATED "Elide deprecated functionality." OFF) 41 42option(NNG_ENABLE_STATS "Enable statistics." ON) 43mark_as_advanced(NNG_ENABLE_STATS) 44 45# Protocols. 46option (NNG_PROTO_BUS0 "Enable BUSv0 protocol." ON) 47mark_as_advanced(NNG_PROTO_BUS0) 48 49option (NNG_PROTO_PAIR0 "Enable PAIRv0 protocol." ON) 50mark_as_advanced(NNG_PROTO_PAIR0) 51 52option (NNG_PROTO_PAIR1 "Enable PAIRv1 protocol." ON) 53mark_as_advanced(NNG_PROTO_PAIR1) 54 55option (NNG_PROTO_PUSH0 "Enable PUSHv0 protocol." ON) 56mark_as_advanced(NNG_PROTO_PUSH0) 57 58option (NNG_PROTO_PULL0 "Enable PULLv0 protocol." ON) 59mark_as_advanced(NNG_PROTO_PULL0) 60 61option (NNG_PROTO_PUB0 "Enable PUBv0 protocol." ON) 62mark_as_advanced(NNG_PROTO_PUB0) 63 64option (NNG_PROTO_SUB0 "Enable SUBv0 protocol." ON) 65mark_as_advanced(NNG_PROTO_SUB0) 66 67option(NNG_PROTO_REQ0 "Enable REQv0 protocol." ON) 68mark_as_advanced(NNG_PROTO_REQ0) 69 70option(NNG_PROTO_REP0 "Enable REPv0 protocol." ON) 71mark_as_advanced(NNG_PROTO_REP0) 72 73option (NNG_PROTO_RESPONDENT0 "Enable RESPONDENTv0 protocol." ON) 74mark_as_advanced(NNG_PROTO_RESPONDENT0) 75 76option (NNG_PROTO_SURVEYOR0 "Enable SURVEYORv0 protocol." ON) 77mark_as_advanced(NNG_PROTO_SURVEYOR0) 78 79# TLS support. 80 81# Enabling TLS is required to enable support for the TLS transport 82# and WSS. It does require a 3rd party TLS engine to be selected. 83option(NNG_ENABLE_TLS "Enable TLS support." OFF) 84if (NNG_ENABLE_TLS) 85 set(NNG_SUPP_TLS ON) 86endif () 87 88if (NNG_ENABLE_TLS) 89 set(NNG_TLS_ENGINES mbed wolf none) 90 # We assume Mbed for now. (Someday replaced perhaps with Bear.) 91 set(NNG_TLS_ENGINE mbed CACHE STRING "TLS engine to use.") 92 set_property(CACHE NNG_TLS_ENGINE PROPERTY STRINGS ${NNG_TLS_ENGINES}) 93else () 94 set(NNG_TLS_ENGINE none) 95endif () 96 97# HTTP API support. 98option (NNG_ENABLE_HTTP "Enable HTTP API." ON) 99if (NNG_ENABLE_HTTP) 100 set(NNG_SUPP_HTTP ON) 101endif() 102mark_as_advanced(NNG_ENABLE_HTTP) 103 104# 105# Transport Options. 106# 107 108option (NNG_TRANSPORT_INPROC "Enable inproc transport." ON) 109mark_as_advanced(NNG_TRANSPORT_INPROC) 110 111option (NNG_TRANSPORT_IPC "Enable IPC transport." ON) 112mark_as_advanced(NNG_TRANSPORT_IPC) 113 114# TCP transport 115option (NNG_TRANSPORT_TCP "Enable TCP transport." ON) 116mark_as_advanced(NNG_TRANSPORT_TCP) 117 118# TLS transport 119option (NNG_TRANSPORT_TLS "Enable TLS transport." ON) 120mark_as_advanced(NNG_TRANSPORT_TLS) 121 122# WebSocket 123option (NNG_TRANSPORT_WS "Enable WebSocket transport." ON) 124mark_as_advanced(NNG_TRANSPORT_WS) 125 126CMAKE_DEPENDENT_OPTION(NNG_TRANSPORT_WSS "Enable WSS transport." ON 127 "NNG_ENABLE_TLS" OFF) 128mark_as_advanced(NNG_TRANSPORT_WSS) 129 130# ZeroTier 131option (NNG_TRANSPORT_ZEROTIER "Enable ZeroTier transport (requires libzerotiercore)." OFF) 132mark_as_advanced(NNG_TRANSPORT_ZEROTIER) 133 134if (NNG_TRANSPORT_WS OR NNG_TRANSPORT_WSS) 135 # Make sure things we *MUST* have are enabled. 136 set(NNG_SUPP_WEBSOCKET ON) 137 set(NNG_SUPP_HTTP ON) 138 set(NNG_SUPP_BASE64 ON) 139 set(NNG_SUPP_SHA1 ON) 140endif() 141