[InverseDynamics] Add custom namespaces per configuration

BulletInverseDynamics can be configured to compile using Eigen
instead of Bullet's LinearMath.

Adds a preprocessor defined specific namespace for each
configuration to produce linker errors if incompatible
libraries are linked (eg, builtin core library and
utilities for bullet types).
This commit is contained in:
Erwin Coumans
2015-11-18 08:01:32 -08:00
parent de763a26e7
commit 069936218a
5 changed files with 9 additions and 1 deletions

View File

@@ -24,7 +24,11 @@
#define INVDYN_INCLUDE_HELPER_2(x) #x
#define INVDYN_INCLUDE_HELPER(x) INVDYN_INCLUDE_HELPER_2(x)
#include INVDYN_INCLUDE_HELPER(BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H)
#ifndef btInverseDynamics
#error "custom inverse dynamics config, but no custom namespace defined"
#endif
#else
#define btInverseDynamics btInverseDynamicsBullet3
// Use default configuration with bullet's types
// Use the same scalar type as rest of bullet library
#include "LinearMath/btScalar.h"

View File

@@ -1,6 +1,7 @@
///@file Configuration for Inverse Dynamics Library without external dependencies
#ifndef INVDYNCONFIG_BUILTIN_HPP_
#define INVDYNCONFIG_BUILTIN_HPP_
#define btInverseDynamics btInverseDynamicsBuiltin
#ifdef BT_USE_DOUBLE_PRECISION
// choose double/single precision version
typedef double idScalar;

View File

@@ -1,6 +1,7 @@
///@file Configuration for Inverse Dynamics Library with Eigen
#ifndef INVDYNCONFIG_EIGEN_HPP_
#define INVDYNCONFIG_EIGEN_HPP_
#define btInverseDynamics btInverseDynamicsEigen
#ifdef BT_USE_DOUBLE_PRECISION
// choose double/single precision version
typedef double idScalar;

View File

@@ -1,6 +1,7 @@
#ifndef MULTIBODYTREE_HPP_
#define MULTIBODYTREE_HPP_
#include "IDConfig.hpp"
#include "IDMath.hpp"
namespace btInverseDynamics {
@@ -304,5 +305,4 @@ private:
InitCache* m_init_cache;
};
} // namespace btInverseDynamics
#endif // MULTIBODYTREE_HPP_

View File

@@ -4,6 +4,8 @@
#include <cstdlib>
#include "../IDConfig.hpp"
namespace btInverseDynamics {
class vec3;
class vecx;