Skip to content

Commit

Permalink
Fix linkage error:
Browse files Browse the repository at this point in the history
- GTSAM_EXPORT on functions.
- GTSAM_EXPORT on nested struts / classes.
  • Loading branch information
talregev committed Jun 30, 2023
1 parent ffb2c0d commit 8ef4475
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
build_type:
- Debug
# - Release
- Release

build_unstable:
- ON
Expand Down
2 changes: 1 addition & 1 deletion gtsam/basis/Basis.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ using Weights = Eigen::Matrix<double, 1, -1>; /* 1xN vector */
*
* @ingroup basis
*/
Matrix kroneckerProductIdentity(size_t M, const Weights& w);
Matrix GTSAM_EXPORT kroneckerProductIdentity(size_t M, const Weights& w);

/**
* CRTP Base class for function bases
Expand Down
2 changes: 1 addition & 1 deletion gtsam/discrete/SignatureParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace gtsam {
*
* Also fails if the rows are not of the same size.
*/
struct SignatureParser {
struct GTSAM_EXPORT SignatureParser {
using Row = std::vector<double>;
using Table = std::vector<Row>;

Expand Down
40 changes: 20 additions & 20 deletions gtsam/geometry/Pose2.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace gtsam {
* @ingroup geometry
* \nosubgrouping
*/
class Pose2: public LieGroup<Pose2, 3> {
class GTSAM_EXPORT Pose2: public LieGroup<Pose2, 3> {

public:

Expand Down Expand Up @@ -112,10 +112,10 @@ class Pose2: public LieGroup<Pose2, 3> {
/// @{

/** print with optional string */
GTSAM_EXPORT void print(const std::string& s = "") const;
void print(const std::string& s = "") const;

/** assert equality up to a tolerance */
GTSAM_EXPORT bool equals(const Pose2& pose, double tol = 1e-9) const;
bool equals(const Pose2& pose, double tol = 1e-9) const;

/// @}
/// @name Group
Expand All @@ -125,7 +125,7 @@ class Pose2: public LieGroup<Pose2, 3> {
inline static Pose2 Identity() { return Pose2(); }

/// inverse
GTSAM_EXPORT Pose2 inverse() const;
Pose2 inverse() const;

/// compose syntactic sugar
inline Pose2 operator*(const Pose2& p2) const {
Expand All @@ -137,16 +137,16 @@ class Pose2: public LieGroup<Pose2, 3> {
/// @{

///Exponential map at identity - create a rotation from canonical coordinates \f$ [T_x,T_y,\theta] \f$
GTSAM_EXPORT static Pose2 Expmap(const Vector3& xi, ChartJacobian H = {});
static Pose2 Expmap(const Vector3& xi, ChartJacobian H = {});

///Log map at identity - return the canonical coordinates \f$ [T_x,T_y,\theta] \f$ of this rotation
GTSAM_EXPORT static Vector3 Logmap(const Pose2& p, ChartJacobian H = {});
static Vector3 Logmap(const Pose2& p, ChartJacobian H = {});

/**
* Calculate Adjoint map
* Ad_pose is 3*3 matrix that when applied to twist xi \f$ [T_x,T_y,\theta] \f$, returns Ad_pose(xi)
*/
GTSAM_EXPORT Matrix3 AdjointMap() const;
Matrix3 AdjointMap() const;

/// Apply AdjointMap to twist xi
inline Vector3 Adjoint(const Vector3& xi) const {
Expand All @@ -156,7 +156,7 @@ class Pose2: public LieGroup<Pose2, 3> {
/**
* Compute the [ad(w,v)] operator for SE2 as in [Kobilarov09siggraph], pg 19
*/
GTSAM_EXPORT static Matrix3 adjointMap(const Vector3& v);
static Matrix3 adjointMap(const Vector3& v);

/**
* Action of the adjointMap on a Lie-algebra vector y, with optional derivatives
Expand Down Expand Up @@ -192,15 +192,15 @@ class Pose2: public LieGroup<Pose2, 3> {
}

/// Derivative of Expmap
GTSAM_EXPORT static Matrix3 ExpmapDerivative(const Vector3& v);
static Matrix3 ExpmapDerivative(const Vector3& v);

/// Derivative of Logmap
GTSAM_EXPORT static Matrix3 LogmapDerivative(const Pose2& v);
static Matrix3 LogmapDerivative(const Pose2& v);

// Chart at origin, depends on compile-time flag SLOW_BUT_CORRECT_EXPMAP
struct ChartAtOrigin {
GTSAM_EXPORT static Pose2 Retract(const Vector3& v, ChartJacobian H = {});
GTSAM_EXPORT static Vector3 Local(const Pose2& r, ChartJacobian H = {});
struct GTSAM_EXPORT ChartAtOrigin {
static Pose2 Retract(const Vector3& v, ChartJacobian H = {});
static Vector3 Local(const Pose2& r, ChartJacobian H = {});
};

using LieGroup<Pose2, 3>::inverse; // version with derivative
Expand All @@ -210,7 +210,7 @@ class Pose2: public LieGroup<Pose2, 3> {
/// @{

/** Return point coordinates in pose coordinate frame */
GTSAM_EXPORT Point2 transformTo(const Point2& point,
Point2 transformTo(const Point2& point,
OptionalJacobian<2, 3> Dpose = {},
OptionalJacobian<2, 2> Dpoint = {}) const;

Expand All @@ -222,7 +222,7 @@ class Pose2: public LieGroup<Pose2, 3> {
Matrix transformTo(const Matrix& points) const;

/** Return point coordinates in global frame */
GTSAM_EXPORT Point2 transformFrom(const Point2& point,
Point2 transformFrom(const Point2& point,
OptionalJacobian<2, 3> Dpose = {},
OptionalJacobian<2, 2> Dpoint = {}) const;

Expand Down Expand Up @@ -273,30 +273,30 @@ class Pose2: public LieGroup<Pose2, 3> {
}

//// return transformation matrix
GTSAM_EXPORT Matrix3 matrix() const;
Matrix3 matrix() const;

/**
* Calculate bearing to a landmark
* @param point 2D location of landmark
* @return 2D rotation \f$ \in SO(2) \f$
*/
GTSAM_EXPORT Rot2 bearing(const Point2& point,
Rot2 bearing(const Point2& point,
OptionalJacobian<1, 3> H1={}, OptionalJacobian<1, 2> H2={}) const;

/**
* Calculate bearing to another pose
* @param point SO(2) location of other pose
* @return 2D rotation \f$ \in SO(2) \f$
*/
GTSAM_EXPORT Rot2 bearing(const Pose2& pose,
Rot2 bearing(const Pose2& pose,
OptionalJacobian<1, 3> H1={}, OptionalJacobian<1, 3> H2={}) const;

/**
* Calculate range to a landmark
* @param point 2D location of landmark
* @return range (double)
*/
GTSAM_EXPORT double range(const Point2& point,
double range(const Point2& point,
OptionalJacobian<1, 3> H1={},
OptionalJacobian<1, 2> H2={}) const;

Expand All @@ -305,7 +305,7 @@ class Pose2: public LieGroup<Pose2, 3> {
* @param point 2D location of other pose
* @return range (double)
*/
GTSAM_EXPORT double range(const Pose2& point,
double range(const Pose2& point,
OptionalJacobian<1, 3> H1={},
OptionalJacobian<1, 3> H2={}) const;

Expand Down
2 changes: 1 addition & 1 deletion gtsam/geometry/Pose3.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class GTSAM_EXPORT Pose3: public LieGroup<Pose3, 6> {
static Matrix6 LogmapDerivative(const Pose3& xi);

// Chart at origin, depends on compile-time flag GTSAM_POSE3_EXPMAP
struct ChartAtOrigin {
struct GTSAM_EXPORT ChartAtOrigin {
static Pose3 Retract(const Vector6& xi, ChartJacobian Hxi = {});
static Vector6 Local(const Pose3& pose, ChartJacobian Hpose = {});
};
Expand Down
2 changes: 1 addition & 1 deletion gtsam/geometry/Rot2.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace gtsam {
}

// Chart at origin simply uses exponential map and its inverse
struct ChartAtOrigin {
struct GTSAM_EXPORT ChartAtOrigin {
static Rot2 Retract(const Vector1& v, ChartJacobian H = {}) {
return Expmap(v, H);
}
Expand Down
2 changes: 1 addition & 1 deletion gtsam/geometry/Rot3.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class GTSAM_EXPORT Rot3 : public LieGroup<Rot3, 3> {
Matrix3 AdjointMap() const { return matrix(); }

// Chart at origin, depends on compile-time flag ROT3_DEFAULT_COORDINATES_MODE
struct ChartAtOrigin {
struct GTSAM_EXPORT ChartAtOrigin {
static Rot3 Retract(const Vector3& v, ChartJacobian H = {});
static Vector3 Local(const Rot3& r, ChartJacobian H = {});
};
Expand Down
2 changes: 1 addition & 1 deletion gtsam/geometry/Similarity2.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class GTSAM_EXPORT Similarity2 : public LieGroup<Similarity2, 4> {
OptionalJacobian<4, 4> Hm = {});

/// Chart at the origin
struct ChartAtOrigin {
struct GTSAM_EXPORT ChartAtOrigin {
static Similarity2 Retract(const Vector4& v,
ChartJacobian H = {}) {
return Similarity2::Expmap(v, H);
Expand Down
2 changes: 1 addition & 1 deletion gtsam/geometry/Similarity3.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class GTSAM_EXPORT Similarity3 : public LieGroup<Similarity3, 7> {
OptionalJacobian<7, 7> Hm = {});

/// Chart at the origin
struct ChartAtOrigin {
struct GTSAM_EXPORT ChartAtOrigin {
static Similarity3 Retract(const Vector7& v,
ChartJacobian H = {}) {
return Similarity3::Expmap(v, H);
Expand Down
25 changes: 11 additions & 14 deletions gtsam/inference/Ordering.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

namespace gtsam {

class Ordering: public KeyVector {
class GTSAM_EXPORT Ordering: public KeyVector {
protected:
typedef KeyVector Base;

Expand All @@ -48,8 +48,7 @@ class Ordering: public KeyVector {
typedef Ordering This; ///< Typedef to this class
typedef std::shared_ptr<This> shared_ptr; ///< shared_ptr to this class

/// Create an empty ordering
GTSAM_EXPORT
/// Create an empty ordering
Ordering() {
}

Expand Down Expand Up @@ -105,7 +104,7 @@ class Ordering: public KeyVector {
}

/// Compute a fill-reducing ordering using COLAMD from a VariableIndex.
static GTSAM_EXPORT Ordering Colamd(const VariableIndex& variableIndex);
static Ordering Colamd(const VariableIndex& variableIndex);

/// Compute a fill-reducing ordering using constrained COLAMD from a factor graph (see details
/// for note on performance). This internally builds a VariableIndex so if you already have a
Expand All @@ -130,7 +129,7 @@ class Ordering: public KeyVector {
/// variables in \c constrainLast will be ordered in the same order specified in the KeyVector
/// \c constrainLast. If \c forceOrder is false, the variables in \c constrainLast will be
/// ordered after all the others, but will be rearranged by CCOLAMD to reduce fill-in as well.
static GTSAM_EXPORT Ordering ColamdConstrainedLast(
static Ordering ColamdConstrainedLast(
const VariableIndex& variableIndex, const KeyVector& constrainLast,
bool forceOrder = false);

Expand Down Expand Up @@ -158,7 +157,7 @@ class Ordering: public KeyVector {
/// KeyVector \c constrainFirst. If \c forceOrder is false, the variables in \c
/// constrainFirst will be ordered before all the others, but will be rearranged by CCOLAMD to
/// reduce fill-in as well.
static GTSAM_EXPORT Ordering ColamdConstrainedFirst(
static Ordering ColamdConstrainedFirst(
const VariableIndex& variableIndex,
const KeyVector& constrainFirst, bool forceOrder = false);

Expand Down Expand Up @@ -187,7 +186,7 @@ class Ordering: public KeyVector {
/// appear in \c groups in arbitrary order. Any variables not present in \c groups will be
/// assigned to group 0. This function simply fills the \c cmember argument to CCOLAMD with the
/// supplied indices, see the CCOLAMD documentation for more information.
static GTSAM_EXPORT Ordering ColamdConstrained(
static Ordering ColamdConstrained(
const VariableIndex& variableIndex, const FastMap<Key, int>& groups);

/// Return a natural Ordering. Typically used by iterative solvers
Expand All @@ -201,11 +200,11 @@ class Ordering: public KeyVector {

/// METIS Formatting function
template<class FACTOR_GRAPH>
static GTSAM_EXPORT void CSRFormat(std::vector<int>& xadj,
static void CSRFormat(std::vector<int>& xadj,
std::vector<int>& adj, const FACTOR_GRAPH& graph);

/// Compute an ordering determined by METIS from a VariableIndex
static GTSAM_EXPORT Ordering Metis(const MetisIndex& met);
static Ordering Metis(const MetisIndex& met);

template<class FACTOR_GRAPH>
static Ordering Metis(const FACTOR_GRAPH& graph) {
Expand Down Expand Up @@ -246,19 +245,17 @@ class Ordering: public KeyVector {

/// @name Testable
/// @{

GTSAM_EXPORT

void print(const std::string& str = "", const KeyFormatter& keyFormatter =
DefaultKeyFormatter) const;

GTSAM_EXPORT

bool equals(const Ordering& other, double tol = 1e-9) const;

/// @}

private:
/// Internal COLAMD function
static GTSAM_EXPORT Ordering ColamdConstrained(
static Ordering ColamdConstrained(
const VariableIndex& variableIndex, std::vector<int>& cmember);

#ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
Expand Down

0 comments on commit 8ef4475

Please sign in to comment.