Improve platform detection and reduce includes:

The existing platform detection code was derived from the old Beast
library, which was, itself, derived from JUCE.

This commit removes that code and replaces it with the Boost.Predef
library which defines a consistent set of compiler, architecture,
operating system, library, and other version numbers.

For more on Boost.Predef, please see the Boost documentation. The
documentation for the current version as of this writing is at:
https://www.boost.org/doc/libs/1_71_0/doc/html/predef.html
This commit is contained in:
Nik Bougalis
2019-12-02 02:15:44 -08:00
parent 4a1148eb28
commit 63503ee8f0
44 changed files with 120 additions and 1058 deletions

View File

@@ -37,10 +37,7 @@
#include <ripple/beast/clock/basic_seconds_clock.h>
#include <ripple/beast/core/CurrentThreadName.h>
#include <beast/unit_test/dstream.hpp>
#include <beast/unit_test/global_suites.hpp>
#include <beast/unit_test/match.hpp>
#include <beast/unit_test/reporter.hpp>
#include <test/unit_test/multi_runner.h>
#include <google/protobuf/stubs/common.h>
@@ -48,19 +45,31 @@
#include <boost/filesystem.hpp>
#include <boost/process.hpp>
#include <boost/program_options.hpp>
#include <boost/system/error_code.hpp>
#include <boost/version.hpp>
#include <boost/predef.h>
#include <cstdlib>
#include <iostream>
#include <utility>
#include <stdexcept>
#ifdef _MSC_VER
#if BOOST_OS_WINDOWS
#include <sys/types.h>
#include <sys/timeb.h>
#endif
// Do we know the plaform we're compiling on? If you're adding new platforms
// modify this check accordingly.
#if !BOOST_OS_LINUX && !BOOST_OS_WINDOWS && !BOOST_OS_MACOS
#error Supported platforms are: Linux, Windows and MacOS
#endif
// Ensure that precisely one platform is detected.
#if (BOOST_OS_LINUX && (BOOST_OS_WINDOWS || BOOST_OS_MACOS)) || \
(BOOST_OS_MACOS && (BOOST_OS_WINDOWS || BOOST_OS_LINUX)) || \
(BOOST_OS_WINDOWS && (BOOST_OS_LINUX || BOOST_OS_MACOS))
#error Multiple supported platforms appear active at once
#endif
namespace po = boost::program_options;
namespace ripple {
@@ -727,7 +736,7 @@ int run (int argc, char** argv)
//
int main (int argc, char** argv)
{
#ifdef _MSC_VER
#if BOOST_OS_WINDOWS
{
// Work around for https://svn.boost.org/trac/boost/ticket/10657
// Reported against boost version 1.56.0. If an application's