class Tbb < Formula desc "Rich and complete approach to parallelism in C++" homepage "https://www.threadingbuildingblocks.org/" url "https://github.com/intel/tbb/archive/2019_U9.tar.gz" version "2019_U9" sha256 "15652f5328cf00c576f065e5cd3eaf3317422fe82afb67a9bcec0dc065bd2abe" bottle do cellar :any sha256 "9930012416851dbb157a1abce3a59f26c218619a017f99200bfbc2e370624933" => :catalina sha256 "bec3f4a74f11597bd96a0c3c1fa42613520b24520df2d97aab1c88104262ea9f" => :mojave sha256 "aa922d1192175b983a9c7ba84b5131afd5a7426775e52e4d64521f5f14e2dce9" => :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