lcm: support java 1.8+ and python 3
Closes #44741. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
parent
d899a5bd7d
commit
9fb27ce886
1 changed files with 18 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue