Skip to content

Commit

Permalink
gz-math8: new formula for ionic (#2452)
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
  • Loading branch information
azeey and scpeters authored Oct 13, 2023
1 parent ff24f85 commit 7964c3c
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/gz-math8

This file was deleted.

71 changes: 71 additions & 0 deletions Formula/gz-math8.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
class GzMath8 < Formula
desc "Math API for robotic applications"
homepage "https://gazebosim.org"
url "https://github.com/gazebosim/gz-math.git", branch: "main"
version "7.999.999-0-20231006"
license "Apache-2.0"

head "https://github.com/gazebosim/gz-math.git", branch: "gz-math8"

depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "pybind11" => :build
depends_on "eigen"
depends_on "gz-cmake4"
depends_on "gz-utils3"
depends_on "[email protected]"
depends_on "ruby"

def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=OFF"
cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"

# Use build folder
mkdir "build" do
system "cmake", "..", *cmake_args
system "make", "install"
end

(lib/"python3.11/site-packages").install Dir[lib/"python/*"]
rmdir prefix/"lib/python"
end

test do
(testpath/"test.cpp").write <<-EOS
#include "gz/math/SignalStats.hh"
int main() {
gz::math::SignalMean mean;
mean.InsertData(1.0);
mean.InsertData(-1.0);
return static_cast<int>(mean.Value());
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(gz-math8 QUIET REQUIRED)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake gz-math8::gz-math8)
EOS
# test building with manual compiler flags
system ENV.cc, "test.cpp",
"--std=c++14",
"-I#{include}/gz/math8",
"-L#{lib}",
"-lgz-math8",
"-lc++",
"-o", "test"
system "./test"
# test building with cmake
mkdir "build" do
system "cmake", ".."
system "make"
system "./test_cmake"
end
# check for Xcode frameworks in bottle
cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}"
system cmd_not_grep_xcode
# check python import
system Formula["[email protected]"].opt_bin/"python3.11", "-c", "import gz.math8"
end
end

0 comments on commit 7964c3c

Please sign in to comment.