diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:30:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:30:55 +0000 |
commit | 17e81f2cd1843f01838245eae7b5ed5edf83d6be (patch) | |
tree | a0f685dff11ce5a2dc546a7b46a48bae5d1c0140 /examples/CMakeLists.txt | |
parent | Initial commit. (diff) | |
download | ngtcp2-upstream/0.12.1+dfsg.tar.xz ngtcp2-upstream/0.12.1+dfsg.zip |
Adding upstream version 0.12.1+dfsg.upstream/0.12.1+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/CMakeLists.txt')
-rw-r--r-- | examples/CMakeLists.txt | 359 |
1 files changed, 359 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..09701b8 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,359 @@ +# ngtcp2 + +# Copyright (c) 2017 ngtcp2 contributors + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: + +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +if(LIBEV_FOUND AND HAVE_OPENSSL AND LIBNGHTTP3_FOUND) + set(client_SOURCES + client.cc + client_base.cc + debug.cc + util.cc + shared.cc + tls_client_context_openssl.cc + tls_client_session_openssl.cc + tls_session_base_openssl.cc + util_openssl.cc + ) + + set(server_SOURCES + server.cc + server_base.cc + debug.cc + util.cc + http.cc + shared.cc + tls_server_context_openssl.cc + tls_server_session_openssl.cc + tls_session_base_openssl.cc + util_openssl.cc + ) + + set(ossl_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/lib/includes + ${CMAKE_BINARY_DIR}/lib/includes + ${CMAKE_SOURCE_DIR}/third-party + ${CMAKE_SOURCE_DIR}/crypto/includes + + ${JEMALLOC_INCLUDE_DIRS} + ${OPENSSL_INCLUDE_DIRS} + ${LIBEV_INCLUDE_DIRS} + ${LIBNGHTTP3_INCLUDE_DIRS} + ) + + set(ossl_LIBS + ngtcp2_crypto_openssl + ngtcp2 + ${JEMALLOC_LIBRARIES} + ${OPENSSL_LIBRARIES} + ${LIBEV_LIBRARIES} + ${LIBNGHTTP3_LIBRARIES} + ) + + add_executable(client ${client_SOURCES} $<TARGET_OBJECTS:http-parser>) + add_executable(server ${server_SOURCES} $<TARGET_OBJECTS:http-parser>) + set_target_properties(client PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_OPENSSL -DWITH_EXAMPLE_OPENSSL" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + set_target_properties(server PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_OPENSSL -DWITH_EXAMPLE_OPENSSL" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + target_include_directories(client PUBLIC ${ossl_INCLUDE_DIRS}) + target_include_directories(server PUBLIC ${ossl_INCLUDE_DIRS}) + target_link_libraries(client ${ossl_LIBS}) + target_link_libraries(server ${ossl_LIBS}) + + # TODO prevent client and example servers from being installed? +endif() + +if(LIBEV_FOUND AND HAVE_GNUTLS AND LIBNGHTTP3_FOUND) + set(gtlsclient_SOURCES + client.cc + client_base.cc + debug.cc + util.cc + shared.cc + tls_client_context_gnutls.cc + tls_client_session_gnutls.cc + tls_session_base_gnutls.cc + util_gnutls.cc + ) + + set(gtlsserver_SOURCES + server.cc + server_base.cc + debug.cc + util.cc + http.cc + shared.cc + tls_server_context_gnutls.cc + tls_server_session_gnutls.cc + tls_session_base_gnutls.cc + util_gnutls.cc + ) + + set(gtls_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/lib/includes + ${CMAKE_BINARY_DIR}/lib/includes + ${CMAKE_SOURCE_DIR}/third-party + ${CMAKE_SOURCE_DIR}/crypto/includes + + ${JEMALLOC_INCLUDE_DIRS} + ${GNUTLS_INCLUDE_DIRS} + ${LIBEV_INCLUDE_DIRS} + ${LIBNGHTTP3_INCLUDE_DIRS} + ) + + set(gtls_LIBS + ngtcp2_crypto_gnutls + ngtcp2 + ${JEMALLOC_LIBRARIES} + ${GNUTLS_LIBRARIES} + ${LIBEV_LIBRARIES} + ${LIBNGHTTP3_LIBRARIES} + ) + + add_executable(gtlsclient ${gtlsclient_SOURCES} $<TARGET_OBJECTS:http-parser>) + add_executable(gtlsserver ${gtlsserver_SOURCES} $<TARGET_OBJECTS:http-parser>) + set_target_properties(gtlsclient PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_GNUTLS -DWITH_EXAMPLE_GNUTLS" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + set_target_properties(gtlsserver PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_GNUTLS -DWITH_EXAMPLE_GNUTLS" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + target_include_directories(gtlsclient PUBLIC ${gtls_INCLUDE_DIRS}) + target_include_directories(gtlsserver PUBLIC ${gtls_INCLUDE_DIRS}) + target_link_libraries(gtlsclient ${gtls_LIBS}) + target_link_libraries(gtlsserver ${gtls_LIBS}) + + # TODO prevent gtlsclient and example gtlsservers from being installed? +endif() + +if(LIBEV_FOUND AND HAVE_BORINGSSL AND LIBNGHTTP3_FOUND) + set(bsslclient_SOURCES + client.cc + client_base.cc + debug.cc + util.cc + shared.cc + tls_client_context_boringssl.cc + tls_client_session_boringssl.cc + tls_session_base_openssl.cc + util_openssl.cc + ) + + set(bsslserver_SOURCES + server.cc + server_base.cc + debug.cc + util.cc + http.cc + shared.cc + tls_server_context_boringssl.cc + tls_server_session_boringssl.cc + tls_session_base_openssl.cc + util_openssl.cc + ) + + set(bssl_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/lib/includes + ${CMAKE_BINARY_DIR}/lib/includes + ${CMAKE_SOURCE_DIR}/third-party + ${CMAKE_SOURCE_DIR}/crypto/includes + + ${JEMALLOC_INCLUDE_DIRS} + ${BORINGSSL_INCLUDE_DIRS} + ${LIBEV_INCLUDE_DIRS} + ${LIBNGHTTP3_INCLUDE_DIRS} + ) + + set(bssl_LIBS + ngtcp2_crypto_boringssl_static + ngtcp2 + ${JEMALLOC_LIBRARIES} + ${BORINGSSL_LIBRARIES} + ${LIBEV_LIBRARIES} + ${LIBNGHTTP3_LIBRARIES} + ) + + add_executable(bsslclient ${bsslclient_SOURCES} $<TARGET_OBJECTS:http-parser>) + add_executable(bsslserver ${bsslserver_SOURCES} $<TARGET_OBJECTS:http-parser>) + set_target_properties(bsslclient PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_BORINGSSL -DWITH_EXAMPLE_BORINGSSL" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + set_target_properties(bsslserver PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_BORINGSSL -DWITH_EXAMPLE_BORINGSSL" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + target_include_directories(bsslclient PUBLIC ${bssl_INCLUDE_DIRS}) + target_include_directories(bsslserver PUBLIC ${bssl_INCLUDE_DIRS}) + target_link_libraries(bsslclient ${bssl_LIBS}) + target_link_libraries(bsslserver ${bssl_LIBS}) + + # TODO prevent bsslclient and example bsslservers from being installed? +endif() + +if(LIBEV_FOUND AND HAVE_PICOTLS AND LIBNGHTTP3_FOUND) + set(ptlsclient_SOURCES + client.cc + client_base.cc + debug.cc + util.cc + shared.cc + tls_client_context_picotls.cc + tls_client_session_picotls.cc + tls_session_base_picotls.cc + util_openssl.cc + ) + + set(ptlsserver_SOURCES + server.cc + server_base.cc + debug.cc + util.cc + http.cc + shared.cc + tls_server_context_picotls.cc + tls_server_session_picotls.cc + tls_session_base_picotls.cc + util_openssl.cc + ) + + set(ptls_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/lib/includes + ${CMAKE_BINARY_DIR}/lib/includes + ${CMAKE_SOURCE_DIR}/third-party + ${CMAKE_SOURCE_DIR}/crypto/includes + + ${JEMALLOC_INCLUDE_DIRS} + ${PICOTLS_INCLUDE_DIRS} + ${VANILLA_OPENSSL_INCLUDE_DIRS} + ${LIBEV_INCLUDE_DIRS} + ${LIBNGHTTP3_INCLUDE_DIRS} + ) + + set(ptls_LIBS + ngtcp2_crypto_picotls_static + ngtcp2 + ${JEMALLOC_LIBRARIES} + ${PICOTLS_LIBRARIES} + ${VANILLA_OPENSSL_LIBRARIES} + ${LIBEV_LIBRARIES} + ${LIBNGHTTP3_LIBRARIES} + ) + + add_executable(ptlsclient ${ptlsclient_SOURCES} $<TARGET_OBJECTS:http-parser>) + add_executable(ptlsserver ${ptlsserver_SOURCES} $<TARGET_OBJECTS:http-parser>) + set_target_properties(ptlsclient PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_PICOTLS -DWITH_EXAMPLE_PICOTLS" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + set_target_properties(ptlsserver PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_PICOTLS -DWITH_EXAMPLE_PICOTLS" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + target_include_directories(ptlsclient PUBLIC ${ptls_INCLUDE_DIRS}) + target_include_directories(ptlsserver PUBLIC ${ptls_INCLUDE_DIRS}) + target_link_libraries(ptlsclient ${ptls_LIBS}) + target_link_libraries(ptlsserver ${ptls_LIBS}) + + # TODO prevent ptlsclient and example ptlsservers from being installed? +endif() + +if(LIBEV_FOUND AND HAVE_WOLFSSL AND LIBNGHTTP3_FOUND) + set(wsslclient_SOURCES + client.cc + client_base.cc + debug.cc + util.cc + shared.cc + tls_client_context_wolfssl.cc + tls_client_session_wolfssl.cc + tls_session_base_wolfssl.cc + util_wolfssl.cc + ) + + set(wsslserver_SOURCES + server.cc + server_base.cc + debug.cc + util.cc + http.cc + shared.cc + tls_server_context_wolfssl.cc + tls_server_session_wolfssl.cc + tls_session_base_wolfssl.cc + util_wolfssl.cc + ) + + set(wolfssl_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/lib/includes + ${CMAKE_BINARY_DIR}/lib/includes + ${CMAKE_SOURCE_DIR}/third-party + ${CMAKE_SOURCE_DIR}/crypto/includes + + ${JEMALLOC_INCLUDE_DIRS} + ${WOLFSSL_INCLUDE_DIRS} + ${LIBEV_INCLUDE_DIRS} + ${LIBNGHTTP3_INCLUDE_DIRS} + ) + + set(wolfssl_LIBS + ngtcp2_crypto_wolfssl_static + ngtcp2 + ${JEMALLOC_LIBRARIES} + ${WOLFSSL_LIBRARIES} + ${LIBEV_LIBRARIES} + ${LIBNGHTTP3_LIBRARIES} + ) + + add_executable(wsslclient ${wsslclient_SOURCES} $<TARGET_OBJECTS:http-parser>) + add_executable(wsslserver ${wsslserver_SOURCES} $<TARGET_OBJECTS:http-parser>) + set_target_properties(wsslclient PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_WOLFSSL -DWITH_EXAMPLE_WOLFSSL" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + set_target_properties(wsslserver PROPERTIES + COMPILE_FLAGS "${WARNCXXFLAGS} -DENABLE_EXAMPLE_WOLFSSL -DWITH_EXAMPLE_WOLFSSL" + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + ) + target_include_directories(wsslclient PUBLIC ${wolfssl_INCLUDE_DIRS}) + target_include_directories(wsslserver PUBLIC ${wolfssl_INCLUDE_DIRS}) + target_link_libraries(wsslclient ${wolfssl_LIBS}) + target_link_libraries(wsslserver ${wolfssl_LIBS}) + + # TODO prevent wsslclient and example wsslserver from being installed? +endif() |