0742deb8f7
Closes #34016. Signed-off-by: Chongyu Zhu <i@lembacon.com>
59 lines
1.9 KiB
Ruby
59 lines
1.9 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_U2.tar.gz"
|
|
version "2019_U2"
|
|
sha256 "1245aa394a92099e23ce2f60cdd50c90eb3ddcd61d86cae010ef2f1de61f32d9"
|
|
|
|
bottle do
|
|
sha256 "a92867be6b1ee35021ffc422f66619120b5845fb88ce81b85ddac05103eefc95" => :mojave
|
|
sha256 "7c7380d72361572d1f0029600d848f2a3e3bd30350f8ebb0b0e376b1e9de2e48" => :high_sierra
|
|
sha256 "1b4fb31cf94be94a8dc4745445eda05a629d4b6b0e773f9415f3c40cd7258a14" => :sierra
|
|
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
|