Skip to content
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

simplify Jamfile #2

Open
wants to merge 4 commits into
base: bump_boost_json
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ task:
pkg install -U -y git boost-jam boost-libs unzip wget openssl cmake ninja
wget "https://github.com/boostorg/build/archive/develop.zip"
unzip develop.zip
git clone --depth=1 --single-branch --branch boost-1.74.0 https://github.com/boostorg/build.git
git clone --depth=1 --single-branch --branch boost-1.75.0 https://github.com/boostorg/build.git
cd build-develop
./bootstrap.sh
echo "using clang ;" > ~/user-config.jam
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@
[submodule "deps/libdatachannel"]
path = deps/libdatachannel
url = https://github.com/paullouisageneau/libdatachannel.git
[submodule "deps/json"]
path = deps/json
url = https://github.com/vinniefalco/json.git
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,8 @@ if (webtorrent)
endif()

# Boost
find_public_dependency(Boost REQUIRED)
find_public_dependency(Boost 1.75.0 REQUIRED)
target_include_directories(torrent-rasterbar PUBLIC ${Boost_INCLUDE_DIRS})
if (Boost_MAJOR_VERSION LESS_EQUAL 1 AND Boost_MINOR_VERSION LESS 69)
find_package(Boost REQUIRED COMPONENTS system)
target_link_libraries(torrent-rasterbar PUBLIC ${Boost_SYSTEM_LIBRARY})
endif()

if (exceptions)
if (MSVC)
Expand Down
66 changes: 3 additions & 63 deletions bindings/python/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,10 @@ if $(LIBTORRENT_PYTHON_INTERPRETER)
using python : : "$(LIBTORRENT_PYTHON_INTERPRETER)" : : : <libtorrent-python>on ;
}

# copied from boost 1.63's boost python jamfile
rule find-py3-version
{
local BOOST_VERSION_TAG = [ modules.peek boostcpp : BOOST_VERSION_TAG ] ;
if $(BOOST_VERSION_TAG) >= 1_67
{
# starting with boost 1.67.0 boost python no longer define a separate
# target for python3 (boost_python3) so then we just use the regular
# boost_python target
return ;
}
local versions = [ feature.values python ] ;
local py3ver ;
for local v in $(versions)
{
if $(v) >= 3.0
{
py3ver = $(v) ;
}
}
return $(py3ver) ;
}

if $(BOOST_ROOT)
{
use-project /boost : $(BOOST_ROOT) ;
alias boost_python : /boost/python//boost_python : : : <include>$(BOOST_ROOT) ;
if [ find-py3-version ]
{
alias boost_python3 : /boost/python//boost_python3 : : : <include>$(BOOST_ROOT) ;
}
else
{
alias boost_python3 : boost_python ;
}
}
else
{
Expand Down Expand Up @@ -98,7 +67,6 @@ else
}

lib boost_python : : <tag>@boost_python_version : : $(boost-include-path) ;
alias boost_python3 : boost_python ;
}


Expand Down Expand Up @@ -133,39 +101,13 @@ rule libtorrent_linking ( properties * )
ECHO "WARNING: you probably want to specify libtorrent-link=static rather than link=static" ;
}

local BOOST_VERSION_TAG = [ modules.peek boostcpp : BOOST_VERSION_TAG ] ;
if <boost-link>static in $(properties) && $(BOOST_VERSION_TAG) < 1_74 && <target-os>linux in $(properties)
{
ECHO "WARNING: you cannot link statically against boost-python on linux before version 1.74.0, because it links against pthread statically in that case, which is not allowed" ;
}

local boost_python_lib ;

for local prop in $(properties)
{
switch $(prop)
{
case <python>2.* : boost_python_lib = boost_python ;
case <python>3.* : boost_python_lib = boost_python3 ;
}
}

if ! $(boost_python_lib)
if <boost-link>shared in $(properties)
{
ECHO "WARNING: unknown python version" ;
boost_python_lib = boost_python ;
}

# linux must link dynamically against boost python because it pulls
# in libpthread, which must be linked dynamically since we're building a .so
# (the static build of libpthread is not position independent)
if <boost-link>shared in $(properties) || ( <target-os>linux in $(properties) && $(BOOST_VERSION_TAG) < 1_74 )
{
result += <library>$(boost_python_lib)/<link>shared/<warnings>off ;
result += <library>boost_python/<link>shared/<warnings>off ;
}
else
{
result += <library>$(boost_python_lib)/<link>static/<warnings>off ;
result += <library>boost_python/<link>static/<warnings>off ;
}

if <libtorrent-link>shared in $(properties)
Expand Down Expand Up @@ -294,7 +236,6 @@ install stage_module
install stage_dependencies
: /torrent//torrent
boost_python
boost_python3
: <location>dependencies
<install-dependencies>on
<install-type>SHARED_LIB
Expand All @@ -303,4 +244,3 @@ install stage_dependencies

explicit stage_module ;
explicit stage_dependencies ;

4 changes: 0 additions & 4 deletions bindings/python/src/boost_python.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@

#include <boost/bind/placeholders.hpp>

// in boost 1.60, placeholders moved into a namespace, just like std
#if BOOST_VERSION >= 106000
using namespace boost::placeholders;
#endif

#include <boost/python/stl_iterator.hpp>
#include <boost/get_pointer.hpp>
Expand All @@ -34,4 +31,3 @@ using namespace boost::placeholders;
#endif

#endif

1 change: 0 additions & 1 deletion deps/json
Submodule json deleted from 755285
5 changes: 2 additions & 3 deletions docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ libtorrent runs on most major operating systems including:
* Solaris

It uses Boost.Asio, Boost.Optional, Boost.System, Boost.Multiprecision,
Boost.Pool, Boost.Python (for bindings), Boost.CRC and various
other boost libraries. At least version 1.70 of boost is required.
Boost.Pool, Boost.Python (for bindings), Boost.CRC, Boost.JSON and various
other boost libraries. At least version 1.75 of boost is required.

Since libtorrent uses Boost.Asio it will take full advantage of high performance
network APIs on the most popular platforms. I/O completion ports on windows,
Expand All @@ -320,4 +320,3 @@ libtorrent requires a C++11 compiler and does not build with the following compi

* GCC older than 5.4
* Visual Studio older than Visual Studio 15 2017 (aka msvc-14.1)

2 changes: 0 additions & 2 deletions include/libtorrent/aux_/utp_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ struct TORRENT_EXTRA_EXPORT utp_stream
issue_write();
}

#if BOOST_VERSION >= 106600
// Compatiblity with the async_wait method introduced in boost 1.66

enum wait_type { wait_read, wait_write, wait_error };
Expand All @@ -459,7 +458,6 @@ struct TORRENT_EXTRA_EXPORT utp_stream
break;
}
}
#endif

private:

Expand Down
2 changes: 1 addition & 1 deletion include/libtorrent/proxy_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct proxy_base
m_sock.async_write_some(buffers, std::move(handler));
}

#if BOOST_VERSION >= 106600 && !defined TORRENT_BUILD_SIMULATOR
#if !defined TORRENT_BUILD_SIMULATOR
// Compatiblity with the async_wait method introduced in boost 1.66

static constexpr auto wait_read = tcp::socket::wait_read;
Expand Down
4 changes: 0 additions & 4 deletions include/libtorrent/ssl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ using error_code = boost::system::error_code;
using boost::asio::ssl::stream;
#endif
using boost::asio::ssl::verify_context;
#if BOOST_VERSION >= 107300
using boost::asio::ssl::host_name_verification;
#else
using host_name_verification = boost::asio::ssl::rfc2818_verification;
#endif

using native_context_type = SSL_CTX*;
using native_stream_type = SSL*;
Expand Down
2 changes: 0 additions & 2 deletions include/libtorrent/ssl_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ struct ssl_stream
using lowest_layer_type = typename Stream::lowest_layer_type;
using endpoint_type = typename Stream::endpoint_type;
using protocol_type = typename Stream::protocol_type;
#if BOOST_VERSION >= 106600
using executor_type = typename sock_type::executor_type;
executor_type get_executor() { return m_sock->get_executor(); }
#endif

ssl::stream_handle_type handle()
{
Expand Down
10 changes: 1 addition & 9 deletions src/websocket_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,11 @@ void websocket_stream::do_handshake()
ADD_OUTSTANDING_ASYNC("websocket_stream::on_handshake");
std::visit([&](auto& stream)
{
#if BOOST_VERSION >= 107000
stream.set_option(websocket::stream_base::decorator(user_agent_handler));
stream.async_handshake(host
, m_target
, std::bind(&websocket_stream::on_handshake, shared_from_this(), _1));
#else
stream.async_handshake_ex(host
, m_target
, user_agent_handler
, std::bind(&websocket_stream::on_handshake, shared_from_this(), _1));
#endif
}
}
, m_stream);
}

Expand Down Expand Up @@ -282,4 +275,3 @@ void websocket_stream::on_close(error_code)
}

#endif // TORRENT_USE_RTC

15 changes: 1 addition & 14 deletions src/websocket_tracker_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ see LICENSE file.

#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/system/system_error.hpp>
#include <boost/json.hpp>
#if BOOST_VERSION >= 107500
#include <boost/json/src.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"

#include <algorithm>
Expand Down Expand Up @@ -208,11 +205,7 @@ void websocket_tracker_connection::do_send(tracker_request const& req)
offers_array.emplace_back(std::move(payload_offer));
}

#if BOOST_VERSION >= 107500
std::string const data = json::serialize(payload);
#else
json::string const data = json::to_string(payload);
#endif
m_write_data.assign(data.begin(), data.end());

#ifndef TORRENT_DISABLE_LOGGING
Expand All @@ -239,11 +232,7 @@ void websocket_tracker_connection::do_send(tracker_answer const& ans)
obj["type"] = "answer";
obj["sdp"] = ans.answer.sdp;

#if BOOST_VERSION >= 107500
std::string const data = json::serialize(payload);
#else
json::string const data = json::to_string(payload);
#endif
m_write_data.assign(data.begin(), data.end());

#ifndef TORRENT_DISABLE_LOGGING
Expand All @@ -261,8 +250,7 @@ void websocket_tracker_connection::do_read()
{
if (!is_open()) return;

// Can be replaced by m_read_buffer.clear() with boost 1.70+
if (m_read_buffer.size() > 0) m_read_buffer.consume(m_read_buffer.size());
if (m_read_buffer.size() > 0) m_read_buffer.clear();

ADD_OUTSTANDING_ASYNC("websocket_tracker_connection::on_read");
m_websocket->async_read(m_read_buffer
Expand Down Expand Up @@ -492,4 +480,3 @@ catch(std::exception const& e)
}

#endif // TORRENT_USE_RTC