Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
btalb committed Jun 3, 2022
2 parents cd7f23a + 23bbe75 commit 2cb4db3
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
44 changes: 44 additions & 0 deletions .github/build-manylinux-wheels
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -euo pipefail

BOOST_VERSION=1.79.0
BOOST_ROOT="/boost"

root="$(dirname "$0")/.."

# Only works on manylinux2014+
yum install -y cmake3 metis-devel wget

# Manually build Boost for easier control of versioning / linking
BOOST_VERSION_US="$(echo "$BOOST_VERSION" | tr '.' '_')"
BOOST_DIR="/boost_$BOOST_VERSION_US"
wget -qO- "$(printf "%s%s%s%s" \
"https://boostorg.jfrog.io/artifactory/main/release/" \
"$BOOST_VERSION" "/source/boost_" "$BOOST_VERSION_US" ".tar.bz2")" | \
tar --bzip2 -x
pushd "$BOOST_DIR"
./bootstrap.sh --prefix="$BOOST_ROOT"
./b2 install || true
popd

# Apply our hacks to get it to build...
sed -i 's/ \(find_package(Python3\)/#\1/' "$root/gtsam/cmake/HandlePython.cmake"

# Build each of our wheels
pushd /io/
for PYROOT in /opt/python/cp*; do
export Python3_EXECUTABLE="$PYROOT/bin/python"
export Python3_INCLUDE_DIR="$(find "$PYROOT/include/" \
-mindepth 1 -maxdepth 1 -type d)"
"$Python3_EXECUTABLE" -m build
done

# Bundle shared libraries (aka Boost) into each of our wheels to make them
# manylinux compatible
for w in /io/dist/*linux_x86_64.whl; do
auditwheel repair --plat "$PLAT" -w /io/dist/ "$w"
done

# Undo our hacks
sed -i 's/#\(find_package(Python3\)/ \1/' "$root/gtsam/cmake/HandlePython.cmake"
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
project(gtsam_quadrics)
cmake_minimum_required(VERSION 3.0)
set(GTSAM_QUADRICS_VERSION 1.0.0)

cmake_minimum_required(VERSION 3.18)
set(GTSAM_QUADRICS_VERSION 0.1.2)

# we want to use some C++11 features
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
Expand All @@ -16,6 +15,15 @@ set(PYTHON_VERSION "3" CACHE STRING "The version of python to build the cython w
if (BUILD_PYTHON_WRAP)
set(GTSAM_BUILD_PYTHON ON CACHE BOOL "")
set(GTSAM_CONFIG_TEMPLATE_PATH ${CMAKE_SOURCE_DIR}/gtsam/cmake)

# Allow overriding Python choices for environments like manylinux...
if (DEFINED ENV{Python3_EXECUTABLE})
set(Python3_EXECUTABLE "$ENV{Python3_EXECUTABLE}")
endif()
if (DEFINED ENV{Python3_INCLUDE_DIR})
set(Python3_INCLUDE_DIR "$ENV{Python3_INCLUDE_DIR}")
endif()
find_package(Python3 COMPONENTS Interpreter Development.Module)
endif()
set(GTSAM_BUILD_UNSTABLE OFF CACHE BOOL "")
add_subdirectory(./gtsam)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Please note that for all methods except the Conda method, you must have the foll

- A C++ compiler: e.g. `sudo apt install build-essential`
- CMake >= 3.0: `sudo apt install cmake`
- Boost C++ libraries >= 1.43: `sudo apt install libboost-all-dev`
- Boost C++ libraries >= 1.65: `sudo apt install libboost-all-dev`
- METIS matrix library: `sudo apt install libmetis-dev` <!-- in future, automatically get from gtsam/3rdparty, required when including gtsam/Symbol.h etc, maybe we just need to update some path? -->

### Conda
Expand Down
5 changes: 4 additions & 1 deletion gtsam_quadrics/geometry/BoundingBoxFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <gtsam_quadrics/geometry/BoundingBoxFactor.h>
#include <gtsam_quadrics/geometry/QuadricCamera.h>

#include <boost/bind/bind.hpp>

#define NUMERICAL_DERIVATIVE false

using namespace std;
Expand Down Expand Up @@ -78,7 +80,8 @@ gtsam::Vector BoundingBoxFactor::evaluateError(
if (NUMERICAL_DERIVATIVE) {
std::function<gtsam::Vector(const gtsam::Pose3&,
const ConstrainedDualQuadric&)>
funPtr(boost::bind(&BoundingBoxFactor::evaluateError, this, _1, _2,
funPtr(boost::bind(&BoundingBoxFactor::evaluateError, this,
boost::placeholders::_1, boost::placeholders::_2,
boost::none, boost::none));
if (H1) {
Eigen::Matrix<double, 4, 6> db_dx_ =
Expand Down
5 changes: 4 additions & 1 deletion gtsam_quadrics/geometry/QuadricAngleFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <gtsam/base/numericalDerivative.h>
#include <gtsam_quadrics/geometry/QuadricAngleFactor.h>

#include <boost/bind/bind.hpp>

#define NUMERICAL_DERIVATIVE false

using namespace std;
Expand All @@ -35,7 +37,8 @@ gtsam::Vector QuadricAngleFactor::evaluateError(
// Rot3::LocalCoordinates(quadric.pose().rotation());

std::function<gtsam::Vector(const ConstrainedDualQuadric&)> funPtr(
boost::bind(&QuadricAngleFactor::evaluateError, this, _1, boost::none));
boost::bind(&QuadricAngleFactor::evaluateError, this,
boost::placeholders::_1, boost::none));
if (H) {
Eigen::Matrix<double, 3, 9> de_dr =
gtsam::numericalDerivative11(funPtr, quadric, 1e-6);
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def build_cmake(self, exts):
long_description = f.read()

setup(name='gtsam_quadrics',
version='0.1.1',
version='0.1.3',
author='Lachlan Nicholson',
author_email='[email protected]',
maintainer='Ben Talbot',
Expand Down

0 comments on commit 2cb4db3

Please sign in to comment.