Skip to content

Commit

Permalink
Merge pull request #17997 from Tobias-Fischer/gtsam_4.0.3_with_boost_…
Browse files Browse the repository at this point in the history
…1.7.6

Add gtsam - take 3
  • Loading branch information
wolfv authored Feb 11, 2022
2 parents 5e0acfd + a9a553f commit 89dce65
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 0 deletions.
20 changes: 20 additions & 0 deletions recipes/gtsam/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
mkdir build
cd build

cmake ^
-GNinja ^
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF ^
-DGTSAM_USE_SYSTEM_EIGEN=ON ^
-DGTSAM_INSTALL_CPPUNITLITE=OFF ^
-DGTSAM_BUILD_PYTHON=ON ^
-DBoost_USE_STATIC_LIBS=OFF ^
-DBOOST_ROOT="%LIBRARY_PREFIX%" ^
-DBoost_NO_SYSTEM_PATHS=ON ^
-DPython3_EXECUTABLE=%PYTHON% ^
-DPython_EXECUTABLE=%PYTHON% ^
-DPYTHON_EXECUTABLE=%PYTHON% ^
%SRC_DIR%

ninja install

@rem ninja check
16 changes: 16 additions & 0 deletions recipes/gtsam/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mkdir build
cd build

cmake .. ${CMAKE_ARGS} \
-GNinja \
-DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF \
-DGTSAM_USE_SYSTEM_EIGEN=ON \
-DGTSAM_INSTALL_CPPUNITLITE=OFF \
-DGTSAM_BUILD_PYTHON=ON \
-DPython3_EXECUTABLE=$PYTHON \
-DPython_EXECUTABLE=$PYTHON \
-DPYTHON_EXECUTABLE=$PYTHON

ninja install

ninja check
36 changes: 36 additions & 0 deletions recipes/gtsam/fix-boost.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/gtsam/base/serialization.h b/gtsam/base/serialization.h
index 24355c684..e615afe83 100644
--- a/gtsam/base/serialization.h
+++ b/gtsam/base/serialization.h
@@ -25,6 +25,7 @@
#include <string>

// includes for standard serialization types
+#include <boost/serialization/version.hpp>
#include <boost/serialization/optional.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
diff --git a/gtsam/linear/NoiseModel.h b/gtsam/linear/NoiseModel.h
index 54b9d955f..a737c5cc8 100644
--- a/gtsam/linear/NoiseModel.h
+++ b/gtsam/linear/NoiseModel.h
@@ -27,6 +27,7 @@
#include <boost/serialization/extended_type_info.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/serialization/shared_ptr.hpp>
+#include <boost/serialization/version.hpp>
#include <boost/serialization/optional.hpp>

namespace gtsam {
diff --git a/gtsam/slam/SmartFactorBase.h b/gtsam/slam/SmartFactorBase.h
index ddf56b289..f128bd124 100644
--- a/gtsam/slam/SmartFactorBase.h
+++ b/gtsam/slam/SmartFactorBase.h
@@ -30,6 +30,7 @@
#include <gtsam/geometry/CameraSet.h>

#include <boost/optional.hpp>
+#include <boost/serialization/version.hpp>
#include <boost/serialization/optional.hpp>
#include <boost/make_shared.hpp>
#include <vector>
70 changes: 70 additions & 0 deletions recipes/gtsam/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{% set name = "gtsam" %}
{% set version = "4.1.1" %}

package:
name: gtsam
version: '{{ version }}'

source:
url: https://github.com/borglab/gtsam/archive/refs/tags/{{ version }}.tar.gz
sha256: c7b5e6cdad52b141c272778f47baf628975457be3e26ed96a7bc2ae685a00af0
patches:
- nobuild-examples-timing.patch
- fix-boost.patch
build:
number: 0
skip: True # [win]
run_exports:
- '{{ pin_subpackage(name, max_pin="x.x") }}'

requirements:
build:
- '{{ compiler("c") }}'
- '{{ compiler("cxx") }}'
- ninja
- cmake
- pybind11 # [build_platform != target_platform]
- numpy # [build_platform != target_platform]
- python # [build_platform != target_platform]
host:
- python
- boost-cpp
- eigen
- geographiclib-cpp
- metis
- suitesparse
- tbb
- tbb-devel
- pybind11
- pyparsing
- numpy
run:
- python
- pyparsing
- numpy
- boost-cpp

test:
commands:
- test -f ${PREFIX}/lib/libgtsam${SHLIB_EXT} # [not win]
- test -f ${PREFIX}/lib/cmake/gtwrap/gtwrapConfig.cmake # [not win]
- test -f ${PREFIX}/lib/cmake/GTSAM/GTSAMConfig.cmake # [not win]
- test -f ${PREFIX}/include/gtsam/base/types.h # [not win]
- if exist %PREFIX%\\Library\\include\\gtsam\\base\\types.h (exit 0) else (exit 1) # [win]
- if exist $PREFIX$\\Library\\lib\\gtsam.lib (exit 0) else (exit 1) # [win]
- if exist $PREFIX$\\Library\\bin\\gtsam.dll (exit 0) else (exit 1) # [win]


about:
home: https://github.com/borglab/gtsam
summary: GTSAM is a library of C++ classes that implement smoothing and mapping (SAM) in robotics and vision
license: BSD-3-Clause
license_file:
- LICENSE
- LICENSE.BSD

extra:
recipe-maintainers:
- wolfv
- ameysutavani
- TobiasFischer
17 changes: 17 additions & 0 deletions recipes/gtsam/nobuild-examples-timing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edefbf2ea..45e1e3d79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -435,10 +435,10 @@ add_subdirectory(gtsam)
add_subdirectory(tests)

# Build examples
-add_subdirectory(examples)
+# add_subdirectory(examples)

# Build timing
-add_subdirectory(timing)
+# add_subdirectory(timing)

# Build gtsam_unstable
if (GTSAM_BUILD_UNSTABLE)
41 changes: 41 additions & 0 deletions recipes/gtsam/unvendor-ceres.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/gtsam/3rdparty/CMakeLists.txt b/gtsam/3rdparty/CMakeLists.txt
index c8fecc339..419100863 100644
--- a/gtsam/3rdparty/CMakeLists.txt
+++ b/gtsam/3rdparty/CMakeLists.txt
@@ -53,7 +53,9 @@ if(GTSAM_SUPPORT_NESTED_DISSECTION)
add_subdirectory(metis)
endif()

-add_subdirectory(ceres)
+# add_subdirectory(ceres)
+find_package(Ceres REQUIRED)
+include_directories(${CERES_INCLUDE_DIRS})

############ NOTE: When updating GeographicLib be sure to disable building their examples
############ and unit tests by commenting out their lines:
diff --git a/gtsam/3rdparty/ceres/example.h b/gtsam/3rdparty/ceres/example.h
index 6b051fce0..a3168fdb4 100644
--- a/gtsam/3rdparty/ceres/example.h
+++ b/gtsam/3rdparty/ceres/example.h
@@ -33,7 +33,7 @@

#pragma once

-#include <gtsam/3rdparty/ceres/rotation.h>
+#include <ceres/rotation.h>

// Templated pinhole camera model for used with Ceres. The camera is
// parameterized using 9 parameters: 3 for rotation, 3 for translation, 1 for
diff --git a/gtsam/nonlinear/AdaptAutoDiff.h b/gtsam/nonlinear/AdaptAutoDiff.h
index 682cca29a..a8ce86dd4 100644
--- a/gtsam/nonlinear/AdaptAutoDiff.h
+++ b/gtsam/nonlinear/AdaptAutoDiff.h
@@ -20,7 +20,7 @@

#include <gtsam/base/VectorSpace.h>
#include <gtsam/base/OptionalJacobian.h>
-#include <gtsam/3rdparty/ceres/autodiff.h>
+#include <ceres/internal/autodiff.h>

#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>

0 comments on commit 89dce65

Please sign in to comment.