build.lua 2850 bytes · raw
-- Boost's own b2 build with MSVC. build_tools builds b2 for the build machine once; every slice runs it with the
-- slice's toolchain (otok.b2), for the libraries the project selects. The libraries have the names auto-linking asks
-- for (--layout=versioned, b2's default on Windows).
function build_tools(slice, options, deps)
-- bootstrap finds the build machine's compiler: by its full path, and with cmd finding the scripts it calls in the
-- current directory, which NoDefaultCurrentDirectoryInExePath turns off
local script = (slice.source .. "/bootstrap.bat"):gsub("/", "\\")
otok.run({ "cmd.exe", "/c", script }, { env = { NoDefaultCurrentDirectoryInExePath = false } })
otok.copy(slice.source .. "/b2.exe", slice.prefix .. "/bin/b2.exe")
end
-- stacktrace backends b2 builds only where it finds what they need (addr2line on macOS alone), which no
-- product offers: every slice returns the same libraries
local unoffered = { stacktrace_addr2line = true, stacktrace_dump = true, stacktrace_from_exception = true }
function build(slice, options, deps)
local selected = options.libraries
if #selected > 0 then
-- the project's C++ standard, else 20
local args = { "cxxstd=" .. (slice.cxx_standard or 20) }
for _, l in ipairs(selected) do args[#args + 1] = "--with-" .. l end
-- where WinDbg is, b2 builds stacktrace_windbg instead of stacktrace_basic: the product BoostStacktraceBasic
-- holds it, as Boost's CMake builds it
args[#args + 1] = "boost.stacktrace.basic=on"
-- ICU only when asked for: b2 would take any ICU it finds (has_icu), so it is turned off otherwise
if deps.icu4c then
args[#args + 1] = "-sICU_PATH=" .. deps.icu4c.prefix
args[#args + 1] = "boost.locale.icu=on"
else
args[#args + 1] = "boost.locale.icu=off"
args[#args + 1] = "--disable-icu"
end
otok.b2{ b2 = slice.tools.prefix .. "/bin/b2", args = args, targets = { "stage" }, env = { NoDefaultCurrentDirectoryInExePath = false } }
end
-- the headers, without b2 install copying 16000 files one by one
otok.copy(slice.source .. "/boost", slice.prefix .. "/include/boost")
-- the names auto-linking asks for: libboost_json-vc145-mt-x64-1_92.lib, boost_json-vc145-mt-x64-1_92.lib with its
-- DLL
local libraries = {}
for _, file in ipairs(otok.glob("lib/*.lib", slice.prefix)) do
local name = file:match("/l?i?b?boost_([%w_]+)%-vc[^/]*%.lib$")
if name then
local dll = file:gsub("%.lib$", ".dll")
libraries[name] = otok.exists(dll) and { link = file, runtime = dll } or file
end
end
for name in pairs(unoffered) do libraries[name] = nil end
return { libraries = libraries, headers = slice.prefix .. "/include" }
end
recipe.toml 8440 bytes · raw
# The otok recipe of Boost (docs/PLAN.md decision 36): the headers as one product, the compiled
# libraries the project selects as products of their own (recipe-toml.md 11.1).
[recipe]
api = 1
library = "boost"
name = "boost"
version = "1.92.0"
revision = 1
variant = "windows-msvc"
license = "BSL-1.0"
license-files = ["LICENSE_1_0.txt"]
homepage = "https://www.boost.org"
documentation = "https://www.boost.org/doc/libs/1_92_0/"
description = "Boost C++ libraries: the headers, and the compiled libraries a project selects."
keywords = ["boost", "cpp"]
linkage = ["static", "dynamic"]
cxx-standard = ">= 11"
[source]
url = "https://archives.boost.io/release/1.92.0/source/boost_1_92_0.tar.bz2"
mirrors = ["https://sourceforge.net/projects/boost/files/boost/1.92.0/boost_1_92_0.tar.bz2"]
sha256 = "5c1d40cb8e19adbf740a4ec2da35b3e58f3f5804b1dce44deb53df72193cbc6c"
# the resource scripts of MSVC with only the include paths of the build directory; codecvt_null in serialization alone,
# as Boost's CMake builds it
patches = ["patches/0003-msvc-rc-includes.patch", "patches/0004-serialization-codecvt-null-once.patch"]
[platforms]
supported = ["windows"]
build-on = ["windows/msvc"]
[options.libraries]
type = "list"
values = ["atomic", "charconv", "chrono", "cobalt", "container", "context", "contract", "coroutine", "date_time", "exception", "fiber", "filesystem", "graph", "iostreams", "json", "locale", "log", "math", "nowide", "process", "program_options", "random", "regex", "serialization", "stacktrace", "test", "thread", "timer", "type_erasure", "url", "wave"]
default = []
additive = true
doc = "The compiled libraries to build (b2 --with-<library>); each becomes a product. Without any, Boost is its headers."
[options.icu]
type = "bool"
default = false
doc = "ICU (the icu4c recipe) as the backend of Boost.Locale and for the Unicode support of Boost.Regex (boost/regex/icu.hpp). The products of Boost then hold ICU's libraries, which a static link takes only as far as it uses them."
[deps.icu4c]
version = ">= 70"
default-recipe = "apotocki/icu4c"
when = { option = "icu" }
[[product]]
name = "Boost"
libraries = []
link = { runtime = "c++" }
[[product]]
name = "BoostAtomic"
libraries = ["atomic"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "atomic" }
[[product]]
name = "BoostCharconv"
libraries = ["charconv"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "charconv" }
[[product]]
name = "BoostChrono"
libraries = ["chrono"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "chrono" }
[[product]]
name = "BoostCobalt"
libraries = ["cobalt", "cobalt_io", "container", "context", "date_time", "exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "cobalt" }
[[product]]
name = "BoostContainer"
libraries = ["container"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "container" }
[[product]]
name = "BoostContext"
libraries = ["context"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "context" }
[[product]]
name = "BoostContract"
libraries = ["contract", "atomic", "chrono", "container", "date_time", "exception", "thread"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "contract" }
[[product]]
name = "BoostCoroutine"
libraries = ["coroutine", "context", "exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "coroutine" }
[[product]]
name = "BoostDateTime"
libraries = ["date_time", "container", "exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "date_time" }
[[product]]
name = "BoostException"
libraries = ["exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "exception" }
[[product]]
name = "BoostFiber"
libraries = ["fiber", "context", "exception", "filesystem"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "fiber" }
[[product]]
name = "BoostFilesystem"
libraries = ["filesystem"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "filesystem" }
[[product]]
name = "BoostGraph"
libraries = ["graph", "atomic", "chrono", "container", "date_time", "exception", "math_c99", "math_c99f", "math_c99l", "math_tr1", "math_tr1f", "math_tr1l", "random", "serialization", "thread", "wserialization"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "graph" }
[[product]]
name = "BoostIostreams"
libraries = ["iostreams", "random"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "iostreams" }
[[product]]
name = "BoostJson"
libraries = ["json", "container"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "json" }
[[product]]
name = "BoostLocale"
libraries = ["locale", "atomic", "charconv", "chrono", "container", "date_time", "exception", "thread"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "locale" }
[[product]]
name = "BoostLog"
libraries = ["log", "log_setup", "atomic", "chrono", "container", "date_time", "exception", "filesystem", "serialization", "thread", "wserialization"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "log" }
[[product]]
name = "BoostMath"
libraries = ["math_c99", "math_c99f", "math_c99l", "math_tr1", "math_tr1f", "math_tr1l", "container", "random"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "math" }
[[product]]
name = "BoostNowide"
libraries = ["nowide"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "nowide" }
[[product]]
name = "BoostProcess"
libraries = ["process", "container", "context", "date_time", "exception", "filesystem"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "process" }
[[product]]
name = "BoostProgramOptions"
libraries = ["program_options", "container"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "program_options" }
[[product]]
name = "BoostRandom"
libraries = ["random"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "random" }
[[product]]
name = "BoostRegex"
libraries = ["regex"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "regex" }
[[product]]
name = "BoostSerialization"
libraries = ["serialization", "wserialization", "atomic", "chrono", "container", "date_time", "exception", "thread"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "serialization" }
[[product]]
name = "BoostStacktraceBasic"
libraries = ["stacktrace_basic"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "stacktrace" }
alternatives = "stacktrace"
[[product]]
name = "BoostStacktraceNoop"
libraries = ["stacktrace_noop"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "stacktrace" }
alternatives = "stacktrace"
[[product]]
name = "BoostUnitTestFramework"
libraries = ["unit_test_framework", "exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "test" }
alternatives = "test"
[[product]]
name = "BoostPrgExecMonitor"
libraries = ["prg_exec_monitor"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "test" }
alternatives = "test"
[[product]]
name = "BoostTestExecMonitor"
libraries = ["test_exec_monitor", "exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "test" }
alternatives = "test"
[[product]]
name = "BoostThread"
libraries = ["thread", "atomic", "chrono", "container", "date_time", "exception"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "thread" }
[[product]]
name = "BoostTimer"
libraries = ["timer"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "timer" }
[[product]]
name = "BoostTypeErasure"
libraries = ["type_erasure", "atomic", "chrono", "container", "date_time", "exception", "thread"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "type_erasure" }
[[product]]
name = "BoostUrl"
libraries = ["url"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "url" }
[[product]]
name = "BoostWave"
libraries = ["wave", "atomic", "chrono", "container", "date_time", "exception", "filesystem", "serialization", "thread", "wserialization"]
headers = false
depends = ["Boost"]
when = { option = "libraries", has = "wave" }