Merged wrap improvements back from develop branch
parent
b4344cfe16
commit
3b4fd765ec
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
set(WRAP_BOOST_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY})
|
set(WRAP_BOOST_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_REGEX_LIBRARY})
|
||||||
|
|
||||||
|
# Allow for disabling serialization to handle errors related to Clang's linker
|
||||||
|
option(GTSAM_WRAP_SERIALIZATION "If enabled, allows for wrapped objects to be saved via boost.serialization" ON)
|
||||||
|
if (NOT GTSAM_WRAP_SERIALIZATION)
|
||||||
|
add_definitions(-DWRAP_DISABLE_SERIALIZE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Build the executable itself
|
# Build the executable itself
|
||||||
file(GLOB wrap_srcs "*.cpp")
|
file(GLOB wrap_srcs "*.cpp")
|
||||||
file(GLOB wrap_headers "*.h")
|
file(GLOB wrap_headers "*.h")
|
||||||
|
@ -17,11 +23,9 @@ file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE
|
||||||
set_target_properties(wrap_lib wrap PROPERTIES FOLDER "${relative_path}")
|
set_target_properties(wrap_lib wrap PROPERTIES FOLDER "${relative_path}")
|
||||||
|
|
||||||
# Install wrap binary and export target
|
# Install wrap binary and export target
|
||||||
if (GTSAM_INSTALL_WRAP)
|
install(TARGETS wrap EXPORT GTSAM-exports DESTINATION bin)
|
||||||
install(TARGETS wrap EXPORT GTSAM-exports DESTINATION bin)
|
list(APPEND GTSAM_EXPORTED_TARGETS wrap)
|
||||||
list(APPEND GTSAM_EXPORTED_TARGETS wrap)
|
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)
|
||||||
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)
|
|
||||||
endif(GTSAM_INSTALL_WRAP)
|
|
||||||
|
|
||||||
# Install matlab header
|
# Install matlab header
|
||||||
install(FILES matlab.h DESTINATION include/wrap)
|
install(FILES matlab.h DESTINATION include/wrap)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
#include "FileWriter.h"
|
#include "FileWriter.h"
|
||||||
#include "TypeAttributesTable.h"
|
#include "TypeAttributesTable.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
//#define BOOST_SPIRIT_DEBUG
|
//#define BOOST_SPIRIT_DEBUG
|
||||||
#include "spirit_actors.h"
|
#include "spirit_actors.h"
|
||||||
|
@ -382,14 +382,22 @@ void Module::parseMarkup(const std::string& data) {
|
||||||
BOOST_FOREACH(Class& cls, classes) {
|
BOOST_FOREACH(Class& cls, classes) {
|
||||||
Class::Methods::iterator serializable_it = cls.methods.find("serializable");
|
Class::Methods::iterator serializable_it = cls.methods.find("serializable");
|
||||||
if (serializable_it != cls.methods.end()) {
|
if (serializable_it != cls.methods.end()) {
|
||||||
|
#ifndef WRAP_DISABLE_SERIALIZE
|
||||||
cls.isSerializable = true;
|
cls.isSerializable = true;
|
||||||
|
#else
|
||||||
|
cout << "Ignoring serializable() flag in class " << cls.name << endl;
|
||||||
|
#endif
|
||||||
cls.methods.erase(serializable_it);
|
cls.methods.erase(serializable_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
Class::Methods::iterator serialize_it = cls.methods.find("serialize");
|
Class::Methods::iterator serialize_it = cls.methods.find("serialize");
|
||||||
if (serialize_it != cls.methods.end()) {
|
if (serialize_it != cls.methods.end()) {
|
||||||
|
#ifndef WRAP_DISABLE_SERIALIZE
|
||||||
cls.isSerializable = true;
|
cls.isSerializable = true;
|
||||||
cls.hasSerialization= true;
|
cls.hasSerialization= true;
|
||||||
|
#else
|
||||||
|
cout << "Ignoring serialize() flag in class " << cls.name << endl;
|
||||||
|
#endif
|
||||||
cls.methods.erase(serialize_it);
|
cls.methods.erase(serialize_it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,6 +457,7 @@ void Module::generateIncludes(FileWriter& file) const {
|
||||||
file.oss << "#include <" << *it << ">" << endl;
|
file.oss << "#include <" << *it << ">" << endl;
|
||||||
file.oss << "\n";
|
file.oss << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Module::matlab_code(const string& toolboxPath, const string& headerPath) const {
|
void Module::matlab_code(const string& toolboxPath, const string& headerPath) const {
|
||||||
|
|
|
@ -225,6 +225,7 @@ mxArray* wrap<gtsam::Matrix >(const gtsam::Matrix& A) {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T unwrap(const mxArray* array) {
|
T unwrap(const mxArray* array) {
|
||||||
error("wrap internal error: attempted unwrap of invalid type");
|
error("wrap internal error: attempted unwrap of invalid type");
|
||||||
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
// specialization to string
|
// specialization to string
|
||||||
|
|
|
@ -58,7 +58,7 @@ TEST( wrap, ArgumentList ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST_UNSAFE( wrap, check_exception ) {
|
TEST( wrap, check_exception ) {
|
||||||
THROWS_EXCEPTION(Module("/notarealpath", "geometry",enable_verbose));
|
THROWS_EXCEPTION(Module("/notarealpath", "geometry",enable_verbose));
|
||||||
CHECK_EXCEPTION(Module("/alsonotarealpath", "geometry",enable_verbose), CantOpenFile);
|
CHECK_EXCEPTION(Module("/alsonotarealpath", "geometry",enable_verbose), CantOpenFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue