class Tbb < Formula desc "Rich and complete approach to parallelism in C++" homepage "https://www.threadingbuildingblocks.org/" url "https://github.com/intel/tbb/archive/v2020.0.tar.gz" version "2020_U0" sha256 "8eed2377ac62e6ac10af5a8303ce861e4525ffe491a061b48e8fe094fc741ce9" bottle do cellar :any sha256 "c4d3405259d8440e81d912ac01720a867ded5e5f4bde53e14ea82b7ea7e4d466" => :catalina sha256 "f60db056d5f4de935893b827d0df58f8f2f47c9a631867ecb3687f40637e8449" => :mojave sha256 "f0ceef7716e50a16ad915ed00c3483a1dff3f4cb66f0e1c0d403d06833ef7834" => :high_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