Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ruby and python from ign-math6 #5

Merged
merged 4 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bionic/debian/tests
1 change: 1 addition & 0 deletions debian/buster/debian/python3-ignition-math7.install
1 change: 1 addition & 0 deletions debian/buster/debian/ruby-ignition-math7.install
1 change: 1 addition & 0 deletions debian/buster/tests
1 change: 1 addition & 0 deletions focal/debian/python3-ignition-math7.install
1 change: 1 addition & 0 deletions focal/debian/ruby-ignition-math7.install
1 change: 1 addition & 0 deletions focal/debian/tests
80 changes: 78 additions & 2 deletions ubuntu/debian/control
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
Source: ignition-math7
Standards-Version: 3.9.4
Standards-Version: 4.5.1
Maintainer: Jose Luis Rivero <jrivero@osrfoundation.org>
Section: science
Priority: extra
Build-Depends: cmake,
debhelper (>= 11),
dh-python,
doxygen,
libeigen3-dev,
libignition-cmake2-dev,
libignition-cmake2-dev (>= 2.8.0) | libignition-cmake-dev (>= 2.8.0),
libignition-utils1-dev,
python3,
python3-dev,
python3-distutils,
python3-pybind11,
ruby-dev,
ruby-ronn,
swig
Vcs-Browser: https://github.com/ignition-release/ign_math-release
Vcs-Git: https://github.com/ignition-release/ign_math-release
Homepage: https://github.com/ignition-release/ign_math
XS-Ruby-Versions: all
X-Python3-Version: >= 3.2

Package: libignition-math7
Architecture: any
Expand All @@ -23,6 +30,13 @@ Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Multi-Arch: same
Description: Ignition Robotics Math Library - Shared library
A small, fast, and high performance math library. This library is a
self-contained set of classes and functions suitable for robot applications.
.
Ignition Robotics is a set of simple libraries that provide useful
functionality to bootstrap robot applications. The included libraries
encapsulate all the essentials, such as common math data types, console
logging, 3D mesh management, and asynchronous message passing.

Package: libignition-math7-dev
Architecture: any
Expand All @@ -33,6 +47,13 @@ Depends: libignition-math7 (= ${binary:Version}),
${misc:Depends}
Multi-Arch: same
Description: Ignition Robotics Math Library - Development files
A small, fast, and high performance math library. This library is a
self-contained set of classes and functions suitable for robot applications.
.
Ignition Robotics is a set of simple libraries that provide useful
functionality to bootstrap robot applications. The included libraries
encapsulate all the essentials, such as common math data types, console
logging, 3D mesh management, and asynchronous message passing.

Package: libignition-math7-eigen3-dev
Architecture: any
Expand All @@ -42,6 +63,53 @@ Depends: libignition-math7-dev (= ${binary:Version}),
${misc:Depends}
Multi-Arch: same
Description: Ignition Robotics Math Library - Eigen3 Development files
A small, fast, and high performance math library. This library is a
self-contained set of classes and functions suitable for robot applications.
.
Ignition Robotics is a set of simple libraries that provide useful
functionality to bootstrap robot applications. The included libraries
encapsulate all the essentials, such as common math data types, console
logging, 3D mesh management, and asynchronous message passing.
.
The package contains the development files relative to Eigen

Package: python3-ignition-math7
Architecture: any
Depends: libignition-math7 (= ${binary:Version}),
python3-distutils,
python3-pybind11,
${misc:Depends},
${python3:Depends}
Enhances: libignition-math7
Description: Ignition Robotics Math Library - Python3 bindings
A small, fast, and high performance math library. This library is a
self-contained set of classes and functions suitable for robot applications.
.
Ignition Robotics is a set of simple libraries that provide useful
functionality to bootstrap robot applications. The included libraries
encapsulate all the essentials, such as common math data types, console
logging, 3D mesh management, and asynchronous message passing.
.
The package contains the Python3 bindings.

Package: ruby-ignition-math7
Architecture: any
XB-Ruby-Versions: ${ruby:Versions}
Depends: libignition-math7 (= ${binary:Version}),
${misc:Depends},
${ruby:Depends},
${shlibs:Depends}
Enhances: libignition-math7
Description: Ignition Robotics Math Library - Ruby bindings
A small, fast, and high performance math library. This library is a
self-contained set of classes and functions suitable for robot applications.
.
Ignition Robotics is a set of simple libraries that provide useful
functionality to bootstrap robot applications. The included libraries
encapsulate all the essentials, such as common math data types, console
logging, 3D mesh management, and asynchronous message passing.
.
The package contains the Ruby bindings.

Package: libignition-math7-dbg
Architecture: any
Expand All @@ -52,3 +120,11 @@ Depends:
${misc:Depends}
Multi-Arch: same
Description: Ignition Robotics Math Library - Debugging symbols
A small, fast, and high performance math library. This library is a
self-contained set of classes and functions suitable for robot applications.
.
Ignition Robotics is a set of simple libraries that provide useful
functionality to bootstrap robot applications. The included libraries
encapsulate all the essentials, such as common math data types, console
logging, 3D mesh management, and asynchronous message passing.

1 change: 1 addition & 0 deletions ubuntu/debian/python3-ignition-math.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/python3/dist-packages/*
1 change: 1 addition & 0 deletions ubuntu/debian/ruby-ignition-math.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/usr/lib/ruby/*
9 changes: 7 additions & 2 deletions ubuntu/debian/rules
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/make -f

export PYBUILD_NAME=ignition-math7

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

.PHONY: override_dh_auto_configure \
Expand All @@ -8,11 +10,14 @@ DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
override_dh_auto_test

%:
dh $@ --parallel
dh $@ --parallel --with python3

override_dh_auto_configure:
dh_auto_configure -- \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DUSE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION=ON \
-DUSE_DIST_PACKAGES_FOR_PYTHON=ON \
-DUSE_SYSTEM_PATHS_FOR_RUBY_INSTALLATION=ON

override_dh_strip:
dh_strip -a --dbg-package=libignition-math7-dbg
Expand Down
83 changes: 83 additions & 0 deletions ubuntu/debian/tests/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/sh
# autopkgtest check: Build and run a program against ign-math, to verify that the
# headers and pkg-config file are installed correctly
# (C) 2012 Jose Luis Rivero
# Author: Jose Luis Rivero <jrivero@osrfoundation.org>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > igntest.c
#include <iostream>
#include <ignition/math.hh>
int main(int argc, char **argv)
{
// Create a triangle with the following vertices:
// 1: x = -1, y = 0
// 2: x = 0, y = 1
// 3: x = 1, y = 0
ignition::math::Triangled tri(
ignition::math::Vector2d(-1, 0),
ignition::math::Vector2d(0, 1),
ignition::math::Vector2d(1, 0));
// The individual vertices are accessible through the [] operator
std::cout << "Vertex 1: " << tri[0] << "\n"
<< "Vertex 2: " << tri[1] << "\n"
<< "Vertex 3: " << tri[2] << "\n";
// Each side of the triangle is also accessible via the Side function
std::cout << "Side 1: " << tri.Side(0) << "\n"
<< "Side 2: " << tri.Side(1) << "\n"
<< "Side 3: " << tri.Side(2) << "\n";
// It's also possible to set each vertex individually.
tri.Set(0, ignition::math::Vector2d(-10, 0));
tri.Set(1, ignition::math::Vector2d(0, 20));
tri.Set(2, ignition::math::Vector2d(10, 2));
// Or set all the vertices at once.
tri.Set(ignition::math::Vector2d(-1, 0),
ignition::math::Vector2d(0, 1),
ignition::math::Vector2d(1, 0));
// You can get the perimeter length and area of the triangle
std::cout << "Perimeter=" << tri.Perimeter()
<< " Area=" << tri.Area() << "\n";
// The Contains functions check if a line or point is inside the triangle
if (tri.Contains(ignition::math::Vector2d(0, 0.5)))
std::cout << "Triangle contains the point 0, 0.5\n";
else
std::cout << "Triangle does not contain the point 0, 0.5\n";
// The Intersect function check if a line segment intersects the triangle.
// It also returns the points of intersection
ignition::math::Vector2d pt1, pt2;
if (tri.Intersects(ignition::math::Line2d(-2, 0.5, 2, 0.5), pt1, pt2))
{
std::cout << "A line from (-2, 0.5) to (2, 0.5) intersects "
<< "the triangle at the\nfollowing points:\n"
<< "\t Pt1=" << pt1 << "\n"
<< "\t Pt2=" << pt2 << "\n";
}
else
{
std::cout << "A line from (-2, 0.5) to (2, 0.5) does not intersect "
<< "the triangle\n";
}
// There are more functions in Triangle. Take a look at the API;
// http://ignitionrobotics.org/libraries/ign_mat/api
}
EOF

g++ -o igntest igntest.c `pkg-config --cflags --libs ignition-math7`
echo "build: OK"
[ -x igntest ]
./igntest
echo "run: OK"
2 changes: 2 additions & 0 deletions ubuntu/debian/tests/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Tests: build
Depends: @, pkg-config, build-essential
7 changes: 5 additions & 2 deletions ubuntu/debian/watch
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
version=3
http://gazebosim.org/assets/distributions/ignmath-(\d\.\d\.\d)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
version=4
opts=filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE@-$1.tar.gz%,\
dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,repacksuffix=+ds \
https://github.com/ignitionrobotics/ign-math/tags \
(?:.*?/)@PACKAGE@.*_(\d[\d.]*)\.tar\.gz