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

Fix Matlab Wrapper #1140

Merged
merged 4 commits into from
Mar 21, 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
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $ make install
## Important Installation Notes

1. GTSAM requires the following libraries to be installed on your system:
- BOOST version 1.65 or greater (install through Linux repositories or MacPorts). Please see [Boost Notes](#boost-notes).
- BOOST version 1.65 or greater (install through Linux repositories or MacPorts). Please see [Boost Notes](#boost-notes) for version recommendations based on your compiler.

- Cmake version 3.0 or higher
- Support for XCode 4.3 command line tools on Mac requires CMake 2.8.8 or higher
Expand Down Expand Up @@ -72,7 +72,7 @@ execute commands as follows for an out-of-source build:
Versions of Boost prior to 1.65 have a known bug that prevents proper "deep" serialization of objects, which means that objects encapsulated inside other objects don't get serialized.
This is particularly seen when using `clang` as the C++ compiler.

For this reason we require Boost>=1.65, and recommend installing it through alternative channels when it is not available through your operating system's primary package manager.
For this reason we recommend Boost>=1.65, and recommend installing it through alternative channels when it is not available through your operating system's primary package manager.

## Known Issues

Expand Down
2 changes: 1 addition & 1 deletion gtsam/nonlinear/LevenbergMarquardtParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LevenbergMarquardtOptimizer;
class GTSAM_EXPORT LevenbergMarquardtParams: public NonlinearOptimizerParams {

public:
/** See LevenbergMarquardtParams::lmVerbosity */
/** See LevenbergMarquardtParams::verbosityLM */
enum VerbosityLM {
SILENT = 0, SUMMARY, TERMINATION, LAMBDA, TRYLAMBDA, TRYCONFIG, DAMPED, TRYDELTA
};
Expand Down
4 changes: 2 additions & 2 deletions matlab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ if(GTSAM_UNSTABLE_INSTALL_MATLAB_TOOLBOX)
endif()

# Wrap
matlab_wrap(${GTSAM_SOURCE_DIR}/gtsam_unstable/gtsam_unstable.i "gtsam" ""
"${mexFlags}" "${ignore}")
matlab_wrap(${GTSAM_SOURCE_DIR}/gtsam_unstable/gtsam_unstable.i "gtsam_unstable"
"${GTSAM_ADDITIONAL_LIBRARIES}" "" "${mexFlags}" "${ignore}")
endif(GTSAM_UNSTABLE_INSTALL_MATLAB_TOOLBOX)

# Record the root dir for gtsam - needed during external builds, e.g., ROS
Expand Down
4 changes: 2 additions & 2 deletions wrap/gtwrap/pybind_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,15 @@ def wrap_instantiated_class(

def wrap_instantiated_declaration(
self, instantiated_decl: instantiator.InstantiatedDeclaration):
"""Wrap the class."""
"""Wrap the forward declaration."""
module_var = self._gen_module_var(instantiated_decl.namespaces())
cpp_class = instantiated_decl.to_cpp()
if cpp_class in self.ignore_classes:
return ""

res = (
'\n py::class_<{cpp_class}, '
'{shared_ptr_type}::shared_ptr<{cpp_class}>>({module_var}, "{class_name}")'
'{shared_ptr_type}::shared_ptr<{cpp_class}>>({module_var}, "{class_name}");'
).format(shared_ptr_type=('boost' if self.use_boost else 'std'),
cpp_class=cpp_class,
class_name=instantiated_decl.name,
Expand Down
9 changes: 5 additions & 4 deletions wrap/matlab.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ extern "C" {
#include <mex.h>
}

#include <boost/shared_ptr.hpp>
#include <boost/cstdint.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>

#include <list>
#include <string>
#include <sstream>
#include <typeinfo>
#include <set>
#include <sstream>
#include <streambuf>
#include <string>
#include <typeinfo>

using namespace std;
using namespace boost; // not usual, but for conciseness of generated code
Expand Down
2 changes: 1 addition & 1 deletion wrap/tests/expected/python/class_pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ PYBIND11_MODULE(class_py, m_) {
return redirect.str();
}, py::arg("s") = "factor: ", py::arg("keyFormatter") = gtsam::DefaultKeyFormatter);

py::class_<SuperCoolFactor<gtsam::Pose3>, std::shared_ptr<SuperCoolFactor<gtsam::Pose3>>>(m_, "SuperCoolFactorPose3")
py::class_<SuperCoolFactor<gtsam::Pose3>, std::shared_ptr<SuperCoolFactor<gtsam::Pose3>>>(m_, "SuperCoolFactorPose3");

#include "python/specializations.h"

Expand Down
1 change: 0 additions & 1 deletion wrap/tests/fixtures/inheritance.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// A base class
virtual class MyBase {

};

// A templated class
Expand Down