diff --git a/Formula/registration-toolkit.rb b/Formula/registration-toolkit.rb new file mode 100644 index 0000000..3c62321 --- /dev/null +++ b/Formula/registration-toolkit.rb @@ -0,0 +1,69 @@ +class RegistrationToolkit < Formula + desc "C++ utilities for image-to-image and image-to-mesh registration" + homepage "https://github.com/educelab/registration-toolkit" + url "https://github.com/educelab/registration-toolkit/archive/refs/tags/v1.8.0.tar.gz" + sha256 "e45e139d26b0f286e40af688f949337db8de4d44af6da3b6536a82ccf270994c" + license "GPL-3.0-or-later" + head "https://github.com/educelab/registration-toolkit.git", branch: "develop" + + depends_on "cmake" => :build + depends_on "boost" + depends_on "eigen" + depends_on "fmt" + depends_on "itk" + depends_on "libtiff" + depends_on "opencv" + depends_on "spdlog" + depends_on "vtk" + + # Upstream's CMake uses FetchContent for these transitive deps, each pinned + # to the commit listed in cmake/Build*.cmake. Homebrew traps live + # FetchContent calls, so we vendor them as resources and point the build at + # the pre-staged sources via FETCHCONTENT_SOURCE_DIR_. + # + # Use git URLs with explicit revisions: GitHub/GitLab autogenerated tag + # tarballs are not byte-stable enough for sha256 pinning. Commit SHAs are. + + resource "smgl" do + url "https://gitlab.com/educelab/smgl.git", + revision: "d74d76d121a18afab9b12dd9dc3d643f4e620ff1" + end + + resource "bvh" do + url "https://github.com/madmann91/bvh.git", + revision: "66e445b92f68801a6dd8ef943fe3038976ecb4ff" + end + + resource "libcore" do + url "https://github.com/educelab/libcore.git", + revision: "43666d4918a484e7e950fff7607865f78ff4b621" + end + + resource "OpenABF" do + url "https://github.com/educelab/OpenABF.git", + revision: "3c1b52a02a15007d3dcb7746b08a4f3db0e7a0b6" + end + + def install + resource("smgl").stage(buildpath/"_deps/smgl") + resource("bvh").stage(buildpath/"_deps/bvh") + resource("libcore").stage(buildpath/"_deps/libcore") + resource("OpenABF").stage(buildpath/"_deps/OpenABF") + + system "cmake", "-S", ".", "-B", "build", + "-DRT_BUILD_DOCS=OFF", + "-DRT_BUILD_TESTS=OFF", + "-DFETCHCONTENT_FULLY_DISCONNECTED=ON", + "-DFETCHCONTENT_SOURCE_DIR_SMGL=#{buildpath}/_deps/smgl", + "-DFETCHCONTENT_SOURCE_DIR_BVH=#{buildpath}/_deps/bvh", + "-DFETCHCONTENT_SOURCE_DIR_LIBCORE=#{buildpath}/_deps/libcore", + "-DFETCHCONTENT_SOURCE_DIR_OPENABF=#{buildpath}/_deps/OpenABF", + *std_cmake_args + system "cmake", "--build", "build" + system "cmake", "--install", "build" + end + + test do + assert_match "--log-level", shell_output("#{bin}/rt_register --help 2>&1") + end +end