1 add_subdirectory(includes)
3 file(GLOB c_sources *.c)
4 set_source_files_properties(${c_sources} PROPERTIES
5 COMPILE_FLAGS "${WARNCFLAGS}")
6 file(GLOB cxx_sources *.cc)
7 set_source_files_properties(${cxx_sources} PROPERTIES
8 COMPILE_FLAGS "${WARNCXXFLAGS} ${CXX1XCXXFLAGS}")
11 "${CMAKE_CURRENT_SOURCE_DIR}/includes"
12 "${CMAKE_CURRENT_SOURCE_DIR}/../third-party"
13 "${CMAKE_CURRENT_SOURCE_DIR}/../third-party/llhttp/include"
15 ${JEMALLOC_INCLUDE_DIRS}
16 ${LIBXML2_INCLUDE_DIRS}
18 ${LIBNGHTTP3_INCLUDE_DIRS}
19 ${LIBNGTCP2_INCLUDE_DIRS}
20 ${LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS}
21 ${OPENSSL_INCLUDE_DIRS}
22 ${LIBCARES_INCLUDE_DIRS}
23 ${JANSSON_INCLUDE_DIRS}
25 ${LIBBPF_INCLUDE_DIRS}
34 ${LIBNGHTTP3_LIBRARIES}
35 ${LIBNGTCP2_LIBRARIES}
36 ${LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES}
48 http2.cc timegm.c app_helper.cc nghttp2_gzip.c
58 list(APPEND NGHTTP_SOURCES HtmlParser.cc)
75 h2load_http2_session.cc
76 h2load_http1_session.cc
79 list(APPEND H2LOAD_SOURCES
80 h2load_http3_session.cc
86 # Common libnhttpx sources (used for nghttpx and unit tests)
88 util.cc http2.cc timegm.c
92 shrpx_accept_handler.cc
93 shrpx_connection_handler.cc
94 shrpx_client_handler.cc
95 shrpx_http2_upstream.cc
96 shrpx_https_upstream.cc
98 shrpx_downstream_connection.cc
99 shrpx_http_downstream_connection.cc
100 shrpx_http2_downstream_connection.cc
101 shrpx_http2_session.cc
102 shrpx_downstream_queue.cc
109 shrpx_connect_blocker.cc
111 shrpx_downstream_connection_pool.cc
114 shrpx_memcached_dispatcher.cc
115 shrpx_memcached_connection.cc
116 shrpx_worker_process.cc
119 shrpx_api_downstream_connection.cc
120 shrpx_health_monitor_downstream_connection.cc
121 shrpx_null_downstream_connection.cc
123 shrpx_dns_resolver.cc
124 shrpx_dual_dns_resolver.cc
129 list(APPEND NGHTTPX_SRCS
131 shrpx_mruby_module.cc
132 shrpx_mruby_module_env.cc
133 shrpx_mruby_module_request.cc
134 shrpx_mruby_module_response.cc
138 list(APPEND NGHTTPX_SRCS
140 shrpx_quic_listener.cc
141 shrpx_quic_connection_handler.cc
142 shrpx_http3_upstream.cc
147 add_library(nghttpx_static STATIC ${NGHTTPX_SRCS})
148 set_target_properties(nghttpx_static PROPERTIES ARCHIVE_OUTPUT_NAME nghttpx)
150 set(NGHTTPX-bin_SOURCES
155 target_link_libraries(nghttpx_static ${SYSTEMD_LIBRARIES})
156 target_compile_definitions(nghttpx_static PUBLIC HAVE_LIBSYSTEMD)
157 target_include_directories(nghttpx_static PUBLIC ${SYSTEMD_INCLUDE_DIRS})
161 target_link_libraries(nghttpx_static mruby-lib)
165 target_link_libraries(nghttpx_static neverbleed)
170 set(NGHTTPX_UNITTEST_SOURCES
173 shrpx_downstream_test.cc
187 add_executable(nghttpx-unittest EXCLUDE_FROM_ALL
188 ${NGHTTPX_UNITTEST_SOURCES}
189 $<TARGET_OBJECTS:llhttp>
190 $<TARGET_OBJECTS:url-parser>
192 target_include_directories(nghttpx-unittest PRIVATE ${CUNIT_INCLUDE_DIRS})
193 target_compile_definitions(nghttpx-unittest
194 PRIVATE "-DNGHTTP2_SRC_DIR=\"${CMAKE_SOURCE_DIR}/src\""
196 target_link_libraries(nghttpx-unittest nghttpx_static ${CUNIT_LIBRARIES})
198 target_link_libraries(nghttpx-unittest mruby-lib)
201 target_link_libraries(nghttpx-unittest neverbleed)
204 add_test(nghttpx-unittest nghttpx-unittest)
205 add_dependencies(check nghttpx-unittest)
208 add_executable(nghttp ${NGHTTP_SOURCES} $<TARGET_OBJECTS:llhttp>
209 $<TARGET_OBJECTS:url-parser>
211 add_executable(nghttpd ${NGHTTPD_SOURCES} $<TARGET_OBJECTS:llhttp>
212 $<TARGET_OBJECTS:url-parser>
214 add_executable(nghttpx ${NGHTTPX-bin_SOURCES} $<TARGET_OBJECTS:llhttp>
215 $<TARGET_OBJECTS:url-parser>
217 target_compile_definitions(nghttpx PRIVATE
218 "-DPKGDATADIR=\"${PKGDATADIR}\""
219 "-DPKGLIBDIR=\"${PKGLIBDIR}\""
221 target_link_libraries(nghttpx nghttpx_static)
222 add_executable(h2load ${H2LOAD_SOURCES} $<TARGET_OBJECTS:llhttp>
223 $<TARGET_OBJECTS:url-parser>
226 install(TARGETS nghttp nghttpd nghttpx h2load
227 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
230 if(ENABLE_HPACK_TOOLS)
231 set(inflatehd_SOURCES
235 set(deflatehd_SOURCES
239 add_executable(inflatehd ${inflatehd_SOURCES})
240 add_executable(deflatehd ${deflatehd_SOURCES})
241 install(TARGETS inflatehd deflatehd
242 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
246 set(NGHTTP2_ASIO_SOURCES
251 asio_io_service_pool.cc
253 asio_server_http2_impl.cc
255 asio_server_http2_handler.cc
256 asio_server_request.cc
257 asio_server_request_impl.cc
258 asio_server_response.cc
259 asio_server_response_impl.cc
260 asio_server_stream.cc
261 asio_server_serve_mux.cc
262 asio_server_request_handler.cc
263 asio_server_tls_context.cc
264 asio_client_session.cc
265 asio_client_session_impl.cc
266 asio_client_session_tcp_impl.cc
267 asio_client_session_tls_impl.cc
268 asio_client_response.cc
269 asio_client_response_impl.cc
270 asio_client_request.cc
271 asio_client_request_impl.cc
272 asio_client_stream.cc
273 asio_client_tls_context.cc
276 add_library(nghttp2_asio SHARED
277 ${NGHTTP2_ASIO_SOURCES}
278 $<TARGET_OBJECTS:llhttp>
279 $<TARGET_OBJECTS:url-parser>
281 target_include_directories(nghttp2_asio PRIVATE
282 ${OPENSSL_INCLUDE_DIRS}
283 ${Boost_INCLUDE_DIRS}
285 target_include_directories(nghttp2_asio INTERFACE
286 "${CMAKE_CURRENT_BINARY_DIR}/../lib/includes"
287 "${CMAKE_CURRENT_SOURCE_DIR}/../lib/includes"
288 "${CMAKE_CURRENT_SOURCE_DIR}/includes"
290 target_link_libraries(nghttp2_asio
295 set_target_properties(nghttp2_asio PROPERTIES
296 VERSION 1.0.0 SOVERSION 1)
298 install(TARGETS nghttp2_asio
299 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
300 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
301 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
303 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2_asio.pc"
304 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")