2016-02-12 13:12:33 +01:00
|
|
|
add_subdirectory(includes)
|
|
|
|
|
2016-03-13 12:22:33 +01:00
|
|
|
file(GLOB c_sources *.c)
|
|
|
|
set_source_files_properties(${c_sources} PROPERTIES
|
|
|
|
COMPILE_FLAGS "${WARNCFLAGS}")
|
|
|
|
file(GLOB cxx_sources *.cc)
|
|
|
|
set_source_files_properties(${cxx_sources} PROPERTIES
|
|
|
|
COMPILE_FLAGS "${WARNCXXFLAGS} ${CXX1XCXXFLAGS}")
|
2016-02-12 13:12:33 +01:00
|
|
|
|
|
|
|
include_directories(
|
2017-08-16 20:28:12 +02:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../third-party"
|
2018-11-23 12:44:36 +01:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../third-party/llhttp/include"
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-02-15 01:12:07 +01:00
|
|
|
${JEMALLOC_INCLUDE_DIRS}
|
2016-03-16 17:31:54 +01:00
|
|
|
${LIBXML2_INCLUDE_DIRS}
|
2016-02-12 13:12:33 +01:00
|
|
|
${LIBEV_INCLUDE_DIRS}
|
|
|
|
${OPENSSL_INCLUDE_DIRS}
|
2016-12-10 14:16:35 +01:00
|
|
|
${LIBCARES_INCLUDE_DIRS}
|
2016-02-12 13:12:33 +01:00
|
|
|
${JANSSON_INCLUDE_DIRS}
|
|
|
|
${ZLIB_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
# XXX per-target?
|
|
|
|
link_libraries(
|
|
|
|
nghttp2
|
|
|
|
${JEMALLOC_LIBRARIES}
|
|
|
|
${LIBXML2_LIBRARIES}
|
|
|
|
${LIBEV_LIBRARIES}
|
|
|
|
${OPENSSL_LIBRARIES}
|
2016-12-10 14:16:35 +01:00
|
|
|
${LIBCARES_LIBRARIES}
|
2016-02-12 13:12:33 +01:00
|
|
|
${JANSSON_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${APP_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
|
|
|
if(ENABLE_APP)
|
|
|
|
set(HELPER_OBJECTS
|
|
|
|
util.cc
|
|
|
|
http2.cc timegm.c app_helper.cc nghttp2_gzip.c
|
|
|
|
)
|
|
|
|
|
|
|
|
# nghttp client
|
|
|
|
set(NGHTTP_SOURCES
|
|
|
|
${HELPER_OBJECTS}
|
|
|
|
nghttp.cc
|
2017-04-01 07:47:36 +02:00
|
|
|
tls.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
)
|
|
|
|
if(HAVE_LIBXML2)
|
|
|
|
list(APPEND NGHTTP_SOURCES HtmlParser.cc)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# nghttpd
|
|
|
|
set(NGHTTPD_SOURCES
|
|
|
|
${HELPER_OBJECTS}
|
|
|
|
nghttpd.cc
|
2017-04-01 07:47:36 +02:00
|
|
|
tls.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
HttpServer.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
# h2load
|
|
|
|
set(H2LOAD_SOURCES
|
|
|
|
util.cc
|
|
|
|
http2.cc h2load.cc
|
|
|
|
timegm.c
|
2017-04-01 07:47:36 +02:00
|
|
|
tls.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
h2load_http2_session.cc
|
|
|
|
h2load_http1_session.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Common libnhttpx sources (used for nghttpx and unit tests)
|
|
|
|
set(NGHTTPX_SRCS
|
|
|
|
util.cc http2.cc timegm.c
|
|
|
|
app_helper.cc
|
2017-04-01 07:47:36 +02:00
|
|
|
tls.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
shrpx_config.cc
|
|
|
|
shrpx_accept_handler.cc
|
|
|
|
shrpx_connection_handler.cc
|
|
|
|
shrpx_client_handler.cc
|
|
|
|
shrpx_http2_upstream.cc
|
|
|
|
shrpx_https_upstream.cc
|
|
|
|
shrpx_downstream.cc
|
|
|
|
shrpx_downstream_connection.cc
|
|
|
|
shrpx_http_downstream_connection.cc
|
|
|
|
shrpx_http2_downstream_connection.cc
|
|
|
|
shrpx_http2_session.cc
|
|
|
|
shrpx_downstream_queue.cc
|
|
|
|
shrpx_log.cc
|
|
|
|
shrpx_http.cc
|
|
|
|
shrpx_io_control.cc
|
2017-04-01 08:07:32 +02:00
|
|
|
shrpx_tls.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
shrpx_worker.cc
|
|
|
|
shrpx_log_config.cc
|
|
|
|
shrpx_connect_blocker.cc
|
2016-04-08 16:19:54 +02:00
|
|
|
shrpx_live_check.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
shrpx_downstream_connection_pool.cc
|
|
|
|
shrpx_rate_limit.cc
|
|
|
|
shrpx_connection.cc
|
|
|
|
shrpx_memcached_dispatcher.cc
|
|
|
|
shrpx_memcached_connection.cc
|
|
|
|
shrpx_worker_process.cc
|
|
|
|
shrpx_signal.cc
|
|
|
|
shrpx_router.cc
|
2016-06-02 16:47:41 +02:00
|
|
|
shrpx_api_downstream_connection.cc
|
2016-06-16 17:00:37 +02:00
|
|
|
shrpx_health_monitor_downstream_connection.cc
|
2021-08-13 14:20:08 +02:00
|
|
|
shrpx_null_downstream_connection.cc
|
2016-10-08 08:22:11 +02:00
|
|
|
shrpx_exec.cc
|
2016-12-10 14:16:35 +01:00
|
|
|
shrpx_dns_resolver.cc
|
|
|
|
shrpx_dual_dns_resolver.cc
|
|
|
|
shrpx_dns_tracker.cc
|
2016-10-09 12:14:49 +02:00
|
|
|
xsi_strerror.c
|
2016-02-12 13:12:33 +01:00
|
|
|
)
|
|
|
|
if(HAVE_MRUBY)
|
|
|
|
list(APPEND NGHTTPX_SRCS
|
|
|
|
shrpx_mruby.cc
|
|
|
|
shrpx_mruby_module.cc
|
|
|
|
shrpx_mruby_module_env.cc
|
|
|
|
shrpx_mruby_module_request.cc
|
|
|
|
shrpx_mruby_module_response.cc
|
|
|
|
)
|
|
|
|
endif()
|
2016-02-18 14:20:35 +01:00
|
|
|
add_library(nghttpx_static STATIC ${NGHTTPX_SRCS})
|
|
|
|
set_target_properties(nghttpx_static PROPERTIES ARCHIVE_OUTPUT_NAME nghttpx)
|
2016-02-12 13:12:33 +01:00
|
|
|
|
|
|
|
set(NGHTTPX-bin_SOURCES
|
|
|
|
shrpx.cc
|
|
|
|
)
|
|
|
|
|
2019-07-29 12:19:43 +02:00
|
|
|
if(HAVE_SYSTEMD)
|
|
|
|
target_link_libraries(nghttpx_static ${SYSTEMD_LIBRARIES})
|
|
|
|
target_compile_definitions(nghttpx_static PUBLIC HAVE_LIBSYSTEMD)
|
|
|
|
target_include_directories(nghttpx_static PUBLIC ${SYSTEMD_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
2016-02-12 13:12:33 +01:00
|
|
|
if(HAVE_MRUBY)
|
2016-02-18 14:20:35 +01:00
|
|
|
target_link_libraries(nghttpx_static mruby-lib)
|
2016-02-12 13:12:33 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_NEVERBLEED)
|
2016-02-18 14:20:35 +01:00
|
|
|
target_link_libraries(nghttpx_static neverbleed)
|
2016-02-12 13:12:33 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
if(HAVE_CUNIT)
|
2016-02-15 01:57:13 +01:00
|
|
|
set(NGHTTPX_UNITTEST_SOURCES
|
|
|
|
shrpx-unittest.cc
|
2017-04-01 08:07:32 +02:00
|
|
|
shrpx_tls_test.cc
|
2016-02-15 01:57:13 +01:00
|
|
|
shrpx_downstream_test.cc
|
|
|
|
shrpx_config_test.cc
|
2016-03-13 16:19:23 +01:00
|
|
|
shrpx_worker_test.cc
|
2016-02-15 01:57:13 +01:00
|
|
|
shrpx_http_test.cc
|
2016-06-11 06:31:04 +02:00
|
|
|
shrpx_router_test.cc
|
2016-02-15 01:57:13 +01:00
|
|
|
http2_test.cc
|
|
|
|
util_test.cc
|
|
|
|
nghttp2_gzip_test.c
|
|
|
|
nghttp2_gzip.c
|
|
|
|
buffer_test.cc
|
|
|
|
memchunk_test.cc
|
|
|
|
template_test.cc
|
|
|
|
base64_test.cc
|
|
|
|
)
|
|
|
|
add_executable(nghttpx-unittest EXCLUDE_FROM_ALL
|
|
|
|
${NGHTTPX_UNITTEST_SOURCES}
|
2018-11-23 12:44:36 +01:00
|
|
|
$<TARGET_OBJECTS:llhttp>
|
|
|
|
$<TARGET_OBJECTS:url-parser>
|
2016-02-15 01:57:13 +01:00
|
|
|
)
|
|
|
|
target_include_directories(nghttpx-unittest PRIVATE ${CUNIT_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions(nghttpx-unittest
|
2016-06-24 17:28:15 +02:00
|
|
|
PRIVATE "-DNGHTTP2_SRC_DIR=\"${CMAKE_SOURCE_DIR}/src\""
|
2016-02-15 01:57:13 +01:00
|
|
|
)
|
2016-02-18 14:20:35 +01:00
|
|
|
target_link_libraries(nghttpx-unittest nghttpx_static ${CUNIT_LIBRARIES})
|
2016-02-15 23:14:27 +01:00
|
|
|
if(HAVE_MRUBY)
|
|
|
|
target_link_libraries(nghttpx-unittest mruby-lib)
|
|
|
|
endif()
|
2016-02-15 10:50:31 +01:00
|
|
|
if(HAVE_NEVERBLEED)
|
|
|
|
target_link_libraries(nghttpx-unittest neverbleed)
|
|
|
|
endif()
|
|
|
|
|
2016-02-15 01:57:13 +01:00
|
|
|
add_test(nghttpx-unittest nghttpx-unittest)
|
2016-03-12 00:57:30 +01:00
|
|
|
add_dependencies(check nghttpx-unittest)
|
2016-02-12 13:12:33 +01:00
|
|
|
endif()
|
|
|
|
|
2018-11-23 12:44:36 +01:00
|
|
|
add_executable(nghttp ${NGHTTP_SOURCES} $<TARGET_OBJECTS:llhttp>
|
|
|
|
$<TARGET_OBJECTS:url-parser>
|
|
|
|
)
|
|
|
|
add_executable(nghttpd ${NGHTTPD_SOURCES} $<TARGET_OBJECTS:llhttp>
|
|
|
|
$<TARGET_OBJECTS:url-parser>
|
|
|
|
)
|
|
|
|
add_executable(nghttpx ${NGHTTPX-bin_SOURCES} $<TARGET_OBJECTS:llhttp>
|
|
|
|
$<TARGET_OBJECTS:url-parser>
|
|
|
|
)
|
2016-02-18 14:20:35 +01:00
|
|
|
target_compile_definitions(nghttpx PRIVATE "-DPKGDATADIR=\"${PKGDATADIR}\"")
|
|
|
|
target_link_libraries(nghttpx nghttpx_static)
|
2018-11-23 12:44:36 +01:00
|
|
|
add_executable(h2load ${H2LOAD_SOURCES} $<TARGET_OBJECTS:llhttp>
|
|
|
|
$<TARGET_OBJECTS:url-parser>
|
|
|
|
)
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-02-18 14:20:35 +01:00
|
|
|
install(TARGETS nghttp nghttpd nghttpx h2load
|
2016-02-12 13:12:33 +01:00
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_HPACK_TOOLS)
|
|
|
|
set(inflatehd_SOURCES
|
|
|
|
inflatehd.cc
|
|
|
|
comp_helper.c
|
|
|
|
)
|
|
|
|
set(deflatehd_SOURCES
|
|
|
|
deflatehd.cc
|
|
|
|
comp_helper.c
|
|
|
|
)
|
|
|
|
add_executable(inflatehd ${inflatehd_SOURCES})
|
|
|
|
add_executable(deflatehd ${deflatehd_SOURCES})
|
|
|
|
install(TARGETS inflatehd deflatehd
|
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_ASIO_LIB)
|
|
|
|
set(NGHTTP2_ASIO_SOURCES
|
|
|
|
util.cc http2.cc
|
2017-04-01 07:47:36 +02:00
|
|
|
tls.cc
|
2016-02-12 13:12:33 +01:00
|
|
|
timegm.c
|
|
|
|
asio_common.cc
|
|
|
|
asio_io_service_pool.cc
|
|
|
|
asio_server_http2.cc
|
|
|
|
asio_server_http2_impl.cc
|
|
|
|
asio_server.cc
|
|
|
|
asio_server_http2_handler.cc
|
|
|
|
asio_server_request.cc
|
|
|
|
asio_server_request_impl.cc
|
|
|
|
asio_server_response.cc
|
|
|
|
asio_server_response_impl.cc
|
|
|
|
asio_server_stream.cc
|
|
|
|
asio_server_serve_mux.cc
|
|
|
|
asio_server_request_handler.cc
|
|
|
|
asio_server_tls_context.cc
|
|
|
|
asio_client_session.cc
|
|
|
|
asio_client_session_impl.cc
|
|
|
|
asio_client_session_tcp_impl.cc
|
|
|
|
asio_client_session_tls_impl.cc
|
|
|
|
asio_client_response.cc
|
|
|
|
asio_client_response_impl.cc
|
|
|
|
asio_client_request.cc
|
|
|
|
asio_client_request_impl.cc
|
|
|
|
asio_client_stream.cc
|
|
|
|
asio_client_tls_context.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(nghttp2_asio SHARED
|
|
|
|
${NGHTTP2_ASIO_SOURCES}
|
2018-11-23 12:44:36 +01:00
|
|
|
$<TARGET_OBJECTS:llhttp>
|
|
|
|
$<TARGET_OBJECTS:url-parser>
|
2016-02-12 13:12:33 +01:00
|
|
|
)
|
2016-02-12 14:27:38 +01:00
|
|
|
target_include_directories(nghttp2_asio PRIVATE
|
2016-02-12 13:12:33 +01:00
|
|
|
${OPENSSL_INCLUDE_DIRS}
|
|
|
|
${Boost_INCLUDE_DIRS}
|
|
|
|
)
|
2017-08-16 20:28:12 +02:00
|
|
|
target_include_directories(nghttp2_asio INTERFACE
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/../lib/includes"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../lib/includes"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
|
|
|
|
)
|
2016-02-12 13:12:33 +01:00
|
|
|
target_link_libraries(nghttp2_asio
|
|
|
|
nghttp2
|
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${Boost_LIBRARIES}
|
|
|
|
)
|
|
|
|
set_target_properties(nghttp2_asio PROPERTIES
|
|
|
|
VERSION 1.0.0 SOVERSION 1)
|
|
|
|
|
|
|
|
install(TARGETS nghttp2_asio
|
2019-02-06 19:26:30 +01:00
|
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
2016-02-12 13:12:33 +01:00
|
|
|
|
2016-02-16 16:19:28 +01:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2_asio.pc"
|
2016-02-12 13:12:33 +01:00
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
|
|
|
endif()
|