Fixed build with g2o on Windows

This commit is contained in:
matlabbe
2016-01-14 17:07:01 -05:00
parent 444879ffc6
commit 2d6965aa4b
6 changed files with 44 additions and 24 deletions

View File

@@ -157,6 +157,9 @@ IF(FlyCapture2_FOUND)
ENDIF(FlyCapture2_FOUND)
IF(G2O_FOUND)
IF(G2O_CHOMOLD_FOUND)
ADD_DEFINITIONS("-DWITH_G2O_CHOMOLD")
ENDIF(G2O_CHOMOLD_FOUND)
ADD_DEFINITIONS("-DWITH_G2O")
SET(INCLUDE_DIRS
${INCLUDE_DIRS}
@@ -169,7 +172,6 @@ IF(G2O_FOUND)
SET(SRC_FILES
${SRC_FILES}
vertigo/g2o/edge_se2MaxMixture.cpp
vertigo/g2o/edge_se2Switchable.cpp
vertigo/g2o/edge_se3Switchable.cpp
vertigo/g2o/edge_switchPrior.cpp

View File

@@ -42,8 +42,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "g2o/core/optimization_algorithm_gauss_newton.h"
#include "g2o/core/optimization_algorithm_levenberg.h"
#include "g2o/solvers/csparse/linear_solver_csparse.h"
#include "g2o/solvers/cholmod/linear_solver_cholmod.h"
#include "g2o/solvers/pcg/linear_solver_pcg.h"
#ifdef WITH_G2O_CHOMOLD
#include "g2o/solvers/cholmod/linear_solver_cholmod.h"
#endif
#include "g2o/types/slam3d/vertex_se3.h"
#include "g2o/types/slam3d/edge_se3.h"
#include "g2o/types/slam2d/vertex_se2.h"
@@ -51,8 +53,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
typedef g2o::BlockSolver< g2o::BlockSolverTraits<-1, -1> > SlamBlockSolver;
typedef g2o::LinearSolverCSparse<SlamBlockSolver::PoseMatrixType> SlamLinearCSparseSolver;
typedef g2o::LinearSolverCholmod<SlamBlockSolver::PoseMatrixType> SlamLinearCholmodSolver;
typedef g2o::LinearSolverPCG<SlamBlockSolver::PoseMatrixType> SlamLinearPCGSolver;
#ifdef WITH_G2O_CHOMOLD
typedef g2o::LinearSolverCholmod<SlamBlockSolver::PoseMatrixType> SlamLinearCholmodSolver;
#endif
#include "vertigo/g2o/edge_switchPrior.h"
#include "vertigo/g2o/edge_se2Switchable.h"
@@ -94,26 +98,31 @@ std::map<int, Transform> OptimizerG2O::optimize(
int optimizationApproach = 1;
SlamBlockSolver * blockSolver;
if(solverApproach == 1)
#ifdef WITH_G2O_CHOMOLD
if(solverApproach == 0)
{
//chmold
SlamLinearCholmodSolver * linearSolver = new SlamLinearCholmodSolver();
linearSolver->setBlockOrdering(false);
blockSolver = new SlamBlockSolver(linearSolver);
}
else if
#else
if
#endif
(solverApproach == 1)
{
//pcg
SlamLinearPCGSolver * linearSolver = new SlamLinearPCGSolver();
blockSolver = new SlamBlockSolver(linearSolver);
}
else if(solverApproach == 2)
else
{
//csparse
SlamLinearCSparseSolver* linearSolver = new SlamLinearCSparseSolver();
linearSolver->setBlockOrdering(false);
blockSolver = new SlamBlockSolver(linearSolver);
}
else
{
//chmold
SlamLinearCholmodSolver * linearSolver = new SlamLinearCholmodSolver();
linearSolver->setBlockOrdering(false);
blockSolver = new SlamBlockSolver(linearSolver);
}
if(optimizationApproach == 1)
{

View File

@@ -8,12 +8,11 @@
#include "edge_se2MaxMixture.h"
#include <GL/gl.h>
using namespace std;
using namespace Eigen;
// ================================================
EdgeSE2MaxMixture::EdgeSE2MaxMixture() : g2o::EdgeSE2::EdgeSE2()
EdgeSE2MaxMixture::EdgeSE2MaxMixture()
{
nullHypothesisMoreLikely = false;
}
@@ -89,6 +88,7 @@ void EdgeSE2MaxMixture::computeError()
}
/*
#include <GL/gl.h>
// ================================================
#ifdef G2O_HAVE_OPENGL
EdgeSE2MaxMixtureDrawAction::EdgeSE2MaxMixtureDrawAction(): DrawAction(typeid(EdgeSE2MaxMixture).name()){}

View File

@@ -10,7 +10,6 @@
#include "vertigo/g2o/edge_se2Switchable.h"
#include "vertigo/g2o/vertex_switchLinear.h"
#include <GL/gl.h>
using namespace std;
using namespace Eigen;
@@ -103,6 +102,7 @@ void EdgeSE2Switchable::computeError()
}
/*
#include <GL/gl.h>
#ifdef G2O_HAVE_OPENGL
EdgeSE2SwitchableDrawAction::EdgeSE2SwitchableDrawAction(): DrawAction(typeid(EdgeSE2Switchable).name()){}

View File

@@ -10,7 +10,6 @@
#include "vertigo/g2o/edge_se3Switchable.h"
#include "vertigo/g2o/vertex_switchLinear.h"
#include <GL/gl.h>
#include "g2o/types/slam3d/vertex_se3.h"
#include "g2o/types/slam3d/isometry3d_gradients.h"
@@ -93,6 +92,7 @@ void EdgeSE3Switchable::computeError()
}
/*
#include <GL/gl.h>
#ifdef G2O_HAVE_OPENGL
EdgeSE3SwitchableDrawAction::EdgeSE3SwitchableDrawAction(): DrawAction(typeid(EdgeSE3Switchable).name()){}