homebrew-core/Formula/tbb.rb
2018-04-09 00:42:29 -07:00

49 lines
1.5 KiB
Ruby

class Tbb < Formula
desc "Rich and complete approach to parallelism in C++"
homepage "https://www.threadingbuildingblocks.org/"
url "https://github.com/01org/tbb/archive/2018_U3.tar.gz"
version "2018_U3"
sha256 "23793c8645480148e9559df96b386b780f92194c80120acce79fcdaae0d81f45"
revision 1
bottle do
sha256 "8cbd67c35cacf110d90157d970845b881ae80be2d1c2f5c6498e83dd7c47c620" => :high_sierra
sha256 "3a12b35651d80de3db0c34d68d6f9e55d4cdf4315060d0deb2a9c1475edad177" => :sierra
sha256 "263e771e491b8b012e82d8f9072df83bf5cdf30d395ed07ca8490532c34abc3c" => :el_capitan
end
# requires malloc features first introduced in Lion
# https://github.com/Homebrew/homebrew/issues/32274
depends_on :macos => :lion
depends_on "python@2"
depends_on "swig" => :build
def install
compiler = (ENV.compiler == :clang) ? "clang" : "gcc"
args = %W[tbb_build_prefix=BUILDPREFIX compiler=#{compiler}]
system "make", *args
lib.install Dir["build/BUILDPREFIX_release/*.dylib"]
include.install "include/tbb"
cd "python" do
ENV["TBBROOT"] = prefix
system "python", *Language::Python.setup_install_args(prefix)
end
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}", "-ltbb", "-o", "test"
system "./test"
end
end