diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-12-28 20:52:15 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-12-28 20:52:15 -0800 |
| commit | 63e0baf37c8024174aa4bacb12dccc7040de74d8 (patch) | |
| tree | dadbaa4a7f7d026af16674e85b67d6aff3613746 | |
| parent | cbc21ab0a2e11c8be23dfa146adf7bb091c97f71 (diff) | |
| download | nng-63e0baf37c8024174aa4bacb12dccc7040de74d8.tar.gz nng-63e0baf37c8024174aa4bacb12dccc7040de74d8.tar.bz2 nng-63e0baf37c8024174aa4bacb12dccc7040de74d8.zip | |
fixes #172 HTTP and websocket need better conditional inclusion
| -rw-r--r-- | CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/supplemental/base64/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/supplemental/http/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/supplemental/sha1/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/supplemental/websocket/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/transport/ws/websocket.c | 1 | ||||
| -rw-r--r-- | tests/CMakeLists.txt | 15 |
7 files changed, 37 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e1ef153..df8a58f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # Copyright (c) 2013 GoPivotal, Inc. All rights reserved. # Copyright (c) 2015-2016 Jack R. Dunaway. All rights reserved. # Copyright 2016 Franklin "Snaipe" Mathieu <franklinmathieu@gmail.com> -# Copyright 2017 Garrett D'Amore <garrett@damore.org> +# Copyright 2017 Staysail Systems, Inc. <info@staysail.tech> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), @@ -171,6 +171,7 @@ endif () option (NNG_TRANSPORT_WS "Enable WebSocket transport." ON) if (NNG_TRANSPORT_WS) add_definitions (-DNNG_HAVE_WEBSOCKET) + set(NNG_SUPP_WEBSOCKET ON) endif () option (NNG_TRANSPORT_ZEROTIER "Enable ZeroTier transport (requires libzerotiercore)." OFF) @@ -185,6 +186,13 @@ if (NNG_TRANSPORT_TLS) add_definitions (-DNNG_HAVE_TLS) endif() +# dependencies +if (NNG_SUPP_WEBSOCKET) + set(NNG_SUPP_HTTP ON) + set(NNG_SUPP_BASE64 ON) + set(NNG_SUPP_SHA1 ON) +endif() + # Platform checks. if (NNG_ENABLE_COVERAGE) diff --git a/src/supplemental/base64/CMakeLists.txt b/src/supplemental/base64/CMakeLists.txt index 3ccac7ff..297a5478 100644 --- a/src/supplemental/base64/CMakeLists.txt +++ b/src/supplemental/base64/CMakeLists.txt @@ -8,5 +8,9 @@ # found online at https://opensource.org/licenses/MIT. # -set(BASE64_SOURCES supplemental/base64/base64.c supplemental/base64/base64.h) +if (NNG_SUPP_BASE64) + set(BASE64_SOURCES + supplemental/base64/base64.c + supplemental/base64/base64.h) +endif() set(NNG_SOURCES ${NNG_SOURCES} ${BASE64_SOURCES} PARENT_SCOPE) diff --git a/src/supplemental/http/CMakeLists.txt b/src/supplemental/http/CMakeLists.txt index dff06d70..2c8d6a68 100644 --- a/src/supplemental/http/CMakeLists.txt +++ b/src/supplemental/http/CMakeLists.txt @@ -8,10 +8,12 @@ # found online at https://opensource.org/licenses/MIT. # +if (NNG_SUPP_HTTP) set(HTTP_SOURCES supplemental/http/http.c supplemental/http/http_msg.c supplemental/http/server.c supplemental/http/client.c supplemental/http/http.h) +endif() set(NNG_SOURCES ${NNG_SOURCES} ${HTTP_SOURCES} PARENT_SCOPE) diff --git a/src/supplemental/sha1/CMakeLists.txt b/src/supplemental/sha1/CMakeLists.txt index 8496777b..9600a268 100644 --- a/src/supplemental/sha1/CMakeLists.txt +++ b/src/supplemental/sha1/CMakeLists.txt @@ -8,5 +8,9 @@ # found online at https://opensource.org/licenses/MIT. # -set(SHA1_SOURCES supplemental/sha1/sha1.c supplemental/sha1/sha1.h) +if (NNG_SUPP_SHA1) + set(SHA1_SOURCES + supplemental/sha1/sha1.c + supplemental/sha1/sha1.h) +endif() set(NNG_SOURCES ${NNG_SOURCES} ${SHA1_SOURCES} PARENT_SCOPE) diff --git a/src/supplemental/websocket/CMakeLists.txt b/src/supplemental/websocket/CMakeLists.txt index f3283257..5ddd6cb1 100644 --- a/src/supplemental/websocket/CMakeLists.txt +++ b/src/supplemental/websocket/CMakeLists.txt @@ -8,7 +8,9 @@ # found online at https://opensource.org/licenses/MIT. # -set(WEBSOCKET_SOURCES - supplemental/websocket/websocket.c - supplemental/websocket/websocket.h) +if (NNG_SUPP_WEBSOCKET) + set(WEBSOCKET_SOURCES + supplemental/websocket/websocket.c + supplemental/websocket/websocket.h) +endif() set(NNG_SOURCES ${NNG_SOURCES} ${WEBSOCKET_SOURCES} PARENT_SCOPE) diff --git a/src/transport/ws/websocket.c b/src/transport/ws/websocket.c index c6ce9b25..4f948fb7 100644 --- a/src/transport/ws/websocket.c +++ b/src/transport/ws/websocket.c @@ -532,7 +532,6 @@ static nni_tran_pipe_option ws_pipe_options[] = { { NNG_OPT_REMADDR, ws_pipe_getopt_remaddr }, { NNG_OPT_WS_REQUEST_HEADERS, ws_pipe_getopt_reqhdrs }, { NNG_OPT_WS_RESPONSE_HEADERS, ws_pipe_getopt_reshdrs }, - // clang-format on // terminate list diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 921b5925..7f37c589 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -122,7 +122,6 @@ else () endif () add_nng_test(aio 5) -add_nng_test(base64 5) add_nng_test(bus 5) add_nng_test(files 5) add_nng_test(idhash 5) @@ -136,7 +135,6 @@ add_nng_test(pollfd 5) add_nng_test(pubsub 5) add_nng_test(reconnect 5) add_nng_test(resolv 10) -add_nng_test(sha1 5) add_nng_test(sock 5) add_nng_test(survey 5) add_nng_test(synch 5) @@ -152,10 +150,19 @@ add_nng_test(pair1 5) add_nng_test(udp 5) add_nng_test(zt 60) add_nng_test(multistress 60) -add_nng_test(httpclient 30) -add_nng_test(httpserver 30) add_nng_test(ws 30) +if (NNG_SUPP_BASE64) + add_nng_test(base64 5) +endif() +if (NNG_SUPP_HTTP) + add_nng_test(httpclient 30) + add_nng_test(httpserver 30) +endif() +if (NNG_SUPP_SHA1) + add_nng_test(sha1 5) +endif() + # compatbility tests # We only support these if ALL the legacy protocols are supported. This # is because we don't want to make modifications to partially enable some |
