From 2c4cdbb8c186be0ed02af1b7a0434eae29455f79 Mon Sep 17 00:00:00 2001 From: Tal Regev Date: Thu, 7 Sep 2023 10:09:57 +0300 Subject: [PATCH] Fix windows tests --- .github/workflows/build-windows.yml | 7 +++++-- gtsam/discrete/AlgebraicDecisionTree.h | 2 +- gtsam/linear/SubgraphBuilder.h | 2 +- gtsam/sfm/TranslationRecovery.h | 2 +- gtsam_unstable/geometry/Event.h | 6 +++--- gtsam_unstable/partition/GenericGraph.h | 7 ++++--- gtsam_unstable/partition/tests/CMakeLists.txt | 2 +- gtsam_unstable/slam/ProjectionFactorPPPC.h | 2 +- .../slam/SmartProjectionPoseFactorRollingShutter.h | 2 +- .../slam/tests/testSmartStereoProjectionPoseFactor.cpp | 10 +++++----- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a1d232b2a..f0568394f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -150,7 +150,10 @@ jobs: # cmake --build build -j4 --config ${{ matrix.build_type }} --target check.dynamics_unstable # Compile. Fail with exception # cmake --build build -j4 --config ${{ matrix.build_type }} --target check.nonlinear_unstable - # Compilation error + # Compile. Fail with exception # cmake --build build -j4 --config ${{ matrix.build_type }} --target check.slam_unstable - # Compilation error + # Compile. Fail with exception # cmake --build build -j4 --config ${{ matrix.build_type }} --target check.partition + + # Run all tests + # cmake --build build -j1 --config ${{ matrix.build_type }} --target check diff --git a/gtsam/discrete/AlgebraicDecisionTree.h b/gtsam/discrete/AlgebraicDecisionTree.h index 20ab4bd68..9f55f3b63 100644 --- a/gtsam/discrete/AlgebraicDecisionTree.h +++ b/gtsam/discrete/AlgebraicDecisionTree.h @@ -36,7 +36,7 @@ namespace gtsam { * @ingroup discrete */ template - class GTSAM_EXPORT AlgebraicDecisionTree : public DecisionTree { + class AlgebraicDecisionTree : public DecisionTree { /** * @brief Default method used by `labelFormatter` or `valueFormatter` when * printing. diff --git a/gtsam/linear/SubgraphBuilder.h b/gtsam/linear/SubgraphBuilder.h index aafba9306..f9ddd4c9a 100644 --- a/gtsam/linear/SubgraphBuilder.h +++ b/gtsam/linear/SubgraphBuilder.h @@ -182,7 +182,7 @@ GaussianFactorGraph buildFactorSubgraph(const GaussianFactorGraph &gfg, /** Split the graph into a subgraph and the remaining edges. * Note that the remaining factorgraph has null factors. */ -std::pair splitFactorGraph( +std::pair GTSAM_EXPORT splitFactorGraph( const GaussianFactorGraph &factorGraph, const Subgraph &subgraph); } // namespace gtsam diff --git a/gtsam/sfm/TranslationRecovery.h b/gtsam/sfm/TranslationRecovery.h index 44a5ef43e..4848d7cfa 100644 --- a/gtsam/sfm/TranslationRecovery.h +++ b/gtsam/sfm/TranslationRecovery.h @@ -48,7 +48,7 @@ namespace gtsam { // where s is an arbitrary scale that can be supplied, default 1.0. Hence, two // versions are supplied below corresponding to whether we have initial values // or not. -class TranslationRecovery { +class GTSAM_EXPORT TranslationRecovery { public: using KeyPair = std::pair; using TranslationEdges = std::vector>; diff --git a/gtsam_unstable/geometry/Event.h b/gtsam_unstable/geometry/Event.h index a4055d038..a3c907646 100644 --- a/gtsam_unstable/geometry/Event.h +++ b/gtsam_unstable/geometry/Event.h @@ -34,7 +34,7 @@ namespace gtsam { * SLAM, where we have "time of arrival" measurements at a set of sensors. The * TOA functor below provides a measurement function for those applications. */ -class Event { +class GTSAM_UNSTABLE_EXPORT Event { double time_; ///< Time event was generated Point3 location_; ///< Location at time event was generated @@ -62,10 +62,10 @@ class Event { } /** print with optional string */ - GTSAM_UNSTABLE_EXPORT void print(const std::string& s = "") const; + void print(const std::string& s = "") const; /** equals with an tolerance */ - GTSAM_UNSTABLE_EXPORT bool equals(const Event& other, + bool equals(const Event& other, double tol = 1e-9) const; /// Updates a with tangent space delta diff --git a/gtsam_unstable/partition/GenericGraph.h b/gtsam_unstable/partition/GenericGraph.h index bcfd77336..a7f2c1ea3 100644 --- a/gtsam_unstable/partition/GenericGraph.h +++ b/gtsam_unstable/partition/GenericGraph.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "PartitionWorkSpace.h" @@ -49,7 +50,7 @@ namespace gtsam { namespace partition { typedef std::vector GenericGraph2D; /** merge nodes in DSF using constraints captured by the given graph */ - std::list > findIslands(const GenericGraph2D& graph, const std::vector& keys, WorkSpace& workspace, + std::list > GTSAM_UNSTABLE_EXPORT findIslands(const GenericGraph2D& graph, const std::vector& keys, WorkSpace& workspace, const int minNrConstraintsPerCamera, const int minNrConstraintsPerLandmark); /** eliminate the sensors from generic graph */ @@ -97,11 +98,11 @@ namespace gtsam { namespace partition { typedef std::vector GenericGraph3D; /** merge nodes in DSF using constraints captured by the given graph */ - std::list > findIslands(const GenericGraph3D& graph, const std::vector& keys, WorkSpace& workspace, + std::list > GTSAM_UNSTABLE_EXPORT findIslands(const GenericGraph3D& graph, const std::vector& keys, WorkSpace& workspace, const size_t minNrConstraintsPerCamera, const size_t minNrConstraintsPerLandmark); /** eliminate the sensors from generic graph */ - void reduceGenericGraph(const GenericGraph3D& graph, const std::vector& cameraKeys, const std::vector& landmarkKeys, + void GTSAM_UNSTABLE_EXPORT reduceGenericGraph(const GenericGraph3D& graph, const std::vector& cameraKeys, const std::vector& landmarkKeys, const std::vector& dictionary, GenericGraph3D& reducedGraph); /** check whether the 3D graph is singular (under constrained) */ diff --git a/gtsam_unstable/partition/tests/CMakeLists.txt b/gtsam_unstable/partition/tests/CMakeLists.txt index 0b918e497..4ca6b9186 100644 --- a/gtsam_unstable/partition/tests/CMakeLists.txt +++ b/gtsam_unstable/partition/tests/CMakeLists.txt @@ -1,6 +1,6 @@ set(ignore_test "testNestedDissection.cpp") -if (NOT GTSAM_USE_BOOST_FEATURES) +if (NOT GTSAM_USE_BOOST_FEATURES OR MSVC) list(APPEND ignore_test "testFindSeparator.cpp") endif() diff --git a/gtsam_unstable/slam/ProjectionFactorPPPC.h b/gtsam_unstable/slam/ProjectionFactorPPPC.h index 5b6a83a33..df63330df 100644 --- a/gtsam_unstable/slam/ProjectionFactorPPPC.h +++ b/gtsam_unstable/slam/ProjectionFactorPPPC.h @@ -32,7 +32,7 @@ namespace gtsam { * @ingroup slam */ template -class GTSAM_UNSTABLE_EXPORT ProjectionFactorPPPC +class ProjectionFactorPPPC : public NoiseModelFactorN { protected: Point2 measured_; ///< 2D measurement diff --git a/gtsam_unstable/slam/SmartProjectionPoseFactorRollingShutter.h b/gtsam_unstable/slam/SmartProjectionPoseFactorRollingShutter.h index 4af0be751..4a2047ee1 100644 --- a/gtsam_unstable/slam/SmartProjectionPoseFactorRollingShutter.h +++ b/gtsam_unstable/slam/SmartProjectionPoseFactorRollingShutter.h @@ -42,7 +42,7 @@ namespace gtsam { * @ingroup slam */ template -class GTSAM_UNSTABLE_EXPORT SmartProjectionPoseFactorRollingShutter +class SmartProjectionPoseFactorRollingShutter : public SmartProjectionFactor { private: typedef SmartProjectionFactor Base; diff --git a/gtsam_unstable/slam/tests/testSmartStereoProjectionPoseFactor.cpp b/gtsam_unstable/slam/tests/testSmartStereoProjectionPoseFactor.cpp index 1eceb8061..872cd2dea 100644 --- a/gtsam_unstable/slam/tests/testSmartStereoProjectionPoseFactor.cpp +++ b/gtsam_unstable/slam/tests/testSmartStereoProjectionPoseFactor.cpp @@ -1441,14 +1441,14 @@ TEST( SmartStereoProjectionPoseFactor, HessianWithRotationNonDegenerate ) { std::shared_ptr hessianFactorRotTran = smartFactor->linearize(tranValues); - // Hessian is invariant to rotations and translations in the degenerate case - EXPECT( - assert_equal(hessianFactor->information(), + double error; #ifdef GTSAM_USE_EIGEN_MKL - hessianFactorRotTran->information(), 1e-5)); + error = 1e-5; #else - hessianFactorRotTran->information(), 1e-6)); + error = 1e-6; #endif + // Hessian is invariant to rotations and translations in the degenerate case + EXPECT(assert_equal(hessianFactor->information(), hessianFactorRotTran->information(), error)); } /* ************************************************************************* */