summaryrefslogtreecommitdiffstats
path: root/lib/CMakeLists.txt
blob: 8022467c69e7176224b50e9b581c41a43abcbbcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# nghttp3
#
# Copyright (c) 2019 nghttp3
# Copyright (c) 2016 ngtcp2
#
# 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.

add_subdirectory(includes)

include_directories(
  "${CMAKE_CURRENT_SOURCE_DIR}/includes"
  "${CMAKE_CURRENT_BINARY_DIR}/includes"
)

add_definitions(-DBUILDING_NGHTTP3)

set(nghttp3_SOURCES
  nghttp3_rcbuf.c
  nghttp3_mem.c
  nghttp3_str.c
  nghttp3_conv.c
  nghttp3_buf.c
  nghttp3_ringbuf.c
  nghttp3_pq.c
  nghttp3_map.c
  nghttp3_ksl.c
  nghttp3_qpack.c
  nghttp3_qpack_huffman.c
  nghttp3_qpack_huffman_data.c
  nghttp3_err.c
  nghttp3_debug.c
  nghttp3_conn.c
  nghttp3_stream.c
  nghttp3_frame.c
  nghttp3_tnode.c
  nghttp3_vec.c
  nghttp3_gaptr.c
  nghttp3_idtr.c
  nghttp3_range.c
  nghttp3_http.c
  nghttp3_version.c
  nghttp3_balloc.c
  nghttp3_opl.c
  nghttp3_objalloc.c
  nghttp3_unreachable.c
)

# Public shared library
if(ENABLE_SHARED_LIB)
  add_library(nghttp3 SHARED ${nghttp3_SOURCES})
  set_target_properties(nghttp3 PROPERTIES
    COMPILE_FLAGS "${WARNCFLAGS}"
    VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
    C_VISIBILITY_PRESET hidden
  )

  install(TARGETS nghttp3
    ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()

if(HAVE_CUNIT OR ENABLE_STATIC_LIB)
  # Static library (for unittests because of symbol visibility)
  add_library(nghttp3_static STATIC ${nghttp3_SOURCES})
  set_target_properties(nghttp3_static PROPERTIES
    COMPILE_FLAGS "${WARNCFLAGS}"
    VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
    ARCHIVE_OUTPUT_NAME nghttp3${STATIC_LIB_SUFFIX}
  )
  target_compile_definitions(nghttp3_static PUBLIC "-DNGHTTP3_STATICLIB")
  if(ENABLE_STATIC_LIB)
    install(TARGETS nghttp3_static
      DESTINATION "${CMAKE_INSTALL_LIBDIR}")
  endif()
endif()


install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp3.pc"
  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")