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" revision 1 bottle do cellar :any sha256 "e46dedc9910976bc00022a64376111ad81fc7886168b1dc543fd11f5d80c17d0" => :mojave sha256 "836ea9d1e9d39346c3aead8ca1d0b431d6b3ed6a61ff6b42a14510fc7ca4f37d" => :high_sierra sha256 "bbcc0ffb360b670793c0beb89e4572c1f3ddeb3ed100d42d5de3cba86c23eed8" => :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", "-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 #include 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