|
@@ -1,5 +1,4 @@
|
|
|
package("boost")
|
|
|
-
|
|
|
set_homepage("https://www.boost.org/")
|
|
|
set_description("Collection of portable C++ source libraries.")
|
|
|
set_license("BSL-1.0")
|
|
@@ -42,46 +41,52 @@ package("boost")
|
|
|
end
|
|
|
|
|
|
add_configs("pyver", {description = "python version x.y, etc. 3.10", default = "3.10"})
|
|
|
- local libnames = {"fiber",
|
|
|
- "coroutine",
|
|
|
- "context",
|
|
|
- "regex",
|
|
|
- "system",
|
|
|
+ local libnames = {"atomic",
|
|
|
+ "charconv",
|
|
|
+ "chrono",
|
|
|
+ "cobalt",
|
|
|
"container",
|
|
|
+ "context",
|
|
|
+ "contract",
|
|
|
+ "coroutine",
|
|
|
+ "date_time",
|
|
|
"exception",
|
|
|
- "timer",
|
|
|
- "atomic",
|
|
|
+ "fiber",
|
|
|
+ "filesystem",
|
|
|
"graph",
|
|
|
- "serialization",
|
|
|
- "random",
|
|
|
- "wave",
|
|
|
- "date_time",
|
|
|
- "locale",
|
|
|
- "iostreams",
|
|
|
- "program_options",
|
|
|
- "test",
|
|
|
- "chrono",
|
|
|
- "contract",
|
|
|
"graph_parallel",
|
|
|
+ "headers",
|
|
|
+ "iostreams",
|
|
|
"json",
|
|
|
+ "locale",
|
|
|
"log",
|
|
|
- "thread",
|
|
|
- "filesystem",
|
|
|
"math",
|
|
|
"mpi",
|
|
|
"nowide",
|
|
|
+ "program_options",
|
|
|
"python",
|
|
|
+ "random",
|
|
|
+ "regex",
|
|
|
+ "serialization",
|
|
|
"stacktrace",
|
|
|
- "type_erasure"}
|
|
|
+ "system",
|
|
|
+ "test",
|
|
|
+ "thread",
|
|
|
+ "timer",
|
|
|
+ "type_erasure",
|
|
|
+ "url",
|
|
|
+ "wave"}
|
|
|
|
|
|
add_configs("all", { description = "Enable all library modules support.", default = false, type = "boolean"})
|
|
|
add_configs("multi", { description = "Enable multi-thread support.", default = true, type = "boolean"})
|
|
|
for _, libname in ipairs(libnames) do
|
|
|
add_configs(libname, { description = "Enable " .. libname .. " library.", default = (libname == "filesystem"), type = "boolean"})
|
|
|
end
|
|
|
+ add_configs("zstd", {description = "enable zstd for iostreams", default = false, type = "boolean"})
|
|
|
+ add_configs("lzma", {description = "enable lzma for iostreams", default = false, type = "boolean"})
|
|
|
|
|
|
on_load(function (package)
|
|
|
- function get_linkname(package, libname)
|
|
|
+ local function get_linkname(package, libname)
|
|
|
local linkname
|
|
|
if package:is_plat("windows") then
|
|
|
linkname = (package:config("shared") and "boost_" or "libboost_") .. libname
|
|
@@ -100,11 +105,11 @@ package("boost")
|
|
|
if package:debug() then
|
|
|
linkname = linkname .. "-gd"
|
|
|
end
|
|
|
+ elseif package:config("asan") or vs_runtime == "MTd" then
|
|
|
+ linkname = linkname .. "-sgd"
|
|
|
elseif vs_runtime == "MT" then
|
|
|
linkname = linkname .. "-s"
|
|
|
- elseif vs_runtime == "MTd" then
|
|
|
- linkname = linkname .. "-sgd"
|
|
|
- elseif vs_runtime == "MDd" then
|
|
|
+ elseif package:config("asan") or vs_runtime == "MDd" then
|
|
|
linkname = linkname .. "-gd"
|
|
|
end
|
|
|
else
|
|
@@ -115,20 +120,18 @@ package("boost")
|
|
|
return linkname
|
|
|
end
|
|
|
|
|
|
- if not package:is_plat("windows") then
|
|
|
- -- we need the fixed link order
|
|
|
- local sublibs = {log = {"log_setup", "log"},
|
|
|
- python = {"python", "numpy"},
|
|
|
- stacktrace = {"stacktrace_backtrace", "stacktrace_basic"}}
|
|
|
- for _, libname in ipairs(libnames) do
|
|
|
- local libs = sublibs[libname]
|
|
|
- if libs then
|
|
|
- for _, lib in ipairs(libs) do
|
|
|
- package:add("links", get_linkname(package, lib))
|
|
|
- end
|
|
|
- else
|
|
|
- package:add("links", get_linkname(package, libname))
|
|
|
+ -- we need the fixed link order
|
|
|
+ local sublibs = {log = {"log_setup", "log"},
|
|
|
+ python = {"python", "numpy"},
|
|
|
+ stacktrace = {"stacktrace_backtrace", "stacktrace_basic"}}
|
|
|
+ for _, libname in ipairs(libnames) do
|
|
|
+ local libs = sublibs[libname]
|
|
|
+ if libs then
|
|
|
+ for _, lib in ipairs(libs) do
|
|
|
+ package:add("links", get_linkname(package, lib))
|
|
|
end
|
|
|
+ else
|
|
|
+ package:add("links", get_linkname(package, libname))
|
|
|
end
|
|
|
end
|
|
|
-- disable auto-link all libs
|
|
@@ -142,12 +145,31 @@ package("boost")
|
|
|
end
|
|
|
package:add("deps", "python " .. package:config("pyver") .. ".x", {configs = {headeronly = true}})
|
|
|
end
|
|
|
+ if package:is_plat("linux") then
|
|
|
+ if package:config("zstd") then
|
|
|
+ package:add("deps", "zstd")
|
|
|
+ end
|
|
|
+ if package:config("lzma") then
|
|
|
+ package:add("deps", "xz")
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ if package:is_plat("windows") and package:version():le("1.85.0") then
|
|
|
+ local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
|
|
|
+ if vs_toolset then
|
|
|
+ local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
|
|
|
+ local minor = vs_toolset_ver:minor()
|
|
|
+ if minor and minor >= 40 then
|
|
|
+ package:add("patches", "<=1.85.0", "patches/1.85.0/fix-v144.patch", "1ba99cb2e2f03a4ba489a32596c62e1310b6c73ba4d19afa8796bcf180c84422")
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
end)
|
|
|
|
|
|
on_install("macosx", "linux", "windows", "bsd", "mingw", "cross", function (package)
|
|
|
import("core.base.option")
|
|
|
|
|
|
- function get_compiler(package, toolchain)
|
|
|
+ local function get_compiler(package, toolchain)
|
|
|
local cxx = package:build_getenv("cxx")
|
|
|
if package:is_plat("macosx") then
|
|
|
-- we uses ld/clang++ for link stdc++ for shared libraries
|
|
@@ -236,6 +258,9 @@ package("boost")
|
|
|
if package:has_tool("cxx", "clang_cl") then
|
|
|
build_toolset = "clang-win"
|
|
|
build_toolchain = package:toolchain("clang-cl")
|
|
|
+ elseif package:has_tool("cxx", "clang") then
|
|
|
+ build_toolset = "clang-win"
|
|
|
+ build_toolchain = package:toolchain("clang") or package:toolchain("llvm")
|
|
|
elseif package:has_tool("cxx", "cl") then
|
|
|
build_toolset = "msvc"
|
|
|
build_toolchain = package:toolchain("msvc")
|
|
@@ -245,9 +270,23 @@ package("boost")
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+ local function config_deppath(file, depname, rule)
|
|
|
+ local dep = package:dep(depname)
|
|
|
+ local info = dep:fetch({external = false})
|
|
|
+ if info then
|
|
|
+ local usingstr = format("\nusing %s : : <include>\"%s\" <search>\"%s\" ;",rule, info.includedirs[1], info.linkdirs[1])
|
|
|
+ file:write(usingstr)
|
|
|
+ end
|
|
|
+ end
|
|
|
local file = io.open("user-config.jam", "w")
|
|
|
if file then
|
|
|
file:write(get_compiler(package, build_toolchain))
|
|
|
+ if package:config("lzma") then
|
|
|
+ config_deppath(file, "xz", "lzma")
|
|
|
+ end
|
|
|
+ if package:config("zstd") then
|
|
|
+ config_deppath(file, "zstd", "zstd")
|
|
|
+ end
|
|
|
file:close()
|
|
|
end
|
|
|
os.vrun("./b2 headers")
|
|
@@ -263,8 +302,6 @@ package("boost")
|
|
|
"-q", -- quit on first error
|
|
|
"--layout=tagged-1.66", -- prevent -x64 suffix in case cmake can't find it
|
|
|
"--user-config=user-config.jam",
|
|
|
- "-sNO_LZMA=1",
|
|
|
- "-sNO_ZSTD=1",
|
|
|
"install",
|
|
|
"threading=" .. (package:config("multi") and "multi" or "single"),
|
|
|
"debug-symbols=" .. (package:debug() and "on" or "off"),
|
|
@@ -273,6 +310,13 @@ package("boost")
|
|
|
"runtime-debugging=" .. (package:is_debug() and "on" or "off")
|
|
|
}
|
|
|
|
|
|
+ if not package:config("lzma") then
|
|
|
+ table.insert(argv, "-sNO_LZMA=1")
|
|
|
+ end
|
|
|
+ if not package:config("zstd") then
|
|
|
+ table.insert(argv, "-sNO_ZSTD=1")
|
|
|
+ end
|
|
|
+
|
|
|
if package:config("lto") then
|
|
|
table.insert(argv, "lto=on")
|
|
|
end
|
|
@@ -355,19 +399,6 @@ package("boost")
|
|
|
if package:is_plat("linux") then
|
|
|
table.insert(argv, "pch=off")
|
|
|
end
|
|
|
-
|
|
|
- if package:is_plat("windows") and package:version():le("1.85.0") then
|
|
|
- local vs_toolset = build_toolchain:config("vs_toolset")
|
|
|
- local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
|
|
|
- local minor = vs_toolset_ver:minor()
|
|
|
- if minor and minor >= 40 then
|
|
|
- io.replace("tools/build/src/engine/config_toolset.bat", "vc143", "vc144", {plain = true})
|
|
|
- io.replace("tools/build/src/engine/build.bat", "vc143", "vc144", {plain = true})
|
|
|
- io.replace("tools/build/src/engine/guess_toolset.bat", "vc143", "vc144", {plain = true})
|
|
|
- io.replace("tools/build/src/tools/intel-win.jam", "14.3", "14.4", {plain = true})
|
|
|
- io.replace("tools/build/src/tools/msvc.jam", "14.3", "14.4", {plain = true})
|
|
|
- end
|
|
|
- end
|
|
|
local ok = os.execv("./b2", argv, {envs = runenvs, try = true, stdout = "boost-log.txt"})
|
|
|
if ok ~= 0 then
|
|
|
raise("boost build failed, please check log in " .. path.join(os.curdir(), "boost-log.txt"))
|
|
@@ -386,6 +417,14 @@ package("boost")
|
|
|
}
|
|
|
]]}, {configs = {languages = "c++14"}}))
|
|
|
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ #include <boost/unordered_map.hpp>
|
|
|
+ static void test() {
|
|
|
+ boost::unordered_map<std::string, int> map;
|
|
|
+ map["2"] = 2;
|
|
|
+ }
|
|
|
+ ]]}, {configs = {languages = "c++14"}}))
|
|
|
+
|
|
|
if package:config("date_time") then
|
|
|
assert(package:check_cxxsnippets({test = [[
|
|
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
|
@@ -394,4 +433,42 @@ package("boost")
|
|
|
}
|
|
|
]]}, {configs = {languages = "c++14"}}))
|
|
|
end
|
|
|
+
|
|
|
+ if package:config("filesystem") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ #include <boost/filesystem.hpp>
|
|
|
+ #include <iostream>
|
|
|
+ static void test() {
|
|
|
+ boost::filesystem::path path("/path/to/directory");
|
|
|
+ if (boost::filesystem::exists(path)) {
|
|
|
+ std::cout << "Directory exists" << std::endl;
|
|
|
+ } else {
|
|
|
+ std::cout << "Directory does not exist" << std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]]}, {configs = {languages = "c++14"}}))
|
|
|
+ end
|
|
|
+
|
|
|
+ if package:config("iostreams") then
|
|
|
+ if package:config("zstd") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ #include <boost/iostreams/filter/zstd.hpp>
|
|
|
+ #include <boost/iostreams/filtering_stream.hpp>
|
|
|
+ static void test() {
|
|
|
+ boost::iostreams::filtering_ostream out;
|
|
|
+ out.push(boost::iostreams::zstd_compressor());
|
|
|
+ }
|
|
|
+ ]]}, {configs = {languages = "c++14"}}))
|
|
|
+ end
|
|
|
+ if package:config("lzma") then
|
|
|
+ assert(package:check_cxxsnippets({test = [[
|
|
|
+ #include <boost/iostreams/filter/lzma.hpp>
|
|
|
+ #include <boost/iostreams/filtering_stream.hpp>
|
|
|
+ static void test() {
|
|
|
+ boost::iostreams::filtering_ostream out;
|
|
|
+ out.push(boost::iostreams::lzma_compressor());
|
|
|
+ }
|
|
|
+ ]]}, {configs = {languages = "c++14"}}))
|
|
|
+ end
|
|
|
+ end
|
|
|
end)
|