From 1a9557d9a481ea60ca7142b15f34528894730f7f Mon Sep 17 00:00:00 2001 From: Luca Niccolini Date: Thu, 7 Sep 2023 12:11:33 -0700 Subject: [PATCH] Always build HTTP/3 components for proxygen opensource (#6473) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/6473 Reviewed By: kvtsoy Differential Revision: D49063181 fbshipit-source-id: fd4eb25db4a03688599dba1ede92096041a568c6 --- CMakeLists.txt | 6 +- README.md | 5 +- build/fbcode_builder/manifests/proxygen | 3 - cmake/proxygen-config.cmake.in | 4 +- proxygen/build.sh | 11 +-- .../samples/H3Datagram/CMakeLists.txt | 32 ++++---- .../samples/httperf2/CMakeLists.txt | 80 +++++++++---------- proxygen/httpserver/CMakeLists.txt | 2 - proxygen/lib/CMakeLists.txt | 66 ++++++++------- proxygen/lib/http/codec/test/CMakeLists.txt | 56 +++++++------ .../lib/http/connpool/test/CMakeLists.txt | 18 ++--- proxygen/lib/http/session/test/CMakeLists.txt | 40 +++++----- proxygen/lib/transport/test/CMakeLists.txt | 26 +++--- 13 files changed, 157 insertions(+), 192 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea22eabe11..9bf6ec17d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,11 +69,7 @@ endif() find_package(fmt REQUIRED) find_package(folly REQUIRED) find_package(wangle REQUIRED) -if (BUILD_QUIC) - find_package(mvfst REQUIRED) -else() - find_package(Fizz REQUIRED) -endif() +find_package(mvfst REQUIRED) find_package(Zstd REQUIRED) find_package(ZLIB REQUIRED) find_package(OpenSSL REQUIRED) diff --git a/README.md b/README.md index 05d91c8ab0..aa8c54ca5c 100644 --- a/README.md +++ b/README.md @@ -134,10 +134,9 @@ Proxygen supports HTTP/3! It depends on Facebook's [mvfst](https://github.com/facebook/mvfst) library for the [IETF QUIC](https://github.com/quicwg/base-drafts) transport -implementation, so we have made that dependency optional. You can build the -HTTP/3 code, tests and sample binaries with `./build.sh --with-quic`. +implementation. -This will also build a handy command-line utility that can be used as an HTTP/3 +This comes with a handy command-line utility that can be used as an HTTP/3 server and client. Sample usage: diff --git a/build/fbcode_builder/manifests/proxygen b/build/fbcode_builder/manifests/proxygen index 4b4da1a3c1..a7b48043f8 100644 --- a/build/fbcode_builder/manifests/proxygen +++ b/build/fbcode_builder/manifests/proxygen @@ -15,9 +15,6 @@ builder = cmake subdir = . job_weight_mib = 3072 -[cmake.defines] -BUILD_QUIC = ON - [cmake.defines.test=on] BUILD_TESTS = ON diff --git a/cmake/proxygen-config.cmake.in b/cmake/proxygen-config.cmake.in index 8c1426d509..c79875df6e 100644 --- a/cmake/proxygen-config.cmake.in +++ b/cmake/proxygen-config.cmake.in @@ -20,9 +20,7 @@ include(CMakeFindDependencyMacro) find_dependency(fmt) find_dependency(folly) find_dependency(wangle) -if ("@BUILD_QUIC@") - find_dependency(mvfst) -endif() +find_dependency(mvfst) find_dependency(Fizz) # For now, anything that depends on Proxygen has to copy its FindZstd.cmake # and issue a `find_package(Zstd)`. Uncommenting this won't work because diff --git a/proxygen/build.sh b/proxygen/build.sh index 03d4c8aaed..f14d12fe6e 100755 --- a/proxygen/build.sh +++ b/proxygen/build.sh @@ -360,7 +360,6 @@ function setup_mvfst() { # Parse args JOBS=8 -WITH_QUIC=false INSTALL_DEPENDENCIES=true FETCH_DEPENDENCIES=true PREFIX="" @@ -371,9 +370,6 @@ while [ "$1" != "" ]; do -j | --jobs ) shift JOBS=$1 ;; - -q | --with-quic ) - WITH_QUIC=true - ;; -m | --no-jemalloc ) NO_JEMALLOC=true ;; @@ -433,11 +429,7 @@ setup_zstd setup_folly setup_fizz setup_wangle -MAYBE_BUILD_QUIC="" -if [ "$WITH_QUIC" == true ] ; then - setup_mvfst - MAYBE_BUILD_QUIC="-DBUILD_QUIC=On" -fi +setup_mvfst MAYBE_BUILD_FUZZERS="" MAYBE_USE_STATIC_DEPS="" @@ -464,7 +456,6 @@ cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_PREFIX_PATH="$DEPS_DIR" \ -DCMAKE_INSTALL_PREFIX="$PREFIX" \ - "$MAYBE_BUILD_QUIC" \ "$MAYBE_BUILD_TESTS" \ "$MAYBE_BUILD_FUZZERS" \ "$MAYBE_BUILD_SHARED_LIBS" \ diff --git a/proxygen/httpclient/samples/H3Datagram/CMakeLists.txt b/proxygen/httpclient/samples/H3Datagram/CMakeLists.txt index 9a3d0b7351..2f24c28f05 100644 --- a/proxygen/httpclient/samples/H3Datagram/CMakeLists.txt +++ b/proxygen/httpclient/samples/H3Datagram/CMakeLists.txt @@ -4,20 +4,18 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -if (BUILD_QUIC) - add_executable(proxygen_h3datagram_client H3DatagramClient.cpp) - target_compile_options( - proxygen_h3datagram_client PRIVATE - ${_PROXYGEN_COMMON_COMPILE_OPTIONS} - ) - target_link_libraries( - proxygen_h3datagram_client - PUBLIC - proxygen - ) - install( - TARGETS proxygen_h3datagram_client - EXPORT proxygen-exports - DESTINATION bin - ) -endif() +add_executable(proxygen_h3datagram_client H3DatagramClient.cpp) +target_compile_options( + proxygen_h3datagram_client PRIVATE + ${_PROXYGEN_COMMON_COMPILE_OPTIONS} +) +target_link_libraries( + proxygen_h3datagram_client + PUBLIC + proxygen +) +install( + TARGETS proxygen_h3datagram_client + EXPORT proxygen-exports + DESTINATION bin +) diff --git a/proxygen/httpclient/samples/httperf2/CMakeLists.txt b/proxygen/httpclient/samples/httperf2/CMakeLists.txt index 57767eda52..79bea78e10 100644 --- a/proxygen/httpclient/samples/httperf2/CMakeLists.txt +++ b/proxygen/httpclient/samples/httperf2/CMakeLists.txt @@ -4,49 +4,47 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -if (BUILD_QUIC) - add_library(libhttperf2 HTTPerf2.cpp Client.cpp) - target_include_directories( - libhttperf2 PUBLIC - $ - ) - target_compile_options( - libhttperf2 PRIVATE - ${_PROXYGEN_COMMON_COMPILE_OPTIONS} - ) +add_library(libhttperf2 HTTPerf2.cpp Client.cpp) +target_include_directories( + libhttperf2 PUBLIC + $ +) +target_compile_options( + libhttperf2 PRIVATE + ${_PROXYGEN_COMMON_COMPILE_OPTIONS} +) - if (BUILD_SHARED_LIBS) - set_property(TARGET libhttperf2 PROPERTY POSITION_INDEPENDENT_CODE ON) - if (DEFINED PACKAGE_VERSION) - set_target_properties( - libhttperf2 PROPERTIES VERSION ${PACKAGE_VERSION} - ) - endif() - endif() +if (BUILD_SHARED_LIBS) + set_property(TARGET libhttperf2 PROPERTY POSITION_INDEPENDENT_CODE ON) + if (DEFINED PACKAGE_VERSION) + set_target_properties( + libhttperf2 PROPERTIES VERSION ${PACKAGE_VERSION} + ) + endif() +endif() - target_link_libraries(libhttperf2 PUBLIC proxygen) +target_link_libraries(libhttperf2 PUBLIC proxygen) - install( - TARGETS libhttperf2 - EXPORT proxygen-exports - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ) +install( + TARGETS libhttperf2 + EXPORT proxygen-exports + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} +) - add_executable(proxygen_httperf2 Main.cpp) - target_link_libraries( - proxygen_httperf2 PUBLIC - libhttperf2 - proxygenhqloggerhelper - ) - target_compile_options( - proxygen_httperf2 PRIVATE - ${_PROXYGEN_COMMON_COMPILE_OPTIONS} - ) +add_executable(proxygen_httperf2 Main.cpp) +target_link_libraries( + proxygen_httperf2 PUBLIC + libhttperf2 + proxygenhqloggerhelper +) +target_compile_options( + proxygen_httperf2 PRIVATE + ${_PROXYGEN_COMMON_COMPILE_OPTIONS} +) - install( - TARGETS proxygen_httperf2 - EXPORT proxygen-exports - DESTINATION bin - ) -endif() +install( + TARGETS proxygen_httperf2 + EXPORT proxygen-exports + DESTINATION bin +) diff --git a/proxygen/httpserver/CMakeLists.txt b/proxygen/httpserver/CMakeLists.txt index 4ce6fa3ed2..5f92610ffd 100644 --- a/proxygen/httpserver/CMakeLists.txt +++ b/proxygen/httpserver/CMakeLists.txt @@ -119,9 +119,7 @@ if (BUILD_SAMPLES) EXPORT proxygen-exports DESTINATION bin ) -endif() -if (BUILD_QUIC AND BUILD_SAMPLES) add_library( proxygenhqloggerhelper samples/hq/HQLoggerHelper.cpp diff --git a/proxygen/lib/CMakeLists.txt b/proxygen/lib/CMakeLists.txt index 22868930ec..ac5005f48b 100644 --- a/proxygen/lib/CMakeLists.txt +++ b/proxygen/lib/CMakeLists.txt @@ -58,40 +58,38 @@ add_custom_target( ${PROXYGEN_GENERATED_ROOT}/proxygen/lib/utils/TraceFieldType.cpp ) -if (BUILD_QUIC) - set( - HTTP3_SOURCES - ${HTTP3_SOURCES} - http/SynchronizedLruQuicPskCache.cpp - http/HQConnector.cpp - http/codec/HTTPBinaryCodec.cpp - http/codec/HQControlCodec.cpp - http/codec/HQFramedCodec.cpp - http/codec/HQFramer.cpp - http/codec/HQStreamCodec.cpp - http/codec/HQUnidirectionalCodec.cpp - http/codec/HQUtils.cpp - http/session/HQByteEventTracker.cpp - http/session/HQDownstreamSession.cpp - http/session/HQSession.cpp - http/session/HQStreamBase.cpp - http/session/HQStreamDispatcher.cpp - http/session/HQUpstreamSession.cpp - transport/H3DatagramAsyncSocket.cpp - transport/PersistentQuicPskCache.cpp - transport/PersistentQuicTokenCache.cpp - ) - set( - HTTP3_DEPEND_LIBS - ${HTTP3_DEPEND_LIBS} - mvfst::mvfst_transport - mvfst::mvfst_client - mvfst::mvfst_fizz_client - mvfst::mvfst_server - mvfst::mvfst_codec_types - mvfst::mvfst_state_machine - ) -endif() +set( + HTTP3_SOURCES + ${HTTP3_SOURCES} + http/SynchronizedLruQuicPskCache.cpp + http/HQConnector.cpp + http/codec/HTTPBinaryCodec.cpp + http/codec/HQControlCodec.cpp + http/codec/HQFramedCodec.cpp + http/codec/HQFramer.cpp + http/codec/HQStreamCodec.cpp + http/codec/HQUnidirectionalCodec.cpp + http/codec/HQUtils.cpp + http/session/HQByteEventTracker.cpp + http/session/HQDownstreamSession.cpp + http/session/HQSession.cpp + http/session/HQStreamBase.cpp + http/session/HQStreamDispatcher.cpp + http/session/HQUpstreamSession.cpp + transport/H3DatagramAsyncSocket.cpp + transport/PersistentQuicPskCache.cpp + transport/PersistentQuicTokenCache.cpp +) +set( + HTTP3_DEPEND_LIBS + ${HTTP3_DEPEND_LIBS} + mvfst::mvfst_transport + mvfst::mvfst_client + mvfst::mvfst_fizz_client + mvfst::mvfst_server + mvfst::mvfst_codec_types + mvfst::mvfst_state_machine +) add_library( proxygen diff --git a/proxygen/lib/http/codec/test/CMakeLists.txt b/proxygen/lib/http/codec/test/CMakeLists.txt index aaff43b266..7ef950e6b1 100644 --- a/proxygen/lib/http/codec/test/CMakeLists.txt +++ b/proxygen/lib/http/codec/test/CMakeLists.txt @@ -36,35 +36,33 @@ proxygen_add_test(TARGET CodecTests testmain ) -if (BUILD_QUIC) - proxygen_add_test(TARGET HQFramerTests - SOURCES - HQFramerTest.cpp - DEPENDS - codectestutils - proxygen - testmain - mvfst::mvfst_codec_types - ) +proxygen_add_test(TARGET HQFramerTests + SOURCES + HQFramerTest.cpp + DEPENDS + codectestutils + proxygen + testmain + mvfst::mvfst_codec_types +) - proxygen_add_test(TARGET HQCodecTests - SOURCES - HQCodecTest.cpp - HQMultiCodecTest.cpp - DEPENDS - codectestutils - proxygen - testmain - mvfst::mvfst_codec_types - mvfst::mvfst_state_machine - ) +proxygen_add_test(TARGET HQCodecTests + SOURCES + HQCodecTest.cpp + HQMultiCodecTest.cpp + DEPENDS + codectestutils + proxygen + testmain + mvfst::mvfst_codec_types + mvfst::mvfst_state_machine +) - proxygen_add_test(TARGET BinaryCodecTests - SOURCES - HTTPBinaryCodecTest.cpp - DEPENDS - codectestutils - proxygen - testmain +proxygen_add_test(TARGET BinaryCodecTests + SOURCES + HTTPBinaryCodecTest.cpp + DEPENDS + codectestutils + proxygen + testmain ) -endif() diff --git a/proxygen/lib/http/connpool/test/CMakeLists.txt b/proxygen/lib/http/connpool/test/CMakeLists.txt index d299fb0931..2bc5c7f355 100644 --- a/proxygen/lib/http/connpool/test/CMakeLists.txt +++ b/proxygen/lib/http/connpool/test/CMakeLists.txt @@ -4,13 +4,11 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -if (BUILD_QUIC) - proxygen_add_test(TARGET ConnpoolTests - SOURCES - SessionPoolTest.cpp - DEPENDS - proxygen - testtransport - testmain - ) -endif() +proxygen_add_test(TARGET ConnpoolTests + SOURCES + SessionPoolTest.cpp + DEPENDS + proxygen + testtransport + testmain +) diff --git a/proxygen/lib/http/session/test/CMakeLists.txt b/proxygen/lib/http/session/test/CMakeLists.txt index 2f6225fb2a..c57a06969d 100644 --- a/proxygen/lib/http/session/test/CMakeLists.txt +++ b/proxygen/lib/http/session/test/CMakeLists.txt @@ -41,24 +41,22 @@ proxygen_add_test(TARGET SessionTests testmain ) -if (BUILD_QUIC) - proxygen_add_test(TARGET HQSessionTests - SOURCES - HQByteEventTrackerTest.cpp - HQDownstreamSessionTest.cpp - HQSessionMocksTest.cpp - HQSessionTestCommon.cpp - HQStreamBaseTest.cpp - HQStreamDispatcherTest.cpp - HQUpstreamSessionTest.cpp - DEPENDS - codectestutils - sessiontestutils - testtransport - proxygen - testmain - mvfst::mvfst_codec_types - mvfst::mvfst_dsr_types - mvfst::mvfst_state_machine - ) -endif() +proxygen_add_test(TARGET HQSessionTests + SOURCES + HQByteEventTrackerTest.cpp + HQDownstreamSessionTest.cpp + HQSessionMocksTest.cpp + HQSessionTestCommon.cpp + HQStreamBaseTest.cpp + HQStreamDispatcherTest.cpp + HQUpstreamSessionTest.cpp + DEPENDS + codectestutils + sessiontestutils + testtransport + proxygen + testmain + mvfst::mvfst_codec_types + mvfst::mvfst_dsr_types + mvfst::mvfst_state_machine +) diff --git a/proxygen/lib/transport/test/CMakeLists.txt b/proxygen/lib/transport/test/CMakeLists.txt index 05de836e03..6035f65dc3 100644 --- a/proxygen/lib/transport/test/CMakeLists.txt +++ b/proxygen/lib/transport/test/CMakeLists.txt @@ -8,17 +8,15 @@ if(NOT BUILD_TESTS) return() endif() -if (BUILD_QUIC) - proxygen_add_test(TARGET TransportTests - SOURCES - H3DatagramAsyncSocketTest.cpp - DEPENDS - codectestutils - sessiontestutils - proxygen - testmain - mvfst::mvfst_codec_types - mvfst::mvfst_dsr_types - mvfst::mvfst_state_machine - ) -endif() +proxygen_add_test(TARGET TransportTests + SOURCES + H3DatagramAsyncSocketTest.cpp + DEPENDS + codectestutils + sessiontestutils + proxygen + testmain + mvfst::mvfst_codec_types + mvfst::mvfst_dsr_types + mvfst::mvfst_state_machine +)