tbb@2020 2020_U3 (new formula)

master
Carlo Cabrera 2021-05-20 10:09:09 +01:00
parent 08fcb8e821
commit 8241ccc72a
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0
2 changed files with 64 additions and 0 deletions

1
Aliases/tbb@2021 Symbolic link
View File

@ -0,0 +1 @@
../Formula/tbb.rb

63
Formula/tbb@2020.rb Normal file
View File

@ -0,0 +1,63 @@
class TbbAT2020 < Formula
desc "Rich and complete approach to parallelism in C++"
homepage "https://github.com/oneapi-src/oneTBB"
url "https://github.com/intel/tbb/archive/v2020.3.tar.gz"
version "2020_U3"
sha256 "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3"
license "Apache-2.0"
keg_only :versioned_formula
deprecate! date: "2020-04-02", because: :unsupported
depends_on "cmake" => :build
depends_on "swig" => :build
depends_on "python@3.9"
# Remove when upstream fix is released
# https://github.com/oneapi-src/oneTBB/pull/258
patch do
url "https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1"
sha256 "d62cb666de4010998c339cde6f41c7623a07e9fc69e498f2e149821c0c2c6dd0"
end
def install
compiler = (ENV.compiler == :clang) ? "clang" : "gcc"
system "make", "tbb_build_prefix=BUILDPREFIX", "compiler=#{compiler}"
lib.install Dir["build/BUILDPREFIX_release/*.dylib"]
# Build and install static libraries
system "make", "tbb_build_prefix=BUILDPREFIX", "compiler=#{compiler}",
"extra_inc=big_iron.inc"
lib.install Dir["build/BUILDPREFIX_release/*.a"]
include.install "include/tbb"
cd "python" do
ENV["TBBROOT"] = prefix
system Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(prefix)
end
system "cmake", *std_cmake_args,
"-DINSTALL_DIR=lib/cmake/TBB",
"-DSYSTEM_NAME=Darwin",
"-DTBB_VERSION_FILE=#{include}/tbb/tbb_stddef.h",
"-P", "cmake/tbb_config_installer.cmake"
(lib/"cmake"/"TBB").install Dir["lib/cmake/TBB/*.cmake"]
end
test do
(testpath/"test.cpp").write <<~EOS
#include <tbb/task_scheduler_init.h>
#include <iostream>
int main()
{
std::cout << tbb::task_scheduler_init::default_num_threads();
return 0;
}
EOS
system ENV.cxx, "test.cpp", "-L#{lib}", "-I#{include}", "-ltbb", "-o", "test"
system "./test"
end
end