Skip to content

Commit

Permalink
Always build HTTP/3 components for proxygen opensource (#6473)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookincubator/velox#6473

Reviewed By: kvtsoy

Differential Revision: D49063181

fbshipit-source-id: fd4eb25db4a03688599dba1ede92096041a568c6
  • Loading branch information
Luca Niccolini authored and facebook-github-bot committed Sep 7, 2023
1 parent cc4c543 commit 1a9557d
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 192 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions build/fbcode_builder/manifests/proxygen
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ builder = cmake
subdir = .
job_weight_mib = 3072

[cmake.defines]
BUILD_QUIC = ON

[cmake.defines.test=on]
BUILD_TESTS = ON

Expand Down
4 changes: 1 addition & 3 deletions cmake/proxygen-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions proxygen/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ function setup_mvfst() {

# Parse args
JOBS=8
WITH_QUIC=false
INSTALL_DEPENDENCIES=true
FETCH_DEPENDENCIES=true
PREFIX=""
Expand All @@ -371,9 +370,6 @@ while [ "$1" != "" ]; do
-j | --jobs ) shift
JOBS=$1
;;
-q | --with-quic )
WITH_QUIC=true
;;
-m | --no-jemalloc )
NO_JEMALLOC=true
;;
Expand Down Expand Up @@ -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=""
Expand All @@ -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" \
Expand Down
32 changes: 15 additions & 17 deletions proxygen/httpclient/samples/H3Datagram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
80 changes: 39 additions & 41 deletions proxygen/httpclient/samples/httperf2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_compile_options(
libhttperf2 PRIVATE
${_PROXYGEN_COMMON_COMPILE_OPTIONS}
)
add_library(libhttperf2 HTTPerf2.cpp Client.cpp)
target_include_directories(
libhttperf2 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
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
)
2 changes: 0 additions & 2 deletions proxygen/httpserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
66 changes: 32 additions & 34 deletions proxygen/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 27 additions & 29 deletions proxygen/lib/http/codec/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
18 changes: 8 additions & 10 deletions proxygen/lib/http/connpool/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Loading

0 comments on commit 1a9557d

Please sign in to comment.