diff --git a/Formula/gazebo11.rb b/Formula/gazebo11.rb index 5786e87e5..5242d2c34 100644 --- a/Formula/gazebo11.rb +++ b/Formula/gazebo11.rb @@ -10,8 +10,9 @@ class Gazebo11 < Formula bottle do root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation" - sha256 catalina: "5bbfbeb2e99dda5122afcf59a0bf8f3e24c6a537cb6782979398b113756b3ccc" - sha256 mojave: "8dc183974fb0e1fd2d6ec6f25b6a026c3fb41fd6b4faa6552a30f1091d6dc7f8" + rebuild 1 + sha256 catalina: "97274fc4d3f12f9349bb547c324eb2eb847575b7de00ee3da4a509577e7c0962" + sha256 mojave: "174639fafbd99b3ba4f4cb78358dabfe83bb1e7e257371cd57fe5507c5a447b5" end depends_on "cmake" => :build @@ -34,7 +35,7 @@ class Gazebo11 < Formula depends_on "qt@5" depends_on "qwt" depends_on "sdformat9" - depends_on "tbb@2020" + depends_on "tbb@2020_u3" depends_on "tinyxml" depends_on "tinyxml2" depends_on "zeromq" => :linked @@ -107,7 +108,7 @@ def install # "-lc++", # "-o", "test" # system "./test" - ENV.append_path "CPATH", Formula["tbb@2020"].opt_include + ENV.append_path "CPATH", Formula["tbb@2020_u3"].opt_include mkdir "build" do system "cmake", ".." system "make" diff --git a/Formula/tbb@2020_u3.rb b/Formula/tbb@2020_u3.rb new file mode 100644 index 000000000..8ffa18444 --- /dev/null +++ b/Formula/tbb@2020_u3.rb @@ -0,0 +1,67 @@ +class TbbAT2020U3 < Formula + desc "Rich and complete approach to parallelism in C++" + homepage "https://github.com/oneapi-src/oneTBB" + url "https://github.com/intel/tbb/archive/v2020.3.tar.gz" + version "2020_U3" + sha256 "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3" + license "Apache-2.0" + + bottle do + root_url "https://osrf-distributions.s3.amazonaws.com/bottles-simulation" + sha256 cellar: :any, catalina: "5b00ca36736e556f648841582f3af90d0f6f325169c986952b9681d408b794e3" + sha256 cellar: :any, mojave: "1824b4a41adf38fce835e0f69fe6425eeefc41e9c0ecfa230677a7ea920c2fba" + end + + keg_only :versioned_formula + + depends_on "cmake" => :build + depends_on "swig" => :build + depends_on "python@3.9" + + # Remove when upstream fix is released + # https://github.com/oneapi-src/oneTBB/pull/258 + patch do + url "https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1" + sha256 "d62cb666de4010998c339cde6f41c7623a07e9fc69e498f2e149821c0c2c6dd0" + end + + 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 Formula["python@3.9"].opt_bin/"python3", *Language::Python.setup_install_args(prefix) + end + + system "cmake", *std_cmake_args, + "-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}", "-I#{include}", "-ltbb", "-o", "test" + system "./test" + end +end