build.lua 2951 bytes · raw
-- Boost's CMake with clang-cl, its libraries named as b2's --layout=system names them: a program built with MSVC
-- defines BOOST_AUTO_LINK_SYSTEM for auto-linking to ask for these names (or BOOST_ALL_NO_LIB to link them itself),
-- since no toolset tag of b2 (vc145) can be the consumer's. The release archive has every library's CMakeLists.txt and
-- tools/cmake, not the superproject's CMakeLists.txt (cmake/CMakeLists.txt of this recipe) nor libs/*/include: the
-- headers are in boost/ of the root, which every compile is given. The libraries go to the stage directory, the prefix;
-- nothing is installed.
-- stacktrace backends b2 builds only where it finds what they need, 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
if deps.icu4c then error("ICU for Boost is not built with clang-cl yet") end
otok.copy(slice.recipe .. "/cmake/CMakeLists.txt", slice.source .. "/CMakeLists.txt")
otok.cmake{ defines = {
BOOST_INCLUDE_LIBRARIES = table.concat(selected, ";"),
BOOST_STAGEDIR = slice.prefix,
BOOST_SKIP_INSTALL_RULES = true,
BOOST_INSTALL_LAYOUT = "system", -- the names of b2's --layout=system, not -clangw21-mt-x64-1_92
CMAKE_C_STANDARD_INCLUDE_DIRECTORIES = slice.source,
CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES = slice.source,
BOOST_LOCALE_ENABLE_ICU = false,
BOOST_MATH_BUILD_WITH_LEGACY_FUNCTIONS = true, -- the C99 and TR1 libraries, which b2 builds
BUILD_TESTING = false,
-- Boost.Context assembled by clang-cl, in GNU syntax: its armclang sources for ARM64; for x86_64 its gas
-- sources, which cmake/CMakeLists.txt turns into clang's (LLVM has no armasm64, and llvm-ml makes absolute
-- addresses of what ml64 addresses relative to RIP, which MSVC's linker refuses)
BOOST_CONTEXT_ASSEMBLER = slice.arch == "arm64" and "armclang" or "gas",
BOOST_CONTEXT_ASM_SUFFIX = slice.arch == "arm64" and ".S" or nil,
} }
end
-- the headers
otok.copy(slice.source .. "/boost", slice.prefix .. "/include/boost")
-- boost_json.lib with boost_json.dll, or libboost_json.lib
local libraries = {}
for _, file in ipairs(otok.glob("lib/*boost_*.lib", slice.prefix)) do
local base = file:match("/(l?i?b?boost_[%w_]+)%.lib$")
if base then
local dll = otok.glob("bin/" .. base .. ".dll", slice.prefix)[1]
libraries[base:match("boost_([%w_]+)$")] = 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 8380 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-clang-cl"
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"
[platforms]
supported = ["windows"]
build-on = ["linux/clang-cl"]
# built with Boost's CMake (build.lua)
[toolchains]
cmake = { version = ">= 3.20", default-recipe = "apotocki/cmake" }
ninja = { version = ">= 1.10", default-recipe = "apotocki/ninja" }
[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" }