homebrew-core/Formula/tbb.rb
2018-09-18 12:29:16 +10:00

60 lines
2 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_U5.tar.gz"
version "2018_U5"
sha256 "c4c2896af527392496c5e01ef8579058a71b6eebbd695924cd138841c13f07be"
bottle do
sha256 "588e5c92283a734c352675c207a0e13e05d912c37a90ca8811e83f74296d94d8" => :mojave
sha256 "13dee1e36ddfbbdb4cf16da41f58e3dfb01eb93a7f194c2a70515d92e6f6f2f4" => :high_sierra
sha256 "49c638cfb12764b0dd121e0c62183bdc28282d44d5363b65d1c4d983ae58aa67" => :sierra
sha256 "862a820d1859fa1a1afd8c3528097eeb731d4e24f4253832a9e085676a81ddf1" => :el_capitan
end
depends_on "cmake" => :build
depends_on "swig" => :build
# requires malloc features first introduced in Lion
# https://github.com/Homebrew/homebrew/issues/32274
depends_on :macos => :lion
depends_on "python@2"
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 "python", *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