From f04a8d111407374a4b0a83617a6ec76e055bc2a3 Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Thu, 22 Apr 2021 13:23:13 +0200 Subject: tls: tlspicotls require version when building Type: fix When building the tlspicotls plugin, we rely on vpp-ext-deps having installed quicly & picotls. We add a dependancy on the version installed thus ensuring that people with older vpp-ext-deps version installed don't have their build fail. This has the drawback that picotls doesn't have its own versionning scheme Change-Id: I9e2ccfc00b3c37af2bc2483a791eb05f994dd4a4 Signed-off-by: Nathan Skrzypczak --- src/plugins/tlspicotls/CMakeLists.txt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/plugins/tlspicotls') diff --git a/src/plugins/tlspicotls/CMakeLists.txt b/src/plugins/tlspicotls/CMakeLists.txt index 74eff8c9845..baf4c69427d 100644 --- a/src/plugins/tlspicotls/CMakeLists.txt +++ b/src/plugins/tlspicotls/CMakeLists.txt @@ -1,8 +1,14 @@ include (CheckFunctionExists) -message(STATUS "Looking for picotls") +# We should rely on a picotls specific version, but as +# we expect dependancies to be built with vpp-ext-deps +# it's reasonable to make this check to avoid breaking +# existing builds when upgrading the quicly/picotls +# versions +set(EXPECTED_QUICLY_VERSION "0.1.3-vpp") +find_path(QUICLY_INCLUDE_DIR NAMES quicly.h) find_path (PICOTLS_INCLUDE_DIR NAMES picotls.h) find_library (PICOTLS_CORE_LIBRARY NAMES "libpicotls-core.a") find_library (PICOTLS_OPENSSL_LIBRARY NAMES "libpicotls-openssl.a") @@ -12,7 +18,14 @@ list (APPEND PICOTLS_LINK_LIBRARIES ${PICOTLS_OPENSSL_LIBRARY} ) -if (PICOTLS_INCLUDE_DIR AND PICOTLS_LINK_LIBRARIES) +if(QUICLY_INCLUDE_DIR AND PICOTLS_INCLUDE_DIR AND PICOTLS_LINK_LIBRARIES) + if(EXISTS "${QUICLY_INCLUDE_DIR}/quicly/version.h") + file(STRINGS "${QUICLY_INCLUDE_DIR}/quicly/version.h" quicly_version_str REGEX "^#define[\t ]+LIBQUICLY_VERSION[\t ]+\".*\"") + string(REGEX REPLACE "^#define[\t ]+LIBQUICLY_VERSION[\t ]+\"([^\"]*)\".*" "\\1" QUICLY_VERSION_STRING "${quicly_version_str}") + unset(quicly_version_str) + endif() + + if (${QUICLY_VERSION_STRING} MATCHES "${EXPECTED_QUICLY_VERSION}") include_directories (${PICOTLS_INCLUDE_DIR}) add_vpp_plugin(tlspicotls SOURCES @@ -23,6 +36,9 @@ if (PICOTLS_INCLUDE_DIR AND PICOTLS_LINK_LIBRARIES) LINK_LIBRARIES ${PICOTLS_LINK_LIBRARIES} ) message (STATUS "Found picotls in ${PICOTLS_INCLUDE_DIR} and ${PICOTLS_CORE_LIBRARY}") + else() + message(STATUS "-- quicly ${EXPECTED_QUICLY_VERSION} not found - tlspicotls plugin disabled") + endif() else () - message (WARNING "-- picotls not found") + message (WARNING "-- picotls not found - tlspicotls plugin disabled") endif () -- cgit 1.2.3-korg