Skip to content

Commit

Permalink
ignition-plugin2: new formula (#1540)
Browse files Browse the repository at this point in the history
Add dependency on ignition-utils1
  • Loading branch information
scpeters authored Jul 27, 2021
1 parent 8f0fa43 commit fcbba0f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
1 change: 0 additions & 1 deletion Aliases/ignition-plugin2

This file was deleted.

55 changes: 55 additions & 0 deletions Formula/ignition-plugin2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
class IgnitionPlugin2 < Formula
desc "Plugin libraries for robotics applications"
homepage "https://github.com/ignitionrobotics/ign-plugin"
url "https://github.com/ignitionrobotics/ign-plugin.git", branch: "main"
version "1.999.999~1"
license "Apache-2.0"

depends_on "cmake"
depends_on "ignition-cmake2"
depends_on "ignition-tools"
depends_on "ignition-utils1"
depends_on macos: :high_sierra # c++17
depends_on "pkg-config"

def install
cmake_args = std_cmake_args
cmake_args << "-DBUILD_TESTING=Off"
system "cmake", ".", *cmake_args
system "make", "install"
end

test do
(testpath/"test.cpp").write <<-EOS
#include <ignition/plugin/Loader.hh>
int main() {
ignition::plugin::Loader loader;
return loader.InterfacesImplemented().size();
}
EOS
(testpath/"CMakeLists.txt").write <<-EOS
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
find_package(ignition-plugin2 QUIET REQUIRED COMPONENTS loader)
add_executable(test_cmake test.cpp)
target_link_libraries(test_cmake ${IGNITION-PLUGIN_LIBRARIES})
EOS
system "pkg-config", "ignition-plugin2-loader"
cflags = `pkg-config --cflags ignition-plugin2-loader`.split
system ENV.cc, "test.cpp",
*cflags,
"-L#{lib}",
"-lignition-plugin2-loader",
"-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
end
end

0 comments on commit fcbba0f

Please sign in to comment.