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})
|
||||
|
||||
# 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
|
||||
file(GLOB wrap_srcs "*.cpp")
|
||||
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}")
|
||||
|
||||
# Install wrap binary and export target
|
||||
if (GTSAM_INSTALL_WRAP)
|
||||
install(TARGETS wrap EXPORT GTSAM-exports DESTINATION bin)
|
||||
list(APPEND GTSAM_EXPORTED_TARGETS wrap)
|
||||
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)
|
||||
endif(GTSAM_INSTALL_WRAP)
|
||||
|
||||
# Install matlab header
|
||||
install(FILES matlab.h DESTINATION include/wrap)
|
||||
|
|
|
@ -382,14 +382,22 @@ void Module::parseMarkup(const std::string& data) {
|
|||
BOOST_FOREACH(Class& cls, classes) {
|
||||
Class::Methods::iterator serializable_it = cls.methods.find("serializable");
|
||||
if (serializable_it != cls.methods.end()) {
|
||||
#ifndef WRAP_DISABLE_SERIALIZE
|
||||
cls.isSerializable = true;
|
||||
#else
|
||||
cout << "Ignoring serializable() flag in class " << cls.name << endl;
|
||||
#endif
|
||||
cls.methods.erase(serializable_it);
|
||||
}
|
||||
|
||||
Class::Methods::iterator serialize_it = cls.methods.find("serialize");
|
||||
if (serialize_it != cls.methods.end()) {
|
||||
#ifndef WRAP_DISABLE_SERIALIZE
|
||||
cls.isSerializable = true;
|
||||
cls.hasSerialization= true;
|
||||
#else
|
||||
cout << "Ignoring serialize() flag in class " << cls.name << endl;
|
||||
#endif
|
||||
cls.methods.erase(serialize_it);
|
||||
}
|
||||
}
|
||||
|
@ -450,6 +458,7 @@ void Module::generateIncludes(FileWriter& file) const {
|
|||
file.oss << "\n";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************* */
|
||||
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>
|
||||
T unwrap(const mxArray* array) {
|
||||
error("wrap internal error: attempted unwrap of invalid type");
|
||||
return T();
|
||||
}
|
||||
|
||||
// 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));
|
||||
CHECK_EXCEPTION(Module("/alsonotarealpath", "geometry",enable_verbose), CantOpenFile);
|
||||
|
||||
|
|
Loading…
Reference in New Issue