Skip to content

Commit 75c1143

Browse files
mszabo-wikiafacebook-github-bot
authored andcommitted
Update and fix bundled boost build (facebook#9574)
Summary: Since Boost is a C++ library dependency, we should force building its bundled version when building against libc++. Take this opportunity to update to a more recent Boost version, and use B2 options[1] to set the C++ version and toolchain from the superproject. Remove an outdated macOS patch that no longer applies. Add the chrono and date_time components to the list of components to build as they're needed by mvfst. Split from facebook#9564. [1] https://www.boost.org/doc/libs/1_87_0/tools/build/doc/html/index.html Pull Request resolved: facebook#9574 Reviewed By: Wilfred Differential Revision: D67959735 fbshipit-source-id: 35c538f3c5b979a906f26bbe693d23d086a45419
1 parent 22baa54 commit 75c1143

File tree

3 files changed

+14
-39
lines changed

3 files changed

+14
-39
lines changed

third-party/boost/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
option(FORCE_BUNDLED_BOOST "Always build boost, instead of using system version" OFF)
33
set(
44
BOOST_COMPONENTS
5+
chrono
56
context
7+
date_time
68
fiber
79
filesystem
810
iostreams
@@ -11,7 +13,7 @@ set(
1113
system
1214
thread
1315
)
14-
if(FORCE_BUNDLED_BOOST)
16+
if(FORCE_BUNDLED_BOOST OR CLANG_FORCE_LIBCPP)
1517
set(Boost_FOUND false)
1618
else()
1719
find_package(Boost 1.69.0 COMPONENTS ${BOOST_COMPONENTS})

third-party/boost/b3a59d265929a213f02a451bb6-macos-coalesce-template.patch

Lines changed: 0 additions & 31 deletions
This file was deleted.

third-party/boost/bundled_boost.cmake

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
include(ExternalProject)
1+
include(ExternalProject)
22
include(HPHPFunctions)
33
# We usually use SHA512, but given the SHA256 is on the boost.org download
44
# page, use that for transparency/ease of confirmation.
55
SET_HHVM_THIRD_PARTY_SOURCE_ARGS(
66
BOOST_DOWNLOAD_ARGS
77
SOURCE_URL
8-
"https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2"
8+
"https://archives.boost.io/release/1.83.0/source/boost_1_83_0.tar.gz"
99
SOURCE_HASH
10-
"SHA256=4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402"
10+
"SHA256=c0685b68dd44cc46574cce86c4e17c0f611b15e195be9848dfd0769a0a207628"
1111
)
1212
set(
1313
COMMON_ARGS
1414
--prefix=<INSTALL_DIR>
1515
--libdir=<INSTALL_DIR>/lib
1616
)
17+
1718
set(
1819
B2_ARGS
1920
${COMMON_ARGS}
@@ -22,9 +23,13 @@ set(
2223
variant=release
2324
threading=multi
2425
runtime-link=static
25-
cxxflags=-std=gnu++14
26+
cxxstd=${CMAKE_CXX_STANDARD}
2627
)
2728

29+
if (CLANG_FORCE_LIBCPP)
30+
list(APPEND B2_ARGS toolset=clang stdlib=libc++)
31+
endif()
32+
2833
string(REPLACE ";" "," BOOST_COMPONENTS_CSV "${BOOST_COMPONENTS}")
2934
# We pass --with-libraires to bootstrap.sh, but that does not consistently
3035
# affect b2
@@ -36,12 +41,11 @@ if (APPLE)
3641
set(BOOST_CXX_FLAGS "-isysroot${CMAKE_OSX_SYSROOT}")
3742
endif()
3843

39-
ExternalProject_Add(
44+
ExternalProject_Add(
4045
bundled_boost
4146
${BOOST_DOWNLOAD_ARGS}
42-
PATCH_COMMAND
43-
cd tools/build && patch -p1 < "${CMAKE_CURRENT_SOURCE_DIR}/b3a59d265929a213f02a451bb6-macos-coalesce-template.patch"
4447
CONFIGURE_COMMAND
48+
${CMAKE_COMMAND} -E env
4549
CXX=${CMAKE_CXX_COMPILER}
4650
CXXFLAGS=${BOOST_CXX_FLAGS}
4751
NO_CXX11_CHECK=true # we have c++17 (at least), and the check ignores CXXFLAGS, including `-isysroot` on macos

0 commit comments

Comments
 (0)