homebrew-core/Formula/tbb.rb
2019-03-26 14:12:15 +01:00

57 lines
1.8 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/2019_U5.tar.gz"
version "2019_U5"
sha256 "2ea82d74dec50e18075b4982b8d360f8bd2bf2950f38e2db483aef82e0047444"
bottle do
cellar :any
sha256 "dddaece3fa2a6f9956cfc960904bc783e8d514ee2062efa235896c920011d8eb" => :mojave
sha256 "ff7652fd64198f0ad020c417b337efbc91a37e0f566f56a8ef237363e19dc338" => :high_sierra
sha256 "42fe13b9961e7560bac489d4c4ed7b3e79ef6aba54d1d851fe851776e42a933c" => :sierra
end
depends_on "cmake" => :build
depends_on "swig" => :build
depends_on "python"
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 "python3", *Language::Python.setup_install_args(prefix)
end
system "cmake", "-DTBB_ROOT=#{prefix}",
"-DTBB_OS=Darwin",
"-DSAVE_TO=lib/cmake/TBB",
"-P", "cmake/tbb_config_generator.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}", "-ltbb", "-o", "test"
system "./test"
end
end