hs-test: temp skip some tests
[vpp.git] / src / plugins / quic / CMakeLists.txt
1
2 # Copyright (c) 2021 Cisco
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 if(NOT OPENSSL_FOUND)
16   message(WARNING "OpenSSL not found - quic plugin disabled")
17   return()
18 endif()
19
20 unset(QUIC_LINK_LIBRARIES)
21 set(EXPECTED_QUICLY_VERSION "0.1.4-vpp")
22
23 vpp_find_path(QUICLY_INCLUDE_DIR NAMES quicly.h)
24 vpp_find_path(PICOTLS_INCLUDE_DIR NAMES picotls.h)
25 vpp_find_library(QUICLY_LIBRARY NAMES "libquicly.a")
26 vpp_find_library(PICOTLS_CORE_LIBRARY NAMES "libpicotls-core.a")
27 vpp_find_library(PICOTLS_OPENSSL_LIBRARY NAMES "libpicotls-openssl.a")
28
29 list(APPEND QUIC_LINK_LIBRARIES
30   ${QUICLY_LIBRARY}
31   ${PICOTLS_CORE_LIBRARY}
32   ${PICOTLS_OPENSSL_LIBRARY}
33 )
34
35 if(QUICLY_INCLUDE_DIR AND QUIC_LINK_LIBRARIES)
36   if(EXISTS "${QUICLY_INCLUDE_DIR}/quicly/version.h")
37     file(STRINGS "${QUICLY_INCLUDE_DIR}/quicly/version.h" quicly_version_str REGEX "^#define[\t ]+LIBQUICLY_VERSION[\t ]+\".*\"")
38     string(REGEX REPLACE "^#define[\t ]+LIBQUICLY_VERSION[\t ]+\"([^\"]*)\".*" "\\1" QUICLY_VERSION_STRING "${quicly_version_str}")
39     unset(quicly_version_str)
40   endif()
41
42   if (${QUICLY_VERSION_STRING} MATCHES "${EXPECTED_QUICLY_VERSION}")
43     include_directories (${QUICLY_INCLUDE_DIR})
44
45     if(PICOTLS_INCLUDE_DIR)
46       include_directories (${PICOTLS_INCLUDE_DIR})
47     endif()
48
49     add_vpp_plugin(quic
50       SOURCES
51       certs.c
52       error.c
53       quic.c
54       quic_crypto.c
55
56       LINK_LIBRARIES ${QUIC_LINK_LIBRARIES} ${OPENSSL_LIBRARIES}
57     )
58     message(STATUS "Found quicly ${EXPECTED_QUICLY_VERSION} in ${QUICLY_INCLUDE_DIR}")
59   else()
60     message(STATUS "-- quicly ${EXPECTED_QUICLY_VERSION} not found - QUIC plugin disabled")
61   endif()
62 else()
63   message(WARNING "-- quicly headers not found - QUIC plugin disabled")
64 endif()