mirror of
https://github.com/monero-project/monero.git
synced 2024-12-04 23:51:08 +02:00
Compare commits
6 Commits
8b3dbb3920
...
af55d5b6c8
Author | SHA1 | Date | |
---|---|---|---|
|
af55d5b6c8 | ||
|
893916ad09 | ||
|
7df0d9bb8f | ||
|
170844bc59 | ||
|
89ad8ac8b1 | ||
|
c51ca53daa |
@ -1085,33 +1085,41 @@ if(STATIC)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
endif()
|
||||
|
||||
set(BOOST_COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
|
||||
if (WIN32)
|
||||
list(APPEND BOOST_COMPONENTS locale)
|
||||
# Find Boost headers
|
||||
set(BOOST_MIN_VER 1.62)
|
||||
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED)
|
||||
|
||||
if(NOT Boost_FOUND)
|
||||
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=${BOOST_MIN_VER}) or the equivalent")
|
||||
elseif(Boost_FOUND)
|
||||
message(STATUS "Found Boost Version: ${Boost_VERSION_STRING}")
|
||||
|
||||
set(BOOST_COMPONENTS filesystem thread date_time chrono serialization program_options)
|
||||
if (WIN32)
|
||||
list(APPEND BOOST_COMPONENTS locale)
|
||||
endif()
|
||||
|
||||
# Boost System is header-only since 1.69
|
||||
if (Boost_VERSION_STRING VERSION_LESS 1.69.0)
|
||||
list(APPEND BOOST_COMPONENTS system)
|
||||
endif()
|
||||
|
||||
# Boost Regex is header-only since 1.77
|
||||
if (Boost_VERSION_STRING VERSION_LESS 1.77.0)
|
||||
list(APPEND BOOST_COMPONENTS regex)
|
||||
endif()
|
||||
|
||||
message(STATUS "Boost components: ${BOOST_COMPONENTS}")
|
||||
|
||||
# Find required Boost libraries
|
||||
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
|
||||
endif()
|
||||
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
|
||||
add_definitions(-DBOOST_NO_AUTO_PTR)
|
||||
add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
|
||||
if(NOT Boost_FOUND)
|
||||
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=1.58) or the equivalent")
|
||||
elseif(Boost_FOUND)
|
||||
message(STATUS "Found Boost Version: ${Boost_VERSION}")
|
||||
if (Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 1.62.0 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
|
||||
set(BOOST_BEFORE_1_62 true)
|
||||
endif()
|
||||
if (NOT Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 106200 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
|
||||
set(BOOST_BEFORE_1_62 true)
|
||||
endif()
|
||||
if (BOOST_BEFORE_1_62)
|
||||
message(FATAL_ERROR "Boost ${Boost_VERSION} (older than 1.62) is too old to link with OpenSSL ${OPENSSL_VERSION} (1.1 or newer) found at ${OPENSSL_INCLUDE_DIR} and ${OPENSSL_LIBRARIES}. "
|
||||
"Update Boost or install OpenSSL 1.0 and set path to it when running cmake: "
|
||||
"cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0'")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
if(MINGW)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
|
||||
|
@ -167,7 +167,7 @@ library archives (`.a`).
|
||||
| GCC | 7 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
|
||||
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
|
||||
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
|
||||
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
|
||||
| Boost | 1.62 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
|
||||
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | `openssl-devel` | NO | sha256 sum |
|
||||
| libzmq | 4.2.0 | NO | `libzmq3-dev` | `zeromq` | `zeromq-devel` | `zeromq-devel` | NO | ZeroMQ library |
|
||||
| OpenPGM | ? | NO | `libpgm-dev` | `libpgm` | | `openpgm-devel` | NO | For ZeroMQ |
|
||||
|
@ -178,13 +178,18 @@ namespace string_tools
|
||||
|
||||
std::string get_extension(const std::string& str)
|
||||
{
|
||||
return boost::filesystem::path(str).extension().string();
|
||||
std::string ext_with_dot = boost::filesystem::path(str).extension().string();
|
||||
|
||||
if (ext_with_dot.empty())
|
||||
return {};
|
||||
|
||||
return ext_with_dot.erase(0, 1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::string cut_off_extension(const std::string& str)
|
||||
{
|
||||
return boost::filesystem::path(str).stem().string();
|
||||
return boost::filesystem::path(str).replace_extension("").string();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -1443,6 +1443,21 @@ TEST(StringTools, GetIpInt32)
|
||||
EXPECT_EQ(htonl(0xff0aff00), ip);
|
||||
}
|
||||
|
||||
TEST(StringTools, GetExtension)
|
||||
{
|
||||
EXPECT_EQ(std::string{}, epee::string_tools::get_extension(""));
|
||||
EXPECT_EQ(std::string{}, epee::string_tools::get_extension("."));
|
||||
EXPECT_EQ(std::string{"keys"}, epee::string_tools::get_extension("wallet.keys"));
|
||||
EXPECT_EQ(std::string{"3"}, epee::string_tools::get_extension("1.2.3"));
|
||||
}
|
||||
|
||||
TEST(StringTools, CutOffExtension)
|
||||
{
|
||||
EXPECT_EQ(std::string{}, epee::string_tools::cut_off_extension(""));
|
||||
EXPECT_EQ(std::string{"/home/user/Monero/wallets/wallet"}, epee::string_tools::cut_off_extension("/home/user/Monero/wallets/wallet"));
|
||||
EXPECT_EQ(std::string{"/home/user/Monero/wallets/wallet"}, epee::string_tools::cut_off_extension("/home/user/Monero/wallets/wallet.keys"));
|
||||
}
|
||||
|
||||
TEST(NetUtils, IPv4NetworkAddress)
|
||||
{
|
||||
static_assert(epee::net_utils::ipv4_network_address::get_type_id() == epee::net_utils::address_type::ipv4, "bad ipv4 type id");
|
||||
|
Loading…
Reference in New Issue
Block a user