quic: quicly v0.1.2 update
[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 unset(QUIC_LINK_LIBRARIES)
16 set(EXPECTED_QUICLY_VERSION "0.1.2-vpp")
17
18 find_path(QUICLY_INCLUDE_DIR NAMES quicly.h)
19 find_path(PICOTLS_INCLUDE_DIR NAMES picotls.h)
20 find_library (QUICLY_LIBRARY NAMES "libquicly.a")
21 find_library (PICOTLS_CORE_LIBRARY NAMES "libpicotls-core.a")
22 find_library (PICOTLS_OPENSSL_LIBRARY NAMES "libpicotls-openssl.a")
23
24 list(APPEND QUIC_LINK_LIBRARIES
25   ${QUICLY_LIBRARY}
26   ${PICOTLS_CORE_LIBRARY}
27   ${PICOTLS_OPENSSL_LIBRARY}
28 )
29
30 if(QUICLY_INCLUDE_DIR AND QUIC_LINK_LIBRARIES)
31   if(EXISTS "${QUICLY_INCLUDE_DIR}/quicly/version.h")
32     file(STRINGS "${QUICLY_INCLUDE_DIR}/quicly/version.h" quicly_version_str REGEX "^#define[\t ]+LIBQUICLY_VERSION[\t ]+\".*\"")
33     string(REGEX REPLACE "^#define[\t ]+LIBQUICLY_VERSION[\t ]+\"([^\"]*)\".*" "\\1" QUICLY_VERSION_STRING "${quicly_version_str}")
34     unset(quicly_version_str)
35   endif()
36
37   if (${QUICLY_VERSION_STRING} MATCHES "${EXPECTED_QUICLY_VERSION}")
38     include_directories (${QUICLY_INCLUDE_DIR})
39
40     if(PICOTLS_INCLUDE_DIR)
41       include_directories (${PICOTLS_INCLUDE_DIR})
42     endif()
43
44     add_vpp_plugin(quic
45       SOURCES
46       certs.c
47       error.c
48       quic.c
49       quic_crypto.c
50
51       LINK_LIBRARIES ${QUIC_LINK_LIBRARIES}
52     )
53     message(STATUS "Found quicly ${EXPECTED_QUICLY_VERSION} in ${QUICLY_INCLUDE_DIR}")
54   else()
55     message(STATUS "-- quicly ${EXPECTED_QUICLY_VERSION} not found - QUIC plugin disabled")
56   endif()
57 else()
58   message(WARNING "-- quicly headers not found - QUIC plugin disabled")
59 endif()