improve boost

pull/18/head
ruki 5 years ago
parent 7d0695cb8b
commit cc943158a9
No known key found for this signature in database
GPG Key ID: 33341DF9719963FA
  1. 105
      packages/b/boost/xmake.lua

@ -15,25 +15,47 @@ package("boost")
add_deps("bzip2", "zlib") add_deps("bzip2", "zlib")
end end
local libnames = {"filesystem",
"fiber",
"coroutine",
"context",
"thread",
"regex",
"system",
"container",
"exception",
"timer",
"atomic",
"graph",
"serialization",
"random",
"wave",
"date_time",
"locale",
"iostreams"}
add_configs("multi", { description = "Enable multi-thread support.", default = true, type = "boolean"}) add_configs("multi", { description = "Enable multi-thread support.", default = true, type = "boolean"})
add_configs("filesystem", { description = "Enable filesystem library.", default = true, type = "boolean"}) for _, libname in ipairs(libnames) do
add_configs("fiber", { description = "Enable fiber library.", default = false, type = "boolean"}) add_configs(libname, { description = "Enable " .. libname .. " library.", default = (libname == "filesystem"), type = "boolean"})
add_configs("coroutine", { description = "Enable coroutine library.", default = false, type = "boolean"}) end
add_configs("context", { description = "Enable context library.", default = false, type = "boolean"})
add_configs("thread", { description = "Enable thread library.", default = false, type = "boolean"}) on_load("windows", function (package)
add_configs("regex", { description = "Enable regex library.", default = false, type = "boolean"}) local vs_runtime = package:config("vs_runtime")
add_configs("system", { description = "Enable system library.", default = false, type = "boolean"}) for _, libname in ipairs(libnames) do
add_configs("container", { description = "Enable container library.", default = false, type = "boolean"}) local linkname = "libboost_" .. libname
add_configs("exception", { description = "Enable exception library.", default = false, type = "boolean"}) if package:config("multi") then
add_configs("timer", { description = "Enable timer library.", default = false, type = "boolean"}) linkname = linkname .. "-mt"
add_configs("atomic", { description = "Enable atomic library.", default = false, type = "boolean"}) end
add_configs("graph", { description = "Enable graph library.", default = false, type = "boolean"}) if vs_runtime == "MT" then
add_configs("serialization", { description = "Enable serialization library.", default = false, type = "boolean"}) linkname = linkname .. "-s"
add_configs("random", { description = "Enable random library.", default = false, type = "boolean"}) elseif vs_runtime == "MTd" then
add_configs("wave", { description = "Enable wave library.", default = false, type = "boolean"}) linkname = linkname .. "-sgd"
add_configs("date_time", { description = "Enable date time library.", default = false, type = "boolean"}) elseif vs_runtime == "MDd" then
add_configs("locale", { description = "Enable locale library.", default = false, type = "boolean"}) linkname = linkname .. "-gd"
add_configs("iostreams", { description = "Enable iostreams library.", default = false, type = "boolean"}) end
package:add("links", linkname)
end
end)
on_install("macosx", "linux", "windows", function (package) on_install("macosx", "linux", "windows", function (package)
@ -56,45 +78,20 @@ package("boost")
"--libdir=" .. package:installdir("lib"), "--libdir=" .. package:installdir("lib"),
"--without-icu" "--without-icu"
} }
local libs_enabled = {} if is_host("windows") then
local libs_disabled = {} os.vrunv("bootstrap.bat", bootstrap_argv)
local libnames = {"filesystem",
"fiber",
"coroutine",
"context",
"thread",
"regex",
"system",
"container",
"exception",
"timer",
"atomic",
"graph",
"serialization",
"random",
"wave",
"date_time",
"locale",
"iostreams"}
for _, libname in ipairs(libnames) do
if package:config(libname) then
table.insert(libs_enabled, libname)
else else
table.insert(libs_disabled, libname) os.vrunv("./bootstrap.sh", bootstrap_argv)
end
end
if #libs_enabled > 0 then
table.insert(bootstrap_argv, "--with-libraries=" .. table.concat(libs_enabled, ","))
end
if #libs_disabled > 0 then
table.insert(bootstrap_argv, "--without-libraries=" .. table.concat(libs_disabled, ","))
end end
os.vrun("./b2 headers")
local argv = local argv =
{ {
"--prefix=" .. package:installdir(), "--prefix=" .. package:installdir(),
"--libdir=" .. package:installdir("lib"), "--libdir=" .. package:installdir("lib"),
"-d2", "-d2",
"-j4", "-j4",
"--hash",
"--layout=tagged-1.66", "--layout=tagged-1.66",
"--user-config=user-config.jam", "--user-config=user-config.jam",
"--no-cmake-config", "--no-cmake-config",
@ -118,15 +115,15 @@ package("boost")
else else
table.insert(argv, "runtime-link=shared") table.insert(argv, "runtime-link=shared")
end end
table.insert(argv, "cxxflags=-std:c++14")
else else
table.insert(argv, "cxxflags=-std=c++14") table.insert(argv, "cxxflags=-std=c++14")
end end
if is_host("windows") then for _, libname in ipairs(libnames) do
os.vrunv("bootstrap.bat", bootstrap_argv) if package:config(libname) then
else table.insert(argv, "--with-" .. libname)
os.vrunv("./bootstrap.sh", bootstrap_argv) end
end end
os.vrun("./b2 headers")
os.vrunv("./b2", argv) os.vrunv("./b2", argv)
end) end)

Loading…
Cancel
Save