From 9fb27ce88627107a1e7f5e443330246d681f9f09 Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Mon, 30 Sep 2019 14:22:46 -0400 Subject: [PATCH] lcm: support java 1.8+ and python 3 Closes #44741. Signed-off-by: FX Coudert --- Formula/lcm.rb | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Formula/lcm.rb b/Formula/lcm.rb index c852a7835d..bb8ba86196 100644 --- a/Formula/lcm.rb +++ b/Formula/lcm.rb @@ -3,6 +3,7 @@ class Lcm < Formula homepage "https://lcm-proj.github.io/" url "https://github.com/lcm-proj/lcm/releases/download/v1.4.0/lcm-1.4.0.zip" sha256 "e249d7be0b8da35df8931899c4a332231aedaeb43238741ae66dc9baf4c3d186" + revision 1 head "https://github.com/lcm-proj/lcm.git" @@ -16,13 +17,19 @@ class Lcm < Formula depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "glib" - depends_on :java => "1.8" + depends_on :java => "1.8+" + depends_on "python" def install + args = std_cmake_args + %W[ + -DLCM_ENABLE_EXAMPLES=OFF + -DLCM_ENABLE_TESTS=OFF + -DLCM_JAVA_TARGET_VERSION=8 + -DPYTHON_EXECUTABLE=#{Formula["python"].opt_bin}/python3 + ] + mkdir "build" do - system "cmake", "..", "-DCMAKE_CXX_FLAGS=-I/System/Library/Frameworks/Python.framework/Headers", - "-DLCM_ENABLE_TESTS=OFF", - *std_cmake_args + system "cmake", *args, ".." system "make" system "make", "install" end @@ -31,20 +38,20 @@ class Lcm < Formula test do (testpath/"example_t.lcm").write <<~EOS package exlcm; - - struct example_t - { + struct example_t { int64_t timestamp; double position[3]; string name; } EOS - system "#{bin}/lcm-gen", "-c", "example_t.lcm" + system bin/"lcm-gen", "-c", "example_t.lcm" assert_predicate testpath/"exlcm_example_t.h", :exist?, "lcm-gen did not generate C header file" assert_predicate testpath/"exlcm_example_t.c", :exist?, "lcm-gen did not generate C source file" - system "#{bin}/lcm-gen", "-x", "example_t.lcm" + system bin/"lcm-gen", "-x", "example_t.lcm" assert_predicate testpath/"exlcm/example_t.hpp", :exist?, "lcm-gen did not generate C++ header file" - system "#{bin}/lcm-gen", "-j", "example_t.lcm" - assert_predicate testpath/"exlcm/example_t.java", :exist?, "lcm-gen did not generate java file" + system bin/"lcm-gen", "-j", "example_t.lcm" + assert_predicate testpath/"exlcm/example_t.java", :exist?, "lcm-gen did not generate Java source file" + system bin/"lcm-gen", "-p", "example_t.lcm" + assert_predicate testpath/"exlcm/example_t.py", :exist?, "lcm-gen did not generate Python source file" end end