Skip to content

Link with standard libraries instead of Boost #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 8, 2016
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "deps/cxxopts"]
path = deps/cxxopts
url = https://github.com/jarro2783/cxxopts.git
[submodule "deps/asio"]
path = deps/asio
url = https://github.com/chriskohlhoff/asio.git
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ env:
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
# Support the sanitizers in clang only
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
# - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
# - BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix?
#- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2"
matrix:
exclude:
- compiler: g++
env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
- compiler: g++
env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
# matrix:
# exclude:
# - compiler: g++
# env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
# - compiler: g++
# env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix?
# - compiler: g++
# env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2"
Expand Down
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project(CPP-NETLIB)

option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF )
option( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests." ON)
option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments." ON)
# option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments." ON)
option( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples." ON)
option( CPP-NETLIB_ENABLE_HTTPS "Build cpp-netlib with support for https if OpenSSL is found." ON)

Expand Down Expand Up @@ -46,7 +46,7 @@ add_definitions(-DBOOST_TEST_DYN_LINK)
# Always use multi-threaded Boost libraries.
set(Boost_USE_MULTI_THREADED ON)

find_package(Boost 1.57.0 REQUIRED system filesystem)
find_package(Boost 1.57.0 REQUIRED)

if (CPP-NETLIB_ENABLE_HTTPS)
find_package( OpenSSL )
Expand Down Expand Up @@ -91,18 +91,23 @@ if (Boost_FOUND)
add_definitions(-D_WIN32_WINNT=0x0501)
endif(WIN32)
include_directories(${Boost_INCLUDE_DIRS})

# Asio
add_definitions(-DASIO_HEADER_ONLY)
include_directories(deps/asio/asio/include)

enable_testing()
add_subdirectory(libs/network/src)
if (CPP-NETLIB_BUILD_TESTS)
add_subdirectory(deps/googletest)
add_subdirectory(libs/network/test)
endif (CPP-NETLIB_BUILD_TESTS)
if (CPP-NETLIB_BUILD_EXPERIMENTS)
add_subdirectory(libs/network/experiment)
endif (CPP-NETLIB_BUILD_EXPERIMENTS)
if (NOT MSVC AND CPP-NETLIB_BUILD_TESTS)
add_subdirectory(libs/mime/test)
endif(NOT MSVC AND CPP-NETLIB_BUILD_TESTS)
# if (CPP-NETLIB_BUILD_EXPERIMENTS)
# add_subdirectory(libs/network/experiment)
# endif (CPP-NETLIB_BUILD_EXPERIMENTS)
# if (NOT MSVC AND CPP-NETLIB_BUILD_TESTS)
# add_subdirectory(libs/mime/test)
# endif(NOT MSVC AND CPP-NETLIB_BUILD_TESTS)
if (CPP-NETLIB_BUILD_EXAMPLES)
add_subdirectory(libs/network/example)
endif (CPP-NETLIB_BUILD_EXAMPLES)
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ C++ Network Library

Modern C++ network programming libraries.

.. image:: https://travis-ci.org/cpp-netlib/cpp-netlib.svg?branch=master
:target: https://travis-ci.org/cpp-netlib/cpp-netlib

Join us on Slack: http://slack.cpp-netlib.org/

Subscribe to the mailing list: https://groups.google.com/forum/#!forum/cpp-netlib
Expand Down
1 change: 0 additions & 1 deletion boost/network/protocol/http/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/traits/ostringstream.hpp>

#include <boost/asio/io_service.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <istream>
Expand Down
20 changes: 10 additions & 10 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <thread>
#include <memory>
#include <functional>
#include <boost/asio/io_service.hpp>
#include <boost/asio/strand.hpp>
#include <asio/io_service.hpp>
#include <asio/strand.hpp>
#include <boost/network/protocol/http/traits/connection_policy.hpp>

namespace boost {
Expand All @@ -32,13 +32,13 @@ struct async_client
typedef typename string<Tag>::type string_type;

typedef std::function<void(boost::iterator_range<char const*> const&,
system::error_code const&)> body_callback_function_type;
std::error_code const&)> body_callback_function_type;

typedef std::function<bool(string_type&)> body_generator_function_type;

async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
std::shared_ptr<boost::asio::io_service> service,
std::shared_ptr<asio::io_service> service,
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
Expand All @@ -47,10 +47,10 @@ struct async_client
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get()
? service
: std::make_shared<boost::asio::io_service>()),
: std::make_shared<asio::io_service>()),
service_(*service_ptr),
resolver_(service_),
sentinel_(new boost::asio::io_service::work(service_)),
sentinel_(new asio::io_service::work(service_)),
certificate_filename_(std::move(certificate_filename)),
verify_path_(std::move(verify_path)),
certificate_file_(std::move(certificate_file)),
Expand All @@ -59,7 +59,7 @@ struct async_client
ssl_options_(ssl_options),
always_verify_peer_(always_verify_peer) {
connection_base::resolver_strand_.reset(
new boost::asio::io_service::strand(service_));
new asio::io_service::strand(service_));
if (!service)
lifetime_thread_.reset(new std::thread([this] () { service_.run(); }));
}
Expand Down Expand Up @@ -87,10 +87,10 @@ struct async_client
generator);
}

std::shared_ptr<boost::asio::io_service> service_ptr;
boost::asio::io_service& service_;
std::shared_ptr<asio::io_service> service_ptr;
asio::io_service& service_;
resolver_type resolver_;
std::shared_ptr<boost::asio::io_service::work> sentinel_;
std::shared_ptr<asio::io_service::work> sentinel_;
std::shared_ptr<std::thread> lifetime_thread_;
optional<string_type> certificate_filename_;
optional<string_type> verify_path_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct async_connection_base {
typedef basic_request<Tag> request;
typedef basic_response<Tag> response;
typedef iterator_range<char const *> char_const_range;
typedef std::function<void(char_const_range const &, system::error_code const &)>
typedef std::function<void(char_const_range const &, std::error_code const &)>
body_callback_function_type;
typedef std::function<bool(string_type &)> body_generator_function_type;
typedef std::shared_ptr<this_type> connection_ptr;
Expand Down
Loading