diff --git a/gtsam.h b/gtsam.h index dcef6e23d..4e91e407f 100644 --- a/gtsam.h +++ b/gtsam.h @@ -2229,51 +2229,6 @@ pair load2D(string filename, pair load2D_robust(string filename, gtsam::noiseModel::Base* model); -//************************************************************************* -// Serialization -//************************************************************************* -//#include -// -//// Serialize/Deserialize a NonlinearFactorGraph -//string serializeGraph(const gtsam::NonlinearFactorGraph& graph); -// -//gtsam::NonlinearFactorGraph* deserializeGraph(string serialized_graph); -// -//string serializeGraphXML(const gtsam::NonlinearFactorGraph& graph); -//string serializeGraphXML(const gtsam::NonlinearFactorGraph& graph, string name); -// -//gtsam::NonlinearFactorGraph* deserializeGraphXML(string serialized_graph); -//gtsam::NonlinearFactorGraph* deserializeGraphXML(string serialized_graph, string name); -// -//// Serialize/Deserialize a Values -//string serializeValues(const gtsam::Values& values); -// -//gtsam::Values* deserializeValues(string serialized_values); -// -//string serializeValuesXML(const gtsam::Values& values); -//string serializeValuesXML(const gtsam::Values& values, string name); -// -//gtsam::Values* deserializeValuesXML(string serialized_values); -//gtsam::Values* deserializeValuesXML(string serialized_values, string name); -// -//// Serialize -//bool serializeGraphToFile(const gtsam::NonlinearFactorGraph& graph, string fname); -//bool serializeGraphToXMLFile(const gtsam::NonlinearFactorGraph& graph, string fname); -//bool serializeGraphToXMLFile(const gtsam::NonlinearFactorGraph& graph, string fname, string name); -// -//bool serializeValuesToFile(const gtsam::Values& values, string fname); -//bool serializeValuesToXMLFile(const gtsam::Values& values, string fname); -//bool serializeValuesToXMLFile(const gtsam::Values& values, string fname, string name); -// -//// Deserialize -//gtsam::NonlinearFactorGraph* deserializeGraphFromFile(string fname); -//gtsam::NonlinearFactorGraph* deserializeGraphFromXMLFile(string fname); -//gtsam::NonlinearFactorGraph* deserializeGraphFromXMLFile(string fname, string name); -// -//gtsam::Values* deserializeValuesFromFile(string fname); -//gtsam::Values* deserializeValuesFromXMLFile(string fname); -//gtsam::Values* deserializeValuesFromXMLFile(string fname, string name); - //************************************************************************* // Utilities //************************************************************************* diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 45acd92e3..5b69a25b6 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -34,15 +34,10 @@ endif() # Sources to remove from builds set (excluded_sources #"") "${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.cpp" -# "${CMAKE_CURRENT_SOURCE_DIR}/discrete/TypedDiscreteFactor.cpp" -# "${CMAKE_CURRENT_SOURCE_DIR}/discrete/TypedDiscreteFactorGraph.cpp" -# "${CMAKE_CURRENT_SOURCE_DIR}/discrete/parseUAI.cpp" -# "${CMAKE_CURRENT_SOURCE_DIR}/discrete/PotentialTable.cpp") ) set (excluded_headers #"") "${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.h" -# "${CMAKE_CURRENT_SOURCE_DIR}/discrete/TypedDiscreteFactor.h ) if(GTSAM_USE_QUATERNIONS) @@ -60,10 +55,10 @@ foreach(subdir ${gtsam_subdirs}) # Build convenience libraries file(GLOB subdir_cpp_srcs "${subdir}/*.cpp") file(GLOB subdir_headers "${subdir}/*.h") + list(REMOVE_ITEM subdir_cpp_srcs ${excluded_sources}) + list(REMOVE_ITEM subdir_headers ${excluded_headers}) set(subdir_srcs ${subdir_cpp_srcs} ${subdir_headers}) # Include header files so they show up in Visual Studio gtsam_assign_source_folders("${subdir_srcs}") # Create MSVC structure - list(REMOVE_ITEM subdir_srcs ${excluded_sources}) - list(REMOVE_ITEM subdir_srcs ${excluded_headers}) set(${subdir}_srcs ${subdir_srcs}) if (GTSAM_BUILD_CONVENIENCE_LIBRARIES AND (subdir_cpp_srcs)) # Only build convenience library if sources exist message(STATUS "Building Convenience Library: ${subdir}") diff --git a/gtsam_unstable/CMakeLists.txt b/gtsam_unstable/CMakeLists.txt index 74fae5bb9..39fcaccc1 100644 --- a/gtsam_unstable/CMakeLists.txt +++ b/gtsam_unstable/CMakeLists.txt @@ -14,11 +14,24 @@ set(GTSAM_UNSTABLE_BOOST_LIBRARIES ${GTSAM_BOOST_LIBRARIES} ${Boost_THREAD_LIBRA add_custom_target(check.unstable COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) +# To exclude a source from the library build (in any subfolder) +# Add the full name to this list, as in the following example +# Sources to remove from builds +set (excluded_sources # "") + "${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.cpp" +) + +set (excluded_headers # "") + "${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.h" +) + # assemble core libaries foreach(subdir ${gtsam_unstable_subdirs}) # Build convenience libraries file(GLOB subdir_srcs "${subdir}/*.cpp") file(GLOB subdir_headers "${subdir}/*.h") + list(REMOVE_ITEM subdir_srcs ${excluded_sources}) + list(REMOVE_ITEM subdir_headers ${excluded_headers}) set(${subdir}_srcs ${subdir_srcs} ${subdir_headers}) gtsam_assign_source_folders("${${subdir}_srcs}") # Create MSVC structure if (subdir_srcs AND GTSAM_BUILD_CONVENIENCE_LIBRARIES) diff --git a/gtsam_unstable/slam/CMakeLists.txt b/gtsam_unstable/slam/CMakeLists.txt index 1a92167ac..27ade7a5e 100644 --- a/gtsam_unstable/slam/CMakeLists.txt +++ b/gtsam_unstable/slam/CMakeLists.txt @@ -1,5 +1,10 @@ # Install headers +set (slam_excluded_headers #"") + "${CMAKE_CURRENT_SOURCE_DIR}/serialization.h" +) + file(GLOB slam_headers "*.h") +list(REMOVE_ITEM slam_headers ${slam_excluded_headers}) install(FILES ${slam_headers} DESTINATION include/gtsam_unstable/slam) # Components to link tests in this subfolder against @@ -19,8 +24,10 @@ set (slam_full_libs ${gtsam_unstable-default}) # Exclude tests that don't work -set (slam_excluded_tests "") - +set (slam_excluded_tests + "${CMAKE_CURRENT_SOURCE_DIR}/tests/testSerialization.cpp" +# "" # Add to this list, with full path, to exclude +) # Add all tests gtsam_add_subdir_tests(slam_unstable "${slam_local_libs}" "${slam_full_libs}" "${slam_excluded_tests}") add_dependencies(check.unstable check.slam_unstable) diff --git a/gtsam/slam/serialization.cpp b/gtsam_unstable/slam/serialization.cpp similarity index 100% rename from gtsam/slam/serialization.cpp rename to gtsam_unstable/slam/serialization.cpp diff --git a/gtsam/slam/serialization.h b/gtsam_unstable/slam/serialization.h similarity index 100% rename from gtsam/slam/serialization.h rename to gtsam_unstable/slam/serialization.h diff --git a/gtsam/slam/tests/testSerialization.cpp b/gtsam_unstable/slam/tests/testSerialization.cpp similarity index 100% rename from gtsam/slam/tests/testSerialization.cpp rename to gtsam_unstable/slam/tests/testSerialization.cpp diff --git a/matlab/gtsam_tests/testGraphValuesSerialization.m b/matlab/gtsam_tests/testSerialization.m similarity index 100% rename from matlab/gtsam_tests/testGraphValuesSerialization.m rename to matlab/gtsam_tests/testSerialization.m diff --git a/matlab/gtsam_tests/test_gtsam.m b/matlab/gtsam_tests/test_gtsam.m index 1f8125b81..2cad40df8 100644 --- a/matlab/gtsam_tests/test_gtsam.m +++ b/matlab/gtsam_tests/test_gtsam.m @@ -30,8 +30,8 @@ testStereoVOExample display 'Starting: testVisualISAMExample' testVisualISAMExample -display 'Starting: testGraphValuesSerialization' -testVisualISAMExample +display 'Starting: testSerialization' +testSerialization % end of tests display 'Tests complete!'