Skip to content
Merged
13 changes: 7 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ jobs:
python-version: "3.12"
- name: ruff
run: |
pip install ruff
ruff .
pip install ruff==0.9.6
ruff check .

build_wheels:
name: Build wheel on ${{matrix.platform}}
runs-on: ${{matrix.platform}}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest, macos-14]
platform: [ubuntu-latest, macos-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
- uses: actions/upload-artifact@v3
uses: pypa/cibuildwheel@v2.22.0
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: wheels-${{ matrix.platform }}
34 changes: 20 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,41 @@ jobs:
runs-on: ${{matrix.platform}}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest, macos-14]
platform: [ubuntu-latest, macos-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
- uses: actions/upload-artifact@v3
uses: pypa/cibuildwheel@v2.22.0
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: wheels-${{ matrix.platform }}

upload_pypi:
name: Release To PyPi
needs: [build_wheels]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.6.4
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: "3.12"

- uses: actions/download-artifact@v4
with:
path: dist
pattern: wheels-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.8.10

create_release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build_wheels]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Tag Version
Expand All @@ -50,8 +55,9 @@ jobs:
echo "tag_name=${VER}" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
pattern: wheels-*
merge-multiple: true
- uses: ncipollo/release-action@v1.14.0
with:
artifacts: "dist/*"
Expand Down
66 changes: 46 additions & 20 deletions build_dependencies/install_macos.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
# prevent brew from auto cleanup
export HOMEBREW_NO_INSTALL_CLEANUP=1

brew install fcl

# mkdir -p deps
# cd deps
# # Octomap
# git clone https://github.com/OctoMap/octomap
# cd octomap
# git checkout tags/v1.8.0
# mkdir build
# cd build
# cmake ..
# make
# sudo make install

# cd ..
# cd ..
# cd ..
# exit immediately on any failed step
set -xe
pip install cmake

mkdir -p deps
cd deps

curl -OL https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz
tar -zxf eigen-3.3.9.tar.gz
mv eigen-3.3.9 eigen

rm -rf libccd
git clone --depth 1 --branch v2.1 https://github.com/danfis/libccd.git

rm -rf octomap
git clone --depth 1 --branch v1.9.8 https://github.com/OctoMap/octomap.git

rm -rf fcl
git clone --depth 1 --branch v0.7.0 https://github.com/ambi-robotics/fcl.git

# Install eigen
cmake -B build -S eigen
sudo cmake --install build

# Build and install libccd
cd libccd
cmake . -D ENABLE_DOUBLE_PRECISION=ON
make -j4
sudo make install
cd ..

# Build and install octomap
cd octomap
cmake . -D CMAKE_BUILD_TYPE=Release -D BUILD_OCTOVIS_SUBPROJECT=OFF -D BUILD_DYNAMICETD3D_SUBPROJECT=OFF
make -j4
sudo make install
cd ..

# Build and install fcl
cd fcl
cmake .
make -j4
sudo make install
cd ..

cd ..
3 changes: 2 additions & 1 deletion examples/example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fcl
import numpy as np

import fcl


def print_collision_result(o1_name, o2_name, result):
print(f"Collision between {o1_name} and {o2_name}:")
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
requires = [
"setuptools",
"wheel",
"Cython<3.0",
"Cython>=3.0",
"numpy; python_version<'3.12'",
"numpy>=1.26.0b1; python_version>='3.12'"]
build-backend = "setuptools.build_meta"

[project]
name = "python-fcl"
description = "Python bindings for the Flexible Collision Library"
requires-python = ">=3.7"
requires-python = ">=3.9"
authors = [
{name = "Jelle Feringa", email = "jelleferinga@gmail.com"},
{name = "Matthew Matl", email = "mmatl@eecs.berkeley.edu"},
Expand Down Expand Up @@ -107,9 +107,8 @@ archs = ["x86_64"]

[tool.cibuildwheel.macos]
before-all = "bash build_dependencies/install_macos.sh"
environment = { CPATH = "$(brew --prefix)/include:$(brew --prefix)/include/eigen3", LD_LIBRARY_PATH = "$(brew --prefix)/lib" }
repair-wheel-command = "delocate-wheel -w {dest_dir} -v {wheel}"

[tool.cibuildwheel.windows]
before-all = "powershell build_dependencies\\install_windows.ps1"
archs = ["AMD64"]

4 changes: 2 additions & 2 deletions src/fcl/fcl.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,10 @@ cdef class DistanceFunction:
(&dist)[0] = <double?> py_r[1]
return <bool?> py_r[0]

cdef inline bool CollisionCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata):
cdef inline bool CollisionCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata) noexcept:
return (<CollisionFunction> cdata).eval_func(o1, o2)

cdef inline bool DistanceCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata, double& dist):
cdef inline bool DistanceCallBack(defs.CollisionObjectd*o1, defs.CollisionObjectd*o2, void*cdata, double& dist) noexcept:
return (<DistanceFunction> cdata).eval_func(o1, o2, dist)


Expand Down
3 changes: 2 additions & 1 deletion tests/test_fcl.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest

import fcl
import numpy as np

import fcl


class TestFCL(unittest.TestCase):
def setUp(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_precision.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest

import fcl
import numpy as np

import fcl


# These test cases were added because there was a very sneaky crash that would occur
# in the signed distance functions if all libs were not compiled with double precision
Expand Down