Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 42 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/cppalliance/http_io
# Official repository: https://github.com/cppalliance/beast2
#

#-------------------------------------------------
Expand All @@ -16,14 +16,14 @@
#
#-------------------------------------------------
cmake_minimum_required(VERSION 3.8...3.20)
set(BOOST_HTTP_IO_VERSION 1)
set(BOOST_BEAST2_VERSION 1)
if (BOOST_SUPERPROJECT_VERSION)
set(BOOST_HTTP_IO_VERSION ${BOOST_SUPERPROJECT_VERSION})
set(BOOST_BEAST2_VERSION ${BOOST_SUPERPROJECT_VERSION})
endif ()
project(boost_http_io VERSION "${BOOST_HTTP_IO_VERSION}" LANGUAGES CXX)
set(BOOST_HTTP_IO_IS_ROOT OFF)
project(boost_beast2 VERSION "${BOOST_BEAST2_VERSION}" LANGUAGES CXX)
set(BOOST_BEAST2_IS_ROOT OFF)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(BOOST_HTTP_IO_IS_ROOT ON)
set(BOOST_BEAST2_IS_ROOT ON)
endif ()
set(__ignore__ ${CMAKE_C_COMPILER})

Expand All @@ -32,12 +32,12 @@ set(__ignore__ ${CMAKE_C_COMPILER})
# Options
#
#-------------------------------------------------
if (BOOST_HTTP_IO_IS_ROOT)
if (BOOST_BEAST2_IS_ROOT)
include(CTest)
endif ()
option(BOOST_HTTP_IO_BUILD_TESTS "Build boost::http_io tests" ${BUILD_TESTING})
option(BOOST_HTTP_IO_BUILD_EXAMPLES "Build boost::http_io examples" ${BOOST_HTTP_IO_IS_ROOT})
option(BOOST_HTTP_IO_MRDOCS_BUILD "Build the target for MrDocs: see mrdocs.yml" OFF)
option(BOOST_BEAST2_BUILD_TESTS "Build boost::beast2 tests" ${BUILD_TESTING})
option(BOOST_BEAST2_BUILD_EXAMPLES "Build boost::beast2 examples" ${BOOST_BEAST2_IS_ROOT})
option(BOOST_BEAST2_MRDOCS_BUILD "Build the target for MrDocs: see mrdocs.yml" OFF)


# Check if environment variable BOOST_SRC_DIR is set
Expand All @@ -54,7 +54,7 @@ set(BOOST_SRC_DIR ${DEFAULT_BOOST_SRC_DIR} CACHE STRING "Boost source dir to use
#
#-------------------------------------------------
# The boost super-project requires one explicit dependency per-line.
set(BOOST_HTTP_IO_DEPENDENCIES
set(BOOST_BEAST2_DEPENDENCIES
Boost::asio
Boost::assert
Boost::config
Expand All @@ -63,28 +63,28 @@ set(BOOST_HTTP_IO_DEPENDENCIES
Boost::throw_exception
)

foreach (BOOST_HTTP_IO_DEPENDENCY ${BOOST_HTTP_IO_DEPENDENCIES})
if (BOOST_HTTP_IO_DEPENDENCY MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$")
list(APPEND BOOST_HTTP_IO_INCLUDE_LIBRARIES ${CMAKE_MATCH_1})
foreach (BOOST_BEAST2_DEPENDENCY ${BOOST_BEAST2_DEPENDENCIES})
if (BOOST_BEAST2_DEPENDENCY MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$")
list(APPEND BOOST_BEAST2_INCLUDE_LIBRARIES ${CMAKE_MATCH_1})
endif ()
endforeach ()
# Conditional dependencies
if (BOOST_HTTP_IO_BUILD_TESTS)
set(BOOST_HTTP_IO_UNIT_TEST_LIBRARIES beast url)
if (BOOST_BEAST2_BUILD_TESTS)
set(BOOST_BEAST2_UNIT_TEST_LIBRARIES beast url)
endif ()
if (BOOST_HTTP_IO_BUILD_EXAMPLES)
set(BOOST_HTTP_IO_EXAMPLE_LIBRARIES json program_options scope url multiprecision)
if (BOOST_BEAST2_BUILD_EXAMPLES)
set(BOOST_BEAST2_EXAMPLE_LIBRARIES json program_options scope url multiprecision)
endif ()
# Complete dependency list
set(BOOST_INCLUDE_LIBRARIES ${BOOST_HTTP_IO_INCLUDE_LIBRARIES} ${BOOST_HTTP_IO_UNIT_TEST_LIBRARIES} ${BOOST_HTTP_IO_EXAMPLE_LIBRARIES})
set(BOOST_EXCLUDE_LIBRARIES http_io)
set(BOOST_INCLUDE_LIBRARIES ${BOOST_BEAST2_INCLUDE_LIBRARIES} ${BOOST_BEAST2_UNIT_TEST_LIBRARIES} ${BOOST_BEAST2_EXAMPLE_LIBRARIES})
set(BOOST_EXCLUDE_LIBRARIES beast2)

#-------------------------------------------------
#
# Add Boost Subdirectory
#
#-------------------------------------------------
if (BOOST_HTTP_IO_IS_ROOT)
if (BOOST_BEAST2_IS_ROOT)
set(CMAKE_FOLDER Dependencies)
# Find absolute BOOST_SRC_DIR
if (NOT IS_ABSOLUTE ${BOOST_SRC_DIR})
Expand Down Expand Up @@ -132,50 +132,50 @@ endif ()
#-------------------------------------------------
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

file(GLOB_RECURSE BOOST_HTTP_IO_HEADERS CONFIGURE_DEPENDS include/boost/http_io/*.hpp include/boost/*.natvis)
file(GLOB_RECURSE BOOST_HTTP_IO_SOURCES CONFIGURE_DEPENDS src/*.cpp src/*.hpp)
file(GLOB_RECURSE BOOST_BEAST2_HEADERS CONFIGURE_DEPENDS include/boost/beast2/*.hpp include/boost/*.natvis)
file(GLOB_RECURSE BOOST_BEAST2_SOURCES CONFIGURE_DEPENDS src/*.cpp src/*.hpp)

source_group("" FILES "include/boost/http_io.hpp" "build/Jamfile")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost/http_io PREFIX "include" FILES ${BOOST_HTTP_IO_HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src PREFIX "src" FILES ${BOOST_HTTP_IO_SOURCES})
source_group("" FILES "include/boost/beast2.hpp" "build/Jamfile")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost/beast2 PREFIX "include" FILES ${BOOST_BEAST2_HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/src PREFIX "src" FILES ${BOOST_BEAST2_SOURCES})


function(boost_http_io_setup_properties target)
function(boost_beast2_setup_properties target)
target_compile_features(${target} PUBLIC cxx_constexpr)
target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_link_libraries(${target} PUBLIC ${BOOST_HTTP_IO_DEPENDENCIES})
target_link_libraries(${target} PUBLIC ${BOOST_BEAST2_DEPENDENCIES})
find_package(Threads REQUIRED)
target_link_libraries(${target} PUBLIC Threads::Threads)
if (MINGW)
target_link_libraries(${target} PUBLIC ws2_32 wsock32)
endif()
target_compile_definitions(${target} PUBLIC BOOST_HTTP_IO_NO_LIB)
target_compile_definitions(${target} PRIVATE BOOST_HTTP_IO_SOURCE)
target_compile_definitions(${target} PUBLIC BOOST_BEAST2_NO_LIB)
target_compile_definitions(${target} PRIVATE BOOST_BEAST2_SOURCE)
if (BUILD_SHARED_LIBS)
target_compile_definitions(${target} PUBLIC BOOST_HTTP_IO_DYN_LINK)
target_compile_definitions(${target} PUBLIC BOOST_BEAST2_DYN_LINK)
else ()
target_compile_definitions(${target} PUBLIC BOOST_HTTP_IO_STATIC_LINK)
target_compile_definitions(${target} PUBLIC BOOST_BEAST2_STATIC_LINK)
endif ()
endfunction()

if (BOOST_HTTP_IO_MRDOCS_BUILD)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp" "#include <boost/http_io.hpp>\n")
add_library(boost_http_io_mrdocs "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp")
boost_http_io_setup_properties(boost_http_io_mrdocs)
boost_http_io_setup_properties(boost_http_io_mrdocs PUBLIC BOOST_HTTP_IO_MRDOCS)
if (BOOST_BEAST2_MRDOCS_BUILD)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp" "#include <boost/beast2.hpp>\n")
add_library(boost_beast2_mrdocs "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp")
boost_beast2_setup_properties(boost_beast2_mrdocs)
boost_beast2_setup_properties(boost_beast2_mrdocs PUBLIC BOOST_BEAST2_MRDOCS)
return()
endif()

add_library(boost_http_io include/boost/http_io.hpp build/Jamfile ${BOOST_HTTP_IO_HEADERS} ${BOOST_HTTP_IO_SOURCES})
add_library(Boost::http_io ALIAS boost_http_io)
boost_http_io_setup_properties(boost_http_io)
add_library(boost_beast2 include/boost/beast2.hpp build/Jamfile ${BOOST_BEAST2_HEADERS} ${BOOST_BEAST2_SOURCES})
add_library(Boost::beast2 ALIAS boost_beast2)
boost_beast2_setup_properties(boost_beast2)

#-------------------------------------------------
#
# Tests
#
#-------------------------------------------------
if (BOOST_HTTP_IO_BUILD_TESTS)
if (BOOST_BEAST2_BUILD_TESTS)
add_subdirectory(test)
endif ()

Expand All @@ -184,6 +184,6 @@ endif ()
# Examples
#
#-------------------------------------------------
if (BOOST_HTTP_IO_BUILD_EXAMPLES)
if (BOOST_BEAST2_BUILD_EXAMPLES)
add_subdirectory(example)
endif ()
4 changes: 2 additions & 2 deletions build/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/CPPAlliance/http_io
# Official repository: https://github.com/cppalliance/beast2
#

import ../../config/checks/config : requires ;
Expand All @@ -26,7 +26,7 @@ explicit
[ searched-lib mswsock : : <target-os>windows ] # NT
;

project boost/http_io
project boost/beast2
: common-requirements
$(c11-requires)
<link>shared:<define>BOOST_HTTP_IO_DYN_LINK=1
Expand Down
4 changes: 2 additions & 2 deletions doc/antora.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: http_io
name: beast2
version: ~
title: Boost.Http.Io
title: Boost.Beast2
start_page: index.adoc
asciidoc:
attributes:
Expand Down
8 changes: 4 additions & 4 deletions doc/local-playbook.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
site:
title: Boost.Http.Io
title: Boost.Beast2
url: https://antora.cppalliance.org/develop/lib/doc
start_page: http_io::index.adoc
start_page: beast2::index.adoc
robots: allow
keys:
repo_url: 'https://github.com/cppalliance/http_io'
repo_url: 'https://github.com/cppalliance/beast2'

content:
sources:
- url: ..
start_path: doc
edit_url: 'https://github.com/cppalliance/http_io/edit/{refname}/{path}'
edit_url: 'https://github.com/cppalliance/beast2/edit/{refname}/{path}'

ui:
bundle:
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* xref:reference:boost/http_io.adoc[Reference]
* xref:reference:boost/beast2.adoc[Reference]
10 changes: 5 additions & 5 deletions doc/mrdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ file-patterns:

# Filters
include-symbols:
- 'boost::http_io::**'
- 'boost::beast2::**'
implementation-defined:
- 'boost::http_io::detail'
- 'boost::http_io::*::detail'
- 'boost::beast2::detail'
- 'boost::beast2::*::detail'
inaccessible-members: never
inaccessible-bases: never

# Generator
generate: adoc
base-url: https://www.github.com/cppalliance/http_io/blob/develop/
base-url: https://www.github.com/cppalliance/beast2/blob/develop/

# Style
verbose: true
multipage: true
use-system-libc: true
use-system-stdlib: true

cmake: '-DCMAKE_CXX_STANDARD=20 -DBOOST_HTTP_IO_MRDOCS_BUILD=ON -DBOOST_HTTP_IO_BUILD_TESTS=OFF -DBOOST_HTTP_IO_BUILD_EXAMPLES=OFF'
cmake: '-DCMAKE_CXX_STANDARD=20 -DBOOST_BEAST2_MRDOCS_BUILD=ON -DBOOST_BEAST2_BUILD_TESTS=OFF -DBOOST_BEAST2_BUILD_EXAMPLES=OFF'
18 changes: 9 additions & 9 deletions example/client/get/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/cppalliance/http_io
# Official repository: https://github.com/cppalliance/beast2
#

file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS *.cpp *.hpp
Expand All @@ -13,30 +13,30 @@ file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS *.cpp *.hpp

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "" FILES ${PFILES})

add_executable(http_io_example_client_get ${PFILES})
add_executable(beast2_example_client_get ${PFILES})

target_compile_definitions(http_io_example_client_get
target_compile_definitions(beast2_example_client_get
PRIVATE BOOST_ASIO_NO_DEPRECATED)

set_property(TARGET http_io_example_client_get
set_property(TARGET beast2_example_client_get
PROPERTY FOLDER "examples")

find_package(OpenSSL REQUIRED)

target_link_libraries(http_io_example_client_get
Boost::http_io
target_link_libraries(beast2_example_client_get
Boost::beast2
Boost::url
OpenSSL::SSL
OpenSSL::Crypto)

if (WIN32)
target_link_libraries(http_io_example_client_get crypt32)
target_link_libraries(beast2_example_client_get crypt32)
endif()

if (TARGET Boost::rts_zlib)
target_link_libraries(http_io_example_client_get Boost::rts_zlib)
target_link_libraries(beast2_example_client_get Boost::rts_zlib)
endif()

if (TARGET Boost::rts_brotli)
target_link_libraries(http_io_example_client_get Boost::rts_brotli)
target_link_libraries(beast2_example_client_get Boost::rts_brotli)
endif()
4 changes: 2 additions & 2 deletions example/client/get/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Official repository: https://github.com/cppalliance/http_io
# Official repository: https://github.com/cppalliance/beast2
#

using openssl ;
Expand All @@ -17,7 +17,7 @@ lib user32 ;

project
: requirements
<library>/boost/http_io//boost_http_io
<library>/boost/beast2//boost_beast2
[ ac.check-library /boost/rts//boost_rts_zlib : <library>/boost/rts//boost_rts_zlib : ]
[ ac.check-library /boost/rts//boost_rts_brotli : <library>/boost/rts//boost_rts_brotli : ]
[ ac.check-library /openssl//ssl : <library>/openssl//ssl/<link>shared : <build>no ]
Expand Down
18 changes: 9 additions & 9 deletions example/client/get/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/cppalliance/http_io
// Official repository: https://github.com/cppalliance/beast2
//

#include <boost/asio/connect.hpp>
Expand All @@ -13,7 +13,7 @@
#include <boost/asio/ssl/host_name_verification.hpp>
#include <boost/asio/ssl/stream.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/http_io.hpp>
#include <boost/beast2.hpp>
#include <boost/http_proto/request.hpp>
#include <boost/http_proto/response_parser.hpp>
#include <boost/http_proto/serializer.hpp>
Expand Down Expand Up @@ -181,12 +181,12 @@ class session

// Send the HTTP request to the remote host
if(secure_)
http_io::async_write(
beast2::async_write(
stream_,
sr_,
std::bind(&session::on_write, this, _1, _2));
else
http_io::async_write(
beast2::async_write(
stream_.next_layer(),
sr_,
std::bind(&session::on_write, this, _1, _2));
Expand All @@ -208,12 +208,12 @@ class session

// Receive the HTTP response header
if(secure_)
http_io::async_read_header(
beast2::async_read_header(
stream_,
pr_,
std::bind(&session::on_read_header, this, _1, _2));
else
http_io::async_read_header(
beast2::async_read_header(
stream_.next_layer(),
pr_,
std::bind(&session::on_read_header, this, _1, _2));
Expand All @@ -238,12 +238,12 @@ class session

// Receive the HTTP response body
if(secure_)
http_io::async_read(
beast2::async_read(
stream_,
pr_,
std::bind(&session::on_read, this, _1, _2));
else
http_io::async_read(
beast2::async_read(
stream_.next_layer(),
pr_,
std::bind(&session::on_read, this, _1, _2));
Expand Down Expand Up @@ -288,7 +288,7 @@ class session
// Read and discard bodies if they are <= 32KB
// Open a new connection otherwise.
pr_.set_body_limit(32 * 1024);
return http_io::async_read(
return beast2::async_read(
stream_,
pr_,
[this](system::error_code ec, std::size_t)
Expand Down
Loading
Loading