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 ${OPENSSL_INCLUDE_DIRS}
19 ${LIBCARES_INCLUDE_DIRS}
20 ${JANSSON_INCLUDE_DIRS}
40 http2.cc timegm.c app_helper.cc nghttp2_gzip.c
50 list(APPEND NGHTTP_SOURCES HtmlParser.cc)
67 h2load_http2_session.cc
68 h2load_http1_session.cc
72 # Common libnhttpx sources (used for nghttpx and unit tests)
74 util.cc http2.cc timegm.c
78 shrpx_accept_handler.cc
79 shrpx_connection_handler.cc
80 shrpx_client_handler.cc
81 shrpx_http2_upstream.cc
82 shrpx_https_upstream.cc
84 shrpx_downstream_connection.cc
85 shrpx_http_downstream_connection.cc
86 shrpx_http2_downstream_connection.cc
87 shrpx_http2_session.cc
88 shrpx_downstream_queue.cc
95 shrpx_connect_blocker.cc
97 shrpx_downstream_connection_pool.cc
100 shrpx_memcached_dispatcher.cc
101 shrpx_memcached_connection.cc
102 shrpx_worker_process.cc
105 shrpx_api_downstream_connection.cc
106 shrpx_health_monitor_downstream_connection.cc
108 shrpx_dns_resolver.cc
109 shrpx_dual_dns_resolver.cc
114 list(APPEND NGHTTPX_SRCS
116 shrpx_mruby_module.cc
117 shrpx_mruby_module_env.cc
118 shrpx_mruby_module_request.cc
119 shrpx_mruby_module_response.cc
122 add_library(nghttpx_static STATIC ${NGHTTPX_SRCS})
123 set_target_properties(nghttpx_static PROPERTIES ARCHIVE_OUTPUT_NAME nghttpx)
125 set(NGHTTPX-bin_SOURCES
130 target_link_libraries(nghttpx_static ${SYSTEMD_LIBRARIES})
131 target_compile_definitions(nghttpx_static PUBLIC HAVE_LIBSYSTEMD)
132 target_include_directories(nghttpx_static PUBLIC ${SYSTEMD_INCLUDE_DIRS})
136 target_link_libraries(nghttpx_static mruby-lib)
140 target_link_libraries(nghttpx_static neverbleed)
145 set(NGHTTPX_UNITTEST_SOURCES
148 shrpx_downstream_test.cc
162 add_executable(nghttpx-unittest EXCLUDE_FROM_ALL
163 ${NGHTTPX_UNITTEST_SOURCES}
164 $<TARGET_OBJECTS:llhttp>
165 $<TARGET_OBJECTS:url-parser>
167 target_include_directories(nghttpx-unittest PRIVATE ${CUNIT_INCLUDE_DIRS})
168 target_compile_definitions(nghttpx-unittest
169 PRIVATE "-DNGHTTP2_SRC_DIR=\"${CMAKE_SOURCE_DIR}/src\""
171 target_link_libraries(nghttpx-unittest nghttpx_static ${CUNIT_LIBRARIES})
173 target_link_libraries(nghttpx-unittest mruby-lib)
176 target_link_libraries(nghttpx-unittest neverbleed)
179 add_test(nghttpx-unittest nghttpx-unittest)
180 add_dependencies(check nghttpx-unittest)
183 add_executable(nghttp ${NGHTTP_SOURCES} $<TARGET_OBJECTS:llhttp>
184 $<TARGET_OBJECTS:url-parser>
186 add_executable(nghttpd ${NGHTTPD_SOURCES} $<TARGET_OBJECTS:llhttp>
187 $<TARGET_OBJECTS:url-parser>
189 add_executable(nghttpx ${NGHTTPX-bin_SOURCES} $<TARGET_OBJECTS:llhttp>
190 $<TARGET_OBJECTS:url-parser>
192 target_compile_definitions(nghttpx PRIVATE "-DPKGDATADIR=\"${PKGDATADIR}\"")
193 target_link_libraries(nghttpx nghttpx_static)
194 add_executable(h2load ${H2LOAD_SOURCES} $<TARGET_OBJECTS:llhttp>
195 $<TARGET_OBJECTS:url-parser>
198 install(TARGETS nghttp nghttpd nghttpx h2load
199 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
202 if(ENABLE_HPACK_TOOLS)
203 set(inflatehd_SOURCES
207 set(deflatehd_SOURCES
211 add_executable(inflatehd ${inflatehd_SOURCES})
212 add_executable(deflatehd ${deflatehd_SOURCES})
213 install(TARGETS inflatehd deflatehd
214 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
218 set(NGHTTP2_ASIO_SOURCES
223 asio_io_service_pool.cc
225 asio_server_http2_impl.cc
227 asio_server_http2_handler.cc
228 asio_server_request.cc
229 asio_server_request_impl.cc
230 asio_server_response.cc
231 asio_server_response_impl.cc
232 asio_server_stream.cc
233 asio_server_serve_mux.cc
234 asio_server_request_handler.cc
235 asio_server_tls_context.cc
236 asio_client_session.cc
237 asio_client_session_impl.cc
238 asio_client_session_tcp_impl.cc
239 asio_client_session_tls_impl.cc
240 asio_client_response.cc
241 asio_client_response_impl.cc
242 asio_client_request.cc
243 asio_client_request_impl.cc
244 asio_client_stream.cc
245 asio_client_tls_context.cc
248 add_library(nghttp2_asio SHARED
249 ${NGHTTP2_ASIO_SOURCES}
250 $<TARGET_OBJECTS:llhttp>
251 $<TARGET_OBJECTS:url-parser>
253 target_include_directories(nghttp2_asio PRIVATE
254 ${OPENSSL_INCLUDE_DIRS}
255 ${Boost_INCLUDE_DIRS}
257 target_include_directories(nghttp2_asio INTERFACE
258 "${CMAKE_CURRENT_BINARY_DIR}/../lib/includes"
259 "${CMAKE_CURRENT_SOURCE_DIR}/../lib/includes"
260 "${CMAKE_CURRENT_SOURCE_DIR}/includes"
262 target_link_libraries(nghttp2_asio
267 set_target_properties(nghttp2_asio PROPERTIES
268 VERSION 1.0.0 SOVERSION 1)
270 install(TARGETS nghttp2_asio
271 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
272 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
273 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
275 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2_asio.pc"
276 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")