Improve support for prebuilt boost

This commit is contained in:
Russell Sears 2023-02-10 20:33:07 +00:00 committed by Aaron Molitor
parent d02118db67
commit bcc05b1058
9 changed files with 51 additions and 1 deletions

View File

@ -154,7 +154,20 @@ endif()
find_package(Boost 1.78.0 EXACT QUIET COMPONENTS context filesystem iostreams serialization system CONFIG PATHS ${BOOST_HINT_PATHS})
set(FORCE_BOOST_BUILD OFF CACHE BOOL "Forces cmake to build boost and ignores any installed boost")
if(Boost_FOUND AND Boost_filesystem_FOUND AND Boost_context_FOUND AND Boost_iostreams_FOUND AND Boost_system_FOUND AND Boost_serialization_FOUND AND NOT FORCE_BOOST_BUILD)
# The precompiled boost silently broke in CI. While investigating, I considered extending
# the old check with something like this, so that it would fail loudly if it found a bad
# pre-existing boost. It turns out the error messages we get from CMake explain what is
# wrong with Boost. Rather than reimplementing that, I just deleted this logic. This
# approach is simpler, has better ergonomics and should be easier to maintain. If the build
# is picking up your locally installed or partial version of boost, and you don't want
# to / cannot fix it, pass in -DFORCE_BOOST_BUILD=on as a workaround.
#
# if(Boost_FOUND AND Boost_filesystem_FOUND AND Boost_context_FOUND AND Boost_iostreams_FOUND AND Boost_system_FOUND AND Boost_serialization_FOUND AND NOT FORCE_BOOST_BUILD)
# ...
# elseif(Boost_FOUND AND NOT FORCE_BOOST_BUILD)
# message(FATAL_ERROR "Unacceptable precompiled boost found")
#
if(Boost_FOUND AND NOT FORCE_BOOST_BUILD)
add_library(boost_target INTERFACE)
target_link_libraries(boost_target INTERFACE Boost::boost Boost::context Boost::filesystem Boost::iostreams Boost::serialization Boost::system)
elseif(WIN32)

View File

@ -24,8 +24,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include "boost/asio.hpp"
#include "flow/ThreadHelper.actor.h"

View File

@ -24,8 +24,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include "boost/asio.hpp"
#include "fdbclient/CoordinationInterface.h"

View File

@ -25,8 +25,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include <boost/asio.hpp>
#define FILESYSTEM_IMPL 1

View File

@ -21,8 +21,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include <boost/asio.hpp>
#include <boost/range.hpp>
#include <thread>

View File

@ -30,8 +30,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include "fdbrpc/SimExternalConnection.h"
#include "flow/ActorCollection.h"
#include "flow/IRandom.h"

View File

@ -22,8 +22,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include <boost/process.hpp>
#endif
#include <boost/algorithm/string.hpp>

View File

@ -21,11 +21,20 @@
#include "flow/IThreadPool.h"
#include <algorithm>
// The ifndef's allow us to compile with pre-built boost. Otherwise, we get
// errors about double-defines. As of this writing, the automatically downloaded
// build of boost doesn't define these, but the pre-built version does. (The old
// prebuilt version was being silently ignored by cmake, so it's unclear when the
// compatibility divergence started)
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include "boost/asio.hpp"
class ThreadPool final : public IThreadPool, public ReferenceCounted<ThreadPool> {

View File

@ -29,8 +29,12 @@
#ifndef BOOST_SYSTEM_NO_LIB
#define BOOST_SYSTEM_NO_LIB
#endif
#ifndef BOOST_DATE_TIME_NO_LIB
#define BOOST_DATE_TIME_NO_LIB
#endif
#ifndef BOOST_REGEX_NO_LIB
#define BOOST_REGEX_NO_LIB
#endif
#include <boost/asio.hpp>
#if defined(HAVE_WOLFSSL)
#include <wolfssl/options.h>