Merge pull request #193 from borglab/feature/add-appveyor

Add AppVeyor CI for MSVC
release/4.3a0
Jose Luis Blanco-Claraco 2019-12-29 08:58:53 +01:00 committed by GitHub
commit b967c60ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 128 additions and 27 deletions

View File

@ -88,7 +88,7 @@ if(NOT MSVC AND NOT XCODE_VERSION)
# Set the GTSAM_BUILD_TAG variable.
# If build type is Release, set to blank (""), else set to the build type.
if("${CMAKE_BUILD_TYPE_UPPER}" STREQUAL "RELEASE")
if(${CMAKE_BUILD_TYPE_UPPER} STREQUAL "RELEASE")
set(GTSAM_BUILD_TAG "") # Don't create release mode tag on installed directory
else()
set(GTSAM_BUILD_TAG "${CMAKE_BUILD_TYPE}")

View File

@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/borglab/gtsam.svg?branch=develop)](https://travis-ci.com/borglab/gtsam/)
gcc/clang: [![Build Status](https://travis-ci.com/borglab/gtsam.svg?branch=develop)](https://travis-ci.com/borglab/gtsam/) MSVC: [![Build status](https://ci.appveyor.com/api/projects/status/3enllitj52jsxwfg/branch/develop?svg=true)](https://ci.appveyor.com/project/dellaert/gtsam)
# README - Georgia Tech Smoothing and Mapping library

33
appveyor.yml Normal file
View File

@ -0,0 +1,33 @@
# version format
version: 4.0.2-{branch}-build{build}
os: Visual Studio 2019
clone_folder: c:\projects\gtsam
platform: x64
configuration: Release
environment:
CTEST_OUTPUT_ON_FAILURE: 1
BOOST_ROOT: C:/Libraries/boost_1_71_0
build_script:
- cd c:\projects\gtsam\build
# As of Dec 2019, not all unit tests build cleanly for MSVC, so we'll just
# check that parts of GTSAM build correctly:
#- cmake --build .
- cmake --build . --config Release --target gtsam
- cmake --build . --config Release --target gtsam_unstable
- cmake --build . --config Release --target wrap
#- cmake --build . --target check
- cmake --build . --config Release --target check.base
- cmake --build . --config Release --target check.base_unstable
- cmake --build . --config Release --target check.linear
before_build:
- cd c:\projects\gtsam
- mkdir build
- cd build
# Disable examples to avoid AppVeyor timeout
- cmake -G "Visual Studio 16 2019" .. -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF

View File

@ -81,6 +81,11 @@ if(MSVC)
WINDOWS_LEAN_AND_MEAN
NOMINMAX
)
# Avoid literally hundreds to thousands of warnings:
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC
/wd4267 # warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
)
endif()
# Other (non-preprocessor macros) compiler flags:

View File

@ -47,3 +47,17 @@ if(GTSAM_BUILD_METIS_EXECUTABLES)
endif()
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)
# Export macros assumed in metis public headers to clients of the library.
# This was added to solve MSVC build errors.
if (TARGET metis AND GKlib_COPTIONS)
# Remove (possibly) duplicated symbols:
string(REPLACE -DLINUX "" GKlib_COPTIONS ${GKlib_COPTIONS})
string(REPLACE -DWIN32 "" GKlib_COPTIONS ${GKlib_COPTIONS})
string(REPLACE -DNDEBUG2 "" GKlib_COPTIONS ${GKlib_COPTIONS})
string(REPLACE -DNDEBUG "" GKlib_COPTIONS ${GKlib_COPTIONS})
string(REPLACE -pedantic "" GKlib_COPTIONS ${GKlib_COPTIONS})
string(REPLACE -std=c99 "" GKlib_COPTIONS ${GKlib_COPTIONS})
separate_arguments(GKlib_COPTIONS)
# Declare those flags as to-be-imported in "client libraries", i.e. "gtsam"
target_compile_options(metis INTERFACE ${GKlib_COPTIONS})
endif()

View File

@ -32,7 +32,7 @@ namespace gtsam {
//******************************************************************************
namespace so3 {
Matrix99 Dcompose(const SO3& Q) {
GTSAM_EXPORT Matrix99 Dcompose(const SO3& Q) {
Matrix99 H;
auto R = Q.matrix();
H << I_3x3 * R(0, 0), I_3x3 * R(1, 0), I_3x3 * R(2, 0), //
@ -41,7 +41,7 @@ Matrix99 Dcompose(const SO3& Q) {
return H;
}
Matrix3 compose(const Matrix3& M, const SO3& R, OptionalJacobian<9, 9> H) {
GTSAM_EXPORT Matrix3 compose(const Matrix3& M, const SO3& R, OptionalJacobian<9, 9> H) {
Matrix3 MR = M * R.matrix();
if (H) *H = Dcompose(R);
return MR;
@ -134,12 +134,14 @@ Vector3 DexpFunctor::applyInvDexp(const Vector3& v, OptionalJacobian<3, 3> H1,
//******************************************************************************
template <>
GTSAM_EXPORT
SO3 SO3::AxisAngle(const Vector3& axis, double theta) {
return so3::ExpmapFunctor(axis, theta).expmap();
}
//******************************************************************************
template <>
GTSAM_EXPORT
SO3 SO3::ClosestTo(const Matrix3& M) {
Eigen::JacobiSVD<Matrix3> svd(M, Eigen::ComputeFullU | Eigen::ComputeFullV);
const auto& U = svd.matrixU();
@ -150,6 +152,7 @@ SO3 SO3::ClosestTo(const Matrix3& M) {
//******************************************************************************
template <>
GTSAM_EXPORT
SO3 SO3::ChordalMean(const std::vector<SO3>& rotations) {
// See Hartley13ijcv:
// Cost function C(R) = \sum sqr(|R-R_i|_F)
@ -163,6 +166,7 @@ SO3 SO3::ChordalMean(const std::vector<SO3>& rotations) {
//******************************************************************************
template <>
GTSAM_EXPORT
Matrix3 SO3::Hat(const Vector3& xi) {
// skew symmetric matrix X = xi^
Matrix3 Y = Z_3x3;
@ -174,6 +178,7 @@ Matrix3 SO3::Hat(const Vector3& xi) {
//******************************************************************************
template <>
GTSAM_EXPORT
Vector3 SO3::Vee(const Matrix3& X) {
Vector3 xi;
xi(0) = -X(1, 2);
@ -184,12 +189,14 @@ Vector3 SO3::Vee(const Matrix3& X) {
//******************************************************************************
template <>
GTSAM_EXPORT
Matrix3 SO3::AdjointMap() const {
return matrix_;
}
//******************************************************************************
template <>
GTSAM_EXPORT
SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H) {
if (H) {
so3::DexpFunctor impl(omega);
@ -201,6 +208,7 @@ SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H) {
}
template <>
GTSAM_EXPORT
Matrix3 SO3::ExpmapDerivative(const Vector3& omega) {
return so3::DexpFunctor(omega).dexp();
}
@ -217,6 +225,7 @@ Matrix3 SO3::ExpmapDerivative(const Vector3& omega) {
omega)
*/
template <>
GTSAM_EXPORT
Matrix3 SO3::LogmapDerivative(const Vector3& omega) {
using std::cos;
using std::sin;
@ -234,6 +243,7 @@ Matrix3 SO3::LogmapDerivative(const Vector3& omega) {
//******************************************************************************
template <>
GTSAM_EXPORT
Vector3 SO3::Logmap(const SO3& Q, ChartJacobian H) {
using std::sin;
using std::sqrt;
@ -281,11 +291,13 @@ Vector3 SO3::Logmap(const SO3& Q, ChartJacobian H) {
// Chart at origin for SO3 is *not* Cayley but actual Expmap/Logmap
template <>
GTSAM_EXPORT
SO3 SO3::ChartAtOrigin::Retract(const Vector3& omega, ChartJacobian H) {
return Expmap(omega, H);
}
template <>
GTSAM_EXPORT
Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H) {
return Logmap(R, H);
}
@ -307,6 +319,7 @@ static const Matrix93 P3 =
//******************************************************************************
template <>
GTSAM_EXPORT
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const {
const Matrix3& R = matrix_;
if (H) {

View File

@ -24,6 +24,7 @@
#include <gtsam/base/Lie.h>
#include <gtsam/base/Matrix.h>
#include <gtsam/dllexport.h>
#include <cmath>
#include <vector>
@ -36,18 +37,23 @@ using SO3 = SO<3>;
// They are *defined* in SO3.cpp.
template <>
GTSAM_EXPORT
SO3 SO3::AxisAngle(const Vector3& axis, double theta);
template <>
GTSAM_EXPORT
SO3 SO3::ClosestTo(const Matrix3& M);
template <>
GTSAM_EXPORT
SO3 SO3::ChordalMean(const std::vector<SO3>& rotations);
template <>
GTSAM_EXPORT
Matrix3 SO3::Hat(const Vector3& xi); ///< make skew symmetric matrix
template <>
GTSAM_EXPORT
Vector3 SO3::Vee(const Matrix3& X); ///< inverse of Hat
/// Adjoint map
@ -59,10 +65,12 @@ Matrix3 SO3::AdjointMap() const;
* \f$ [R_x,R_y,R_z] \f$ using Rodrigues' formula
*/
template <>
GTSAM_EXPORT
SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H);
/// Derivative of Expmap
template <>
GTSAM_EXPORT
Matrix3 SO3::ExpmapDerivative(const Vector3& omega);
/**
@ -70,20 +78,25 @@ Matrix3 SO3::ExpmapDerivative(const Vector3& omega);
* \f$ [R_x,R_y,R_z] \f$ of this rotation
*/
template <>
GTSAM_EXPORT
Vector3 SO3::Logmap(const SO3& R, ChartJacobian H);
/// Derivative of Logmap
template <>
GTSAM_EXPORT
Matrix3 SO3::LogmapDerivative(const Vector3& omega);
// Chart at origin for SO3 is *not* Cayley but actual Expmap/Logmap
template <>
GTSAM_EXPORT
SO3 SO3::ChartAtOrigin::Retract(const Vector3& omega, ChartJacobian H);
template <>
GTSAM_EXPORT
Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H);
template <>
GTSAM_EXPORT
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const;
/** Serialization function */
@ -107,11 +120,11 @@ namespace so3 {
* Compose general matrix with an SO(3) element.
* We only provide the 9*9 derivative in the first argument M.
*/
Matrix3 compose(const Matrix3& M, const SO3& R,
GTSAM_EXPORT Matrix3 compose(const Matrix3& M, const SO3& R,
OptionalJacobian<9, 9> H = boost::none);
/// (constant) Jacobian of compose wrpt M
Matrix99 Dcompose(const SO3& R);
GTSAM_EXPORT Matrix99 Dcompose(const SO3& R);
// Below are two functors that allow for saving computation when exponential map
// and its derivatives are needed at the same location in so<3>. The second

View File

@ -50,6 +50,7 @@ namespace gtsam {
//******************************************************************************
template <>
GTSAM_EXPORT
Matrix4 SO4::Hat(const Vector6& xi) {
// skew symmetric matrix X = xi^
// Unlike Luca, makes upper-left the SO(3) subgroup.
@ -65,6 +66,7 @@ Matrix4 SO4::Hat(const Vector6& xi) {
//******************************************************************************
template <>
GTSAM_EXPORT
Vector6 SO4::Vee(const Matrix4& X) {
Vector6 xi;
xi(5) = -X(0, 1);
@ -81,6 +83,7 @@ Vector6 SO4::Vee(const Matrix4& X) {
* "SOME REMARKS ON THE EXPONENTIAL MAP ON THE GROUPS SO(n) AND SE(n)" by
* Ramona-Andreaa Rohan */
template <>
GTSAM_EXPORT
SO4 SO4::Expmap(const Vector6& xi, ChartJacobian H) {
using namespace std;
if (H) throw std::runtime_error("SO4::Expmap Jacobian");
@ -151,6 +154,7 @@ static const Eigen::Matrix<double, 16, 6> P4 =
//******************************************************************************
template <>
GTSAM_EXPORT
Matrix6 SO4::AdjointMap() const {
// Elaborate way of calculating the AdjointMap
// TODO(frank): find a closed form solution. In SO(3) is just R :-/
@ -166,6 +170,7 @@ Matrix6 SO4::AdjointMap() const {
//******************************************************************************
template <>
GTSAM_EXPORT
SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const {
const Matrix& Q = matrix_;
if (H) {
@ -178,6 +183,7 @@ SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const {
///******************************************************************************
template <>
GTSAM_EXPORT
SO4 SO4::ChartAtOrigin::Retract(const Vector6& xi, ChartJacobian H) {
if (H) throw std::runtime_error("SO4::ChartAtOrigin::Retract Jacobian");
gttic(SO4_Retract);
@ -187,6 +193,7 @@ SO4 SO4::ChartAtOrigin::Retract(const Vector6& xi, ChartJacobian H) {
//******************************************************************************
template <>
GTSAM_EXPORT
Vector6 SO4::ChartAtOrigin::Local(const SO4& Q, ChartJacobian H) {
if (H) throw std::runtime_error("SO4::ChartAtOrigin::Retract Jacobian");
const Matrix4& R = Q.matrix();
@ -195,7 +202,7 @@ Vector6 SO4::ChartAtOrigin::Local(const SO4& Q, ChartJacobian H) {
}
//******************************************************************************
Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H) {
GTSAM_EXPORT Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H) {
const Matrix4& R = Q.matrix();
const Matrix3 M = R.topLeftCorner<3, 3>();
if (H) {
@ -209,7 +216,7 @@ Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H) {
}
//******************************************************************************
Matrix43 stiefel(const SO4& Q, OptionalJacobian<12, 6> H) {
GTSAM_EXPORT Matrix43 stiefel(const SO4& Q, OptionalJacobian<12, 6> H) {
const Matrix4& R = Q.matrix();
const Matrix43 M = R.leftCols<3>();
if (H) {

View File

@ -25,6 +25,7 @@
#include <gtsam/base/Lie.h>
#include <gtsam/base/Manifold.h>
#include <gtsam/base/Matrix.h>
#include <gtsam/dllexport.h>
#include <boost/random/mersenne_twister.hpp>
@ -41,36 +42,43 @@ using SO4 = SO<4>;
// They are *defined* in SO4.cpp.
template <>
GTSAM_EXPORT
Matrix4 SO4::Hat(const TangentVector &xi);
template <>
GTSAM_EXPORT
Vector6 SO4::Vee(const Matrix4 &X);
template <>
GTSAM_EXPORT
SO4 SO4::Expmap(const Vector6 &xi, ChartJacobian H);
template <>
GTSAM_EXPORT
Matrix6 SO4::AdjointMap() const;
template <>
GTSAM_EXPORT
SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const;
template <>
GTSAM_EXPORT
SO4 SO4::ChartAtOrigin::Retract(const Vector6 &omega, ChartJacobian H);
template <>
GTSAM_EXPORT
Vector6 SO4::ChartAtOrigin::Local(const SO4 &Q, ChartJacobian H);
/**
* Project to top-left 3*3 matrix. Note this is *not* in general \in SO(3).
*/
Matrix3 topLeft(const SO4 &Q, OptionalJacobian<9, 6> H = boost::none);
GTSAM_EXPORT Matrix3 topLeft(const SO4 &Q, OptionalJacobian<9, 6> H = boost::none);
/**
* Project to Stiefel manifold of 4*3 orthonormal 3-frames in R^4, i.e., pi(Q)
* -> S \in St(3,4).
*/
Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = boost::none);
GTSAM_EXPORT Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = boost::none);
/** Serialization function */
template <class Archive>

View File

@ -21,6 +21,7 @@
namespace gtsam {
template <>
GTSAM_EXPORT
Matrix SOn::Hat(const Vector& xi) {
size_t n = AmbientDim(xi.size());
if (n < 2) throw std::invalid_argument("SO<N>::Hat: n<2 not supported");
@ -49,6 +50,7 @@ Matrix SOn::Hat(const Vector& xi) {
}
template <>
GTSAM_EXPORT
Vector SOn::Vee(const Matrix& X) {
const size_t n = X.rows();
if (n < 2) throw std::invalid_argument("SO<N>::Hat: n<2 not supported");

View File

@ -20,6 +20,7 @@
#include <gtsam/base/Lie.h>
#include <gtsam/base/Manifold.h>
#include <gtsam/dllexport.h>
#include <Eigen/Core>
#include <boost/random.hpp>
@ -297,9 +298,11 @@ using SOn = SO<Eigen::Dynamic>;
*/
template <>
GTSAM_EXPORT
Matrix SOn::Hat(const Vector& xi);
template <>
GTSAM_EXPORT
Vector SOn::Vee(const Matrix& X);
/*

View File

@ -123,7 +123,7 @@ boost::function<bool(gtsam::Key)> LabeledSymbol::TypeLabelTest(unsigned char c,
}
/* ************************************************************************* */
std::ostream &operator<<(std::ostream &os, const LabeledSymbol &symbol) {
GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const LabeledSymbol &symbol) {
os << StreamedKey(symbol);
return os;
}

View File

@ -107,7 +107,7 @@ public:
LabeledSymbol newLabel(unsigned char label) const { return LabeledSymbol(c_, label, j_); }
/// Output stream operator that can be used with key_formatter (see Key.h).
friend std::ostream &operator<<(std::ostream &, const LabeledSymbol &);
friend GTSAM_EXPORT std::ostream &operator<<(std::ostream &, const LabeledSymbol &);
private:

View File

@ -66,7 +66,7 @@ boost::function<bool(Key)> Symbol::ChrTest(unsigned char c) {
return bind(&Symbol::chr, bind(make, _1)) == c;
}
std::ostream &operator<<(std::ostream &os, const Symbol &symbol) {
GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const Symbol &symbol) {
os << StreamedKey(symbol);
return os;
}

View File

@ -113,7 +113,7 @@ public:
static boost::function<bool(Key)> ChrTest(unsigned char c);
/// Output stream operator that can be used with key_formatter (see Key.h).
friend std::ostream &operator<<(std::ostream &, const Symbol &);
GTSAM_EXPORT friend std::ostream &operator<<(std::ostream &, const Symbol &);
private:

View File

@ -49,16 +49,16 @@ struct GTSAM_EXPORT SlotEntry {
class Scatter : public FastVector<SlotEntry> {
public:
/// Default Constructor
Scatter() {}
GTSAM_EXPORT Scatter() {}
/// Construct from gaussian factor graph, without ordering
explicit Scatter(const GaussianFactorGraph& gfg);
GTSAM_EXPORT explicit Scatter(const GaussianFactorGraph& gfg);
/// Construct from gaussian factor graph, with (partial or complete) ordering
explicit Scatter(const GaussianFactorGraph& gfg, const Ordering& ordering);
GTSAM_EXPORT explicit Scatter(const GaussianFactorGraph& gfg, const Ordering& ordering);
/// Add a key/dim pair
void add(Key key, size_t dim);
GTSAM_EXPORT void add(Key key, size_t dim);
private:
/// Find the SlotEntry with the right key (linear time worst case)

View File

@ -129,7 +129,7 @@ namespace gtsam {
}
/* ************************************************************************* */
ostream& operator<<(ostream& os, const VectorValues& v) {
GTSAM_EXPORT ostream& operator<<(ostream& os, const VectorValues& v) {
// Change print depending on whether we are using TBB
#ifdef GTSAM_USE_TBB
map<Key, Vector> sorted;

View File

@ -230,7 +230,7 @@ namespace gtsam {
const_iterator find(Key j) const { return values_.find(j); }
/// overload operator << to print to stringstream
friend std::ostream& operator<<(std::ostream&, const VectorValues&);
GTSAM_EXPORT friend std::ostream& operator<<(std::ostream&, const VectorValues&);
/** print required by Testable for unit testing */
void print(const std::string& str = "VectorValues",

View File

@ -348,7 +348,9 @@ namespace gtsam {
throw ValuesKeyDoesNotExist("at", j);
// Check the type and throw exception if incorrect
return internal::handle<ValueType>()(j,item->second);
// h() split in two lines to avoid internal compiler error (MSVC2017)
auto h = internal::handle<ValueType>();
return h(j,item->second);
}
/* ************************************************************************* */

View File

@ -12,6 +12,7 @@
#include <stdexcept>
#include <iostream>
#include <vector>
#include <boost/tuple/tuple.hpp>
#include <boost/shared_array.hpp>
#include <boost/timer.hpp>
@ -40,14 +41,14 @@ namespace gtsam { namespace partition {
const sharedInts& adjncy, const sharedInts& adjwgt, bool verbose) {
// control parameters
idx_t vwgt[n]; // the weights of the vertices
std::vector<idx_t> vwgt; // the weights of the vertices
idx_t options[METIS_NOPTIONS];
METIS_SetDefaultOptions(options); // use defaults
idx_t sepsize; // the size of the separator, output
sharedInts part_(new idx_t[n]); // the partition of each vertex, output
// set uniform weights on the vertices
std::fill(vwgt, vwgt+n, 1);
vwgt.assign(n, 1);
// TODO: Fix at later time
//boost::timer::cpu_timer TOTALTmr;
@ -61,7 +62,7 @@ namespace gtsam { namespace partition {
// call metis parition routine
METIS_ComputeVertexSeparator(&n, xadj.get(), adjncy.get(),
vwgt, options, &sepsize, part_.get());
&vwgt[0], options, &sepsize, part_.get());
if (verbose) {
//boost::cpu_times const elapsed_times(timer.elapsed());
@ -127,14 +128,14 @@ namespace gtsam { namespace partition {
const sharedInts& adjwgt, bool verbose) {
// control parameters
idx_t vwgt[n]; // the weights of the vertices
std::vector<idx_t> vwgt; // the weights of the vertices
idx_t options[METIS_NOPTIONS];
METIS_SetDefaultOptions(options); // use defaults
idx_t edgecut; // the number of edge cuts, output
sharedInts part_(new idx_t[n]); // the partition of each vertex, output
// set uniform weights on the vertices
std::fill(vwgt, vwgt+n, 1);
vwgt.assign(n, 1);
//TODO: Fix later
//boost::timer TOTALTmr;
@ -150,7 +151,7 @@ namespace gtsam { namespace partition {
//int wgtflag = 1; // only edge weights
//int numflag = 0; // c style numbering starting from 0
//int nparts = 2; // partition the graph to 2 submaps
modefied_EdgeComputeSeparator(&n, xadj.get(), adjncy.get(), vwgt, adjwgt.get(),
modefied_EdgeComputeSeparator(&n, xadj.get(), adjncy.get(), &vwgt[0], adjwgt.get(),
options, &edgecut, part_.get());