Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Bullet built with double precision #660

Merged
merged 3 commits into from
Apr 11, 2016
Merged

Support for Bullet built with double precision #660

merged 3 commits into from
Apr 11, 2016

Conversation

mkoval
Copy link
Collaborator

@mkoval mkoval commented Apr 8, 2016

Bullet requires a pre-processor variable to be set before including any headers to determine whether the library was built with single or double precision. Failing to do so may result in a linking error.

This commit:

  1. Forces CMake to use CONFIG mode (BulletConfig.cmake shipped with Bullet) instead of MODULE mode (FindBullet.cmake shipped with CMake by default) in find_package(Bullet).
  2. Updates references to BULLET_INCLUDE_DIRS and BULLET_LIBRARIES accordingly
  3. Test whether Bullet was built using double precision floating point numbers by attempting to compile code that produces a linking error when the necessary preprocessor definition is missing.
  4. Set the necessary preprocessor definition in config.h.

This fixes #657: it turns out that Homebrew builds Bullet with double point precision by default.

Bullet requires a pre-processor variable to be set before including any
headers to determine whether the library was built with single or double
precision. Failing to do so may result in a linking error.

This commit:

1. Forces CMake to use CONFIG mode (BulletConfig.cmake shipped with
   bullet) instead of MODULE mode (FindBullet.cmake shipped with CMake
   by default) in find_package(Bullet).

2. Updates references to BULLET_INCLUDE_DIRS and BULLET_LIBRARIES
   accordingly

3. Test whether Bullet was built using double precision floating point
   numbers by attempting to compile code that produces a linking error
   when the necessary preprocessor definition is missing.

4. Set the necessary preprocessor definition in config.h.
@jslee02 jslee02 added this to the DART 6.0.0 milestone Apr 8, 2016
@scpeters
Copy link
Collaborator

scpeters commented Apr 9, 2016

Just for clarification, I'm pretty sure that bullet is single precision by default. The upstream option for USE_DOUBLE_PRECISION is off by default. In the homebrew formula, double precision is an option, which means off by default (recommended means on by default).

It will use double precision if you install gazebo and bullet is not yet installed:

@mkoval
Copy link
Collaborator Author

mkoval commented Apr 9, 2016

@scpeters you are likely right that Bullet got installed through Gazebo. I recently used Mike Purvis' installation script to reinstall ROS, which does install Gazebo by default.

In any case, I see no reason why DART shouldn't work when Bullet is compiled with double precision. 😄

@scpeters
Copy link
Collaborator

scpeters commented Apr 9, 2016

Absolutely it should be able to use whichever version of bullet is available. I think we get around it in gazebo because the -DBT_USE_DOUBLE_PRECISION definition is included in the pkg-config file. This looks like a good pull request for detecting it with cmake.

@jslee02
Copy link
Member

jslee02 commented Apr 9, 2016

Yeah, using CheckCXXSourceCompiles is an good idea.

I made minor update for the cmake output for consistency.

Looks good to me. 👍

@jslee02 jslee02 merged commit 1854915 into dartsim:master Apr 11, 2016
jslee02 added a commit that referenced this pull request Aug 26, 2016
@scpeters
Copy link
Collaborator

scpeters commented Oct 4, 2016

I just ran into this same problem while compiling gazebo with dart 5.1; is it possible to backport this fix to release-5.1?

@jslee02
Copy link
Member

jslee02 commented Oct 4, 2016

Sure, I'll create an issue for that.

scpeters pushed a commit that referenced this pull request Oct 4, 2016
Bullet requires a pre-processor variable to be set before including any
headers to determine whether the library was built with single or double
precision. Failing to do so may result in a linking error.

This commit:

1. Forces CMake to use CONFIG mode (BulletConfig.cmake shipped with
   bullet) instead of MODULE mode (FindBullet.cmake shipped with CMake
   by default) in find_package(Bullet).

2. Updates references to BULLET_INCLUDE_DIRS and BULLET_LIBRARIES
   accordingly

3. Test whether Bullet was built using double precision floating point
   numbers by attempting to compile code that produces a linking error
   when the necessary preprocessor definition is missing.

4. Set the necessary preprocessor definition in config.h.

combined with commits that
Reverted to using Bullet MODULE mode.
and
Minor output message update for consistency

Backport of #660 to release-5.1 branch.
Closes #776.
jslee02 added a commit that referenced this pull request Oct 5, 2016
Support for Bullet built with double precision (backport #660)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linking with Bullet fails on OS X El Capitan
3 participants