Skip to content
Snippets Groups Projects
Commit 15f9c462 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Reduce required boost components and use std::random instread of boost

parent 7bafeaae
No related branches found
No related tags found
No related merge requests found
...@@ -134,28 +134,12 @@ set_package_properties(nlohmann_json PROPERTIES ...@@ -134,28 +134,12 @@ set_package_properties(nlohmann_json PROPERTIES
) )
if(USE_BUNDLED_BOOST) if(USE_BUNDLED_BOOST)
hunter_add_package(Boost hunter_add_package(Boost COMPONENTS iostreams system thread)
COMPONENTS atomic
chrono
date_time
iostreams
random
regex
system
thread)
endif() endif()
#set(Boost_USE_STATIC_LIBS OFF) #set(Boost_USE_STATIC_LIBS OFF)
#set(Boost_USE_STATIC_RUNTIME OFF) #set(Boost_USE_STATIC_RUNTIME OFF)
#set(Boost_USE_MULTITHREADED ON) #set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.70 find_package(Boost 1.70 COMPONENTS iostreams system thread)
COMPONENTS atomic
chrono
date_time
iostreams
random
regex
system
thread)
set_package_properties(Boost PROPERTIES set_package_properties(Boost PROPERTIES
DESCRIPTION "Free peer-reviewed portable C++ source libraries" DESCRIPTION "Free peer-reviewed portable C++ source libraries"
URL "https://www.boost.org/" URL "https://www.boost.org/"
...@@ -226,12 +210,7 @@ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> ...@@ -226,12 +210,7 @@ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_link_libraries(matrix_client target_link_libraries(matrix_client
PUBLIC PUBLIC
Boost::atomic
Boost::chrono
Boost::date_time
Boost::iostreams Boost::iostreams
Boost::random
Boost::regex
Boost::system Boost::system
Boost::thread Boost::thread
libsodium::libsodium libsodium::libsodium
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <cctype> #include <cctype>
#include <iomanip> #include <iomanip>
#include <random>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <utility> #include <utility>
...@@ -14,8 +15,6 @@ ...@@ -14,8 +15,6 @@
#include <boost/iostreams/filter/zlib.hpp> #include <boost/iostreams/filter/zlib.hpp>
#include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/traits.hpp> #include <boost/iostreams/traits.hpp>
#include <boost/random/random_device.hpp>
#include <boost/random/uniform_int_distribution.hpp>
mtx::client::utils::MxcUrl mtx::client::utils::MxcUrl
mtx::client::utils::parse_mxc_url(const std::string &url) mtx::client::utils::parse_mxc_url(const std::string &url)
...@@ -59,8 +58,8 @@ mtx::client::utils::random_token(uint8_t len, bool with_symbols) noexcept ...@@ -59,8 +58,8 @@ mtx::client::utils::random_token(uint8_t len, bool with_symbols) noexcept
const auto chars = with_symbols ? alphanumberic + symbols : alphanumberic; const auto chars = with_symbols ? alphanumberic + symbols : alphanumberic;
boost::random::random_device rng; std::random_device rng;
boost::random::uniform_int_distribution<> index_dist(0, chars.size() - 1); std::uniform_int_distribution<> index_dist(0, chars.size() - 1);
std::string token; std::string token;
token.reserve(len); token.reserve(len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment