g2o 20201223 (new formula)
Closes #86410. Signed-off-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Signed-off-by: rui <rui@chenrui.dev> Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>master
parent
fb53f855e1
commit
c657b24cc4
|
@ -0,0 +1,58 @@
|
|||
class G2o < Formula
|
||||
desc "General framework for graph optimization"
|
||||
homepage "https://openslam-org.github.io/g2o.html"
|
||||
url "https://github.com/RainerKuemmerle/g2o/archive/refs/tags/20201223_git.tar.gz"
|
||||
version "20201223"
|
||||
sha256 "20af80edf8fd237e29bd21859b8fc734e615680e8838824e8b3f120c5f4c1672"
|
||||
license "BSD-2-Clause"
|
||||
|
||||
depends_on "cmake" => :build
|
||||
depends_on "eigen"
|
||||
|
||||
resource "testdata" do
|
||||
url "https://raw.githubusercontent.com/OpenSLAM-org/openslam_g2o/2362b9e1e9dab318625cd0af9ba314c47ba8de48/data/2d/intel/intel.g2o"
|
||||
sha256 "4d87aaf96e1e04e47c723c371386b15358c71e98c05dad16b786d585f9fd70ff"
|
||||
end
|
||||
|
||||
def install
|
||||
cmake_args = std_cmake_args + %w[-DG2O_BUILD_EXAMPLES=OFF]
|
||||
# For Intel: manually set desired SSE features to enable support for older machines.
|
||||
# See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html for supported CPU features
|
||||
if Hardware::CPU.intel?
|
||||
cmake_args << "-DDO_SSE_AUTODETECT=OFF"
|
||||
case Hardware.oldest_cpu
|
||||
when :nehalem
|
||||
cmake_args += %w[-DDISABLE_SSE4_A=ON]
|
||||
when :core2
|
||||
cmake_args += %w[-DDISABLE_SSE4_1=ON -DDISABLE_SSE4_2=ON -DDISABLE_SSE4_A=ON]
|
||||
else
|
||||
odie "Unexpected oldest supported CPU \"#{Hardware.oldest_cpu}\""
|
||||
end
|
||||
end
|
||||
|
||||
system "cmake", "-S", ".", "-B", "build", *cmake_args
|
||||
|
||||
# Avoid references to Homebrew shims
|
||||
inreplace "build/g2o/config.h", Superenv.shims_path/ENV.cxx, ENV.cxx
|
||||
|
||||
system "cmake", "--build", "build"
|
||||
system "cmake", "--install", "build"
|
||||
|
||||
(pkgshare/"examples").install "g2o/examples/simple_optimize"
|
||||
end
|
||||
|
||||
test do
|
||||
cp_r pkgshare/"examples/simple_optimize", testpath/"src"
|
||||
libs = %w[-lg2o_core -lg2o_solver_eigen -lg2o_stuff -lg2o_types_slam2d -lg2o_types_slam3d]
|
||||
cd "src" do
|
||||
system ENV.cxx, "simple_optimize.cpp",
|
||||
"-I#{opt_include}", "-I#{Formula["eigen"].opt_include}/eigen3",
|
||||
"-L#{opt_lib}", *libs, "-std=c++11", "-o", testpath/"simple_optimize"
|
||||
end
|
||||
|
||||
resource("testdata").stage do
|
||||
last_output = shell_output(testpath/"simple_optimize intel.g2o 2>&1").lines.last
|
||||
assert_match("edges= 1837", last_output)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue