diff --git a/Aliases/ignition-common5 b/Aliases/ignition-common5 deleted file mode 120000 index ffa663a75..000000000 --- a/Aliases/ignition-common5 +++ /dev/null @@ -1 +0,0 @@ -../Formula/ignition-common4.rb \ No newline at end of file diff --git a/Formula/ignition-common5.rb b/Formula/ignition-common5.rb new file mode 100644 index 000000000..39ca27a21 --- /dev/null +++ b/Formula/ignition-common5.rb @@ -0,0 +1,76 @@ +class IgnitionCommon5 < Formula + desc "Common libraries for robotics applications" + homepage "https://github.com/ignitionrobotics/ign-common" + url "https://github.com/ignitionrobotics/ign-common.git", branch: "main" + version "4.999.999~0~20211217" + license "Apache-2.0" + + depends_on "cmake" + depends_on "ffmpeg" + depends_on "freeimage" + depends_on "gts" + depends_on "ignition-cmake2" + depends_on "ignition-math6" + depends_on "ignition-utils1" + depends_on macos: :high_sierra # c++17 + depends_on "ossp-uuid" + depends_on "pkg-config" + depends_on "tinyxml2" + + def install + cmake_args = std_cmake_args + cmake_args << "-DBUILD_TESTING=Off" + cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}" + system "cmake", ".", *cmake_args + system "make", "install" + end + + test do + (testpath/"test.cpp").write <<-EOS + #include + #include + int main() { + igndbg << "debug" << std::endl; + ignwarn << "warn" << std::endl; + ignerr << "error" << std::endl; + // // this example code doesn't compile + // try { + // ignthrow("An example exception that is caught."); + // } + // catch(const ignition::common::exception &_e) { + // std::cerr << "Caught a runtime error " << _e.what() << std::endl; + // } + // ignassert(0 == 0); + return 0; + } + EOS + (testpath/"CMakeLists.txt").write <<-EOS + cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + find_package(ignition-common5 QUIET REQUIRED) + add_executable(test_cmake test.cpp) + target_link_libraries(test_cmake ${IGNITION-COMMON_LIBRARIES}) + EOS + system "pkg-config", "ignition-common5" + cflags = `pkg-config --cflags ignition-common5`.split + system ENV.cc, "test.cpp", + *cflags, + "-L#{lib}", + "-lignition-common5", + "-lc++", + "-o", "test" + system "./test" + # test building with cmake + mkdir "build" do + ENV.append "LIBRARY_PATH", Formula["gettext"].opt_lib + system "cmake", ".." + system "make" + system "./test_cmake" + end + # check for Xcode frameworks in bottle + # ! requires system with single argument, which uses standard shell + # put in variable to avoid audit complaint + # enclose / in [] so the following line won't match itself + cmd_not_grep_xcode = "! grep -rnI 'Applications[/]Xcode' #{prefix}" + system cmd_not_grep_xcode + end +end