|
@@ -10,6 +10,7 @@ package("boost")
|
|
|
add_urls("https://github.com/xmake-mirror/boost/releases/download/boost-$(version).tar.bz2", {version = function (version)
|
|
|
return version .. "/boost_" .. (version:gsub("%.", "_"))
|
|
|
end})
|
|
|
+ add_versions("1.84.0", "cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454")
|
|
|
add_versions("1.83.0", "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e")
|
|
|
add_versions("1.82.0", "a6e1ab9b0860e6a2881dd7b21fe9f737a095e5f33a3a874afc6a345228597ee6")
|
|
|
add_versions("1.81.0", "71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa")
|
|
@@ -142,17 +143,7 @@ package("boost")
|
|
|
on_install("macosx", "linux", "windows", "bsd", "mingw", "cross", function (package)
|
|
|
import("core.base.option")
|
|
|
|
|
|
- -- get toolchain
|
|
|
- local toolchain
|
|
|
- if package:is_plat("windows") then
|
|
|
- toolchain = package:toolchain("clang-cl") or package:toolchain("msvc") or
|
|
|
- import("core.tool.toolchain").load("msvc", {plat = package:plat(), arch = package:arch()})
|
|
|
- end
|
|
|
-
|
|
|
- -- force boost to compile with the desired compiler
|
|
|
- local win_toolset
|
|
|
- local file = io.open("user-config.jam", "a")
|
|
|
- if file then
|
|
|
+ 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
|
|
@@ -161,11 +152,11 @@ package("boost")
|
|
|
if cc and cc:find("clang", 1, true) and cc:find("Xcode", 1, true) then
|
|
|
cc = "xcrun -sdk macosx clang++"
|
|
|
end
|
|
|
- file:print("using darwin : : %s ;", cc)
|
|
|
+ return format("using darwin : : %s ;", cc)
|
|
|
elseif package:is_plat("windows") then
|
|
|
local vs_toolset = toolchain:config("vs_toolset")
|
|
|
local msvc_ver = ""
|
|
|
- win_toolset = "msvc"
|
|
|
+ local win_toolset = "msvc"
|
|
|
if toolchain:name() == "clang-cl" then
|
|
|
win_toolset = "clang-win"
|
|
|
cxx = cxx:gsub("(clang%-cl)$", "%1.exe", 1)
|
|
@@ -177,12 +168,29 @@ package("boost")
|
|
|
|
|
|
-- Specifying a version will disable b2 from forcing tools
|
|
|
-- from the latest installed msvc version.
|
|
|
- file:print("using %s : %s : \"%s\" ;", win_toolset, msvc_ver, cxx:gsub("\\", "\\\\"))
|
|
|
+ return format("using %s : %s : \"%s\" ;", win_toolset, msvc_ver, cxx:gsub("\\", "\\\\"))
|
|
|
else
|
|
|
cxx = cxx:gsub("gcc$", "g++")
|
|
|
cxx = cxx:gsub("clang$", "clang++")
|
|
|
- file:print("using gcc : : %s ;", cxx:gsub("\\", "/"))
|
|
|
+ return format("using gcc : : %s ;", cxx:gsub("\\", "/"))
|
|
|
end
|
|
|
+ end
|
|
|
+
|
|
|
+ -- get host toolchain
|
|
|
+ import("core.tool.toolchain")
|
|
|
+ local host_toolchain
|
|
|
+ if package:is_plat("windows") then
|
|
|
+ host_toolchain = toolchain.load("msvc", {plat = "windows", arch = os.arch()})
|
|
|
+ if not host_toolchain:check() then
|
|
|
+ host_toolchain = toolchain.load("clang-cl", {plat = "windows", arch = os.arch()})
|
|
|
+ end
|
|
|
+ assert(host_toolchain:check(), "host msvc or clang-cl not found!")
|
|
|
+ end
|
|
|
+
|
|
|
+ -- force boost to compile with the desired compiler
|
|
|
+ local file = io.open("user-config.jam", "w")
|
|
|
+ if file then
|
|
|
+ file:write(get_compiler(package, host_toolchain))
|
|
|
file:close()
|
|
|
end
|
|
|
|
|
@@ -193,12 +201,10 @@ package("boost")
|
|
|
"--without-icu"
|
|
|
}
|
|
|
|
|
|
- local runenvs
|
|
|
if package:is_plat("windows") then
|
|
|
- runenvs = toolchain:runenvs()
|
|
|
-- for bootstrap.bat, all other arguments are useless
|
|
|
bootstrap_argv = { "msvc" }
|
|
|
- os.vrunv("bootstrap.bat", bootstrap_argv, {envs = runenvs})
|
|
|
+ os.vrunv("bootstrap.bat", bootstrap_argv, {envs = host_toolchain:runenvs()})
|
|
|
elseif package:is_plat("mingw") and is_host("windows") then
|
|
|
bootstrap_argv = { "gcc" }
|
|
|
os.vrunv("bootstrap.bat", bootstrap_argv)
|
|
@@ -207,6 +213,24 @@ package("boost")
|
|
|
else
|
|
|
os.vrunv("./bootstrap.sh", bootstrap_argv)
|
|
|
end
|
|
|
+
|
|
|
+ -- get build toolchain
|
|
|
+ local build_toolchain
|
|
|
+ local build_toolset
|
|
|
+ local runenvs
|
|
|
+ if package:is_plat("windows") then
|
|
|
+ build_toolchain = package:toolchain("clang-cl") or package:toolchain("msvc") or
|
|
|
+ toolchain.load("msvc", {plat = package:plat(), arch = package:arch()})
|
|
|
+ assert(build_toolchain:check(), "build toolchain not found!")
|
|
|
+ build_toolset = build_toolchain:name() == "clang-cl" and "clang-win" or "msvc"
|
|
|
+ runenvs = build_toolchain:runenvs()
|
|
|
+ end
|
|
|
+
|
|
|
+ local file = io.open("user-config.jam", "w")
|
|
|
+ if file then
|
|
|
+ file:write(get_compiler(package, build_toolchain))
|
|
|
+ file:close()
|
|
|
+ end
|
|
|
os.vrun("./b2 headers")
|
|
|
|
|
|
local njobs = option.get("jobs") or tostring(os.default_njob())
|
|
@@ -251,7 +275,7 @@ package("boost")
|
|
|
table.insert(argv, "runtime-link=shared")
|
|
|
end
|
|
|
table.insert(argv, "cxxflags=-std:c++14")
|
|
|
- table.insert(argv, "toolset=" .. win_toolset)
|
|
|
+ table.insert(argv, "toolset=" .. build_toolset)
|
|
|
elseif package:is_plat("mingw") then
|
|
|
table.insert(argv, "toolset=gcc")
|
|
|
else
|