add tbb and fix some packages

pull/95/head
xq114 4 years ago
parent 31664709fb
commit ae2d7c7f0e
  1. 1
      packages/b/blosc/xmake.lua
  2. 2
      packages/b/boost/xmake.lua
  3. 13
      packages/o/openexr/xmake.lua
  4. 63
      packages/t/tbb/xmake.lua

@ -7,6 +7,7 @@ package("blosc")
"https://github.com/Blosc/c-blosc")
add_versions("1.20.1", "42c4d3fcce52af9f8e2078f8f57681bfc711706a3330cb72b9b39e05ae18a413")
add_versions("1.5.0", "208ba4db0e5116421ed2fbbdf2adfa3e1d133d29a6324a0f47cf2d71f3810c92")
add_deps("cmake")
if is_plat("linux") then

@ -10,6 +10,7 @@ package("boost")
return version .. "/boost_" .. (version:gsub("%.", "_"))
end})
add_versions("1.74.0", "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1")
add_versions("1.73.0", "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402")
add_versions("1.72.0", "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722")
add_versions("1.70.0", "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778")
@ -104,7 +105,6 @@ package("boost")
"--hash",
"--layout=tagged-1.66",
"--user-config=user-config.jam",
"--no-cmake-config",
"-sNO_LZMA=1",
"-sNO_ZSTD=1",
"install",

@ -11,9 +11,16 @@ package("openexr")
add_deps("cmake")
add_deps("zlib")
add_configs("build_both", {description = "Build both static library and shared library.", default = true, type = "boolean"})
on_install("macosx", "linux", "windows", "mingw", function (package)
local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_OPENEXR_EXAMPLES=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local configs = {"-DBUILD_TESTING=OFF", "-DINSTALL_OPENEXR_EXAMPLES=OFF", "-DINSTALL_OPENEXR_DOCS=OFF", "-DOPENEXR_BUILD_UTILS=ON"}
if package:config("build_both") then
table.insert(configs, "-DOPENEXR_BUILD_BOTH_STATIC_SHARED=ON")
table.insert(configs, "-DILMBASE_BUILD_BOTH_STATIC_SHARED=ON")
else
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
end
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DPYILMBASE_ENABLE=" .. "OFF")
import("package.tools.cmake").install(package, configs)
@ -26,6 +33,6 @@ package("openexr")
void test() {
printf( OPENEXR_PACKAGE_STRING );
}
]]}, {configs = {defines = "c++14"},
]]}, {configs = {languages = "c++14"},
includes = {"OpenEXR/OpenEXRConfig.h"}}))
end)

@ -0,0 +1,63 @@
package("tbb")
set_homepage("https://software.intel.com/en-us/tbb/")
set_description("Threading Building Blocks (TBB) lets you easily write parallel C++ programs that take full advantage of multicore performance, that are portable, composable and have future-proof scalability.")
if is_plat("windows") then
-- use precompiled binary
add_urls("https://github.com/oneapi-src/oneTBB/releases/download/v$(version)/tbb-$(version)-win.zip")
add_versions("2020.3", "cda37eed5209746a79c88a658f8c1bf3782f58bd9f9f6ba0da3a16624a9bfaa1")
else
add_urls("https://github.com/oneapi-src/oneTBB/archive/v$(version).tar.gz")
add_versions("2020.3", "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3")
if is_host("macosx") then
add_configs("compiler", {description = "Compiler used to compile tbb." , default = "clang", type = "string", values = {"clang", "gcc", "icc", "cl", "icl", "[others]"}})
else
add_configs("compiler", {description = "Compiler used to compile tbb." , default = "gcc", type = "string", values = {"gcc", "clang", "icc", "cl", "icl", "[others]"}})
end
end
on_install("macosx", "linux", "mingw@windows", function (package)
local configs = {"-j4", "tbb_build_prefix=build_dir"}
local cfg = package:debug() and "debug" or "release"
table.insert(configs, "cfg=" .. cfg)
table.insert(configs, "arch=" .. (package:is_arch("x86_64") and "intel64" or "ia32"))
table.insert(configs, "compiler=" .. (package:config("compiler")))
if package:is_plat("mingw") then
os.vrunv("mingw32-make", configs)
else
os.vrunv("make", configs)
end
os.cp("include", package:installdir())
os.cp("build/build_dir_" .. cfg .. "/**", package:installdir("lib"))
package:add("links", "tbb", "tbbmalloc")
end)
on_install("windows", function (package)
os.cp("tbb/include", package:installdir())
if package:is_arch("x64", "x86_64") then
os.cp("tbb/lib/intel64/vc14/**", package:installdir("lib"))
os.cp("tbb/bin/intel64/vc14/**", package:installdir("bin"))
else
os.cp("tbb/lib/ia32/vc14/**", package:installdir("lib"))
os.cp("tbb/bin/ia32/vc14/**", package:installdir("bin"))
end
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
using std::size_t;
constexpr size_t N = 10;
int X[N], Y[N], Z[N];
for (int i = 0; i < N; ++i)
X[i] = i, Y[i] = 2*i;
tbb::parallel_for(tbb::blocked_range<size_t>(0, N), [&](const tbb::blocked_range<size_t> &rg) {
for (size_t i = rg.begin(); i != rg.end(); ++i)
Z[i] = X[i] + Y[i];
});
}
]]}, {configs = {languages = "c++14"},
includes = {"tbb/parallel_for.h", "tbb/blocked_range.h"}}))
end)
Loading…
Cancel
Save