Auto-detect Bullet dbl prec failure

10 views
Skip to first unread message

Paul Martz

unread,
Nov 5, 2011, 3:16:10 PM11/5/11
to osgbull...@googlegroups.com
Hi all -- I've been discussing an issue with Karrot/Dennis offline regarding a
failure on trunk to properly detect whether Bullet uses double or single
precision. I don't have a fix yet, but I did just check in a workaround that
should alleviate the pain of being on osgBullet trunk.

CMake is now set up to try a test compile with -DBT_USE_DOUBLE_PRECISION. If
that succeeds, it sets OSGBULLET_USE_DOUBLE_PRECISION to true, which adds the
corresponding definition to the osgBullet project/make files. Your osgBullet
will build for double precision. All is well.

If that compile fails, it attempts the same test compile again, but this time
without the definition (single precision). If this succeeds, then it sets
OSGBULLET_USE_DOUBLE_PRECISION to false, and the osgBullet project/make files
build for single precision. All is well.

It both of the above compiles fail, CMake displays a warning and dumps the
single precision build output. If you get this, please post your build output to
the list so I can attempt to figure out why the test compile is failing. In the
meantime, you can still build osgBullet by setting
OSGBULLET_USE_DOUBLE_PRECISION manually, so at least you're no worse off than
you were with v2.0 and previous. :-)

Currently, I'm able to reproduce a failure if I've built only the Release
version of Bullet on Windows with VS 2010, and the CMake test compiles fail
because they are trying to do a Debug build. This causes a link failure in VS
2010. I'm working on a fix for this.

Thanks, and let me know of any problems...

--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/

Karrot

unread,
Nov 7, 2011, 3:43:17 AM11/7/11
to osgbullet-users
Latest trunk changes do work for the initial generate.

However, once the double precision test is run, the "legacy" checkbox
appears. And it shows up unchecked. If the user then presses configure
again, osgbullet will not have its double precision flag set, the
checkbox overrides the result of the test.

So the test would also have to set the state of the checkbox depending
on the outcome of the test.

Other then that, the test now correctly sets the flag

Tested with:

osg 3.0.1
bullet 2.79
osgworks 02_00_00 zipped version
osgbullet svn trunk version

msvc 2008 sp1
cmake 2.8.6

Paul Martz

unread,
Nov 7, 2011, 10:41:48 PM11/7/11
to osgbull...@googlegroups.com
On 11/7/2011 1:43 AM, Karrot wrote:
> Latest trunk changes do work for the initial generate.
>
> However, once the double precision test is run, the "legacy" checkbox
> appears. And it shows up unchecked. If the user then presses configure
> again, osgbullet will not have its double precision flag set, the
> checkbox overrides the result of the test.
>
> So the test would also have to set the state of the checkbox depending
> on the outcome of the test.

This is bizarre. If the try_compile detects double precision Bullet, it *should*
already set the checkbox.

Can you do me a favor... Delete your cache and do a CMake configure again, and
post the CMake output here. I'm particularly interested in the output produced
during the try_compile attempts.

I'll be working on this more tomorrow, I want to get rid of the Debug versus
Release issue on Windows.
-Paul

Karrot

unread,
Nov 8, 2011, 3:58:35 AM11/8/11
to osgbullet-users
I think the problem lies in that the checkbox only shows up after the
try_compile checks are done. So at the point in time where the check
just finishes and starts setting the preprocessor flag/checkbox, there
is no checkbox yet to set. Only after the check the checkbox is shown
in the cmake list and it did not get the proper value.

I'll do a clean pull/cmake to reproduce, with cmake output of the gui.

Karrot

unread,
Nov 8, 2011, 4:12:37 AM11/8/11
to osgbullet-users
Reproductive case:

Cmake initially unable to find osg, osgw, bullet (no problem here, I
just have my stuff in wierd paths;-)
Using Alternate Install Location to locate Osg -> configure
Fill in osgw include path -> configure
Fill in all osgw libs -> configure

At this point only bullet remains, and the osgb options currently
available are build_apps, build_examples, build_test, docu, install,
p5.

Select alternate bullet install dir -> configure (win32_use_mp
checkbox shows up at this point)
enter bullet install dir -> configure

Found Bullet: D:/clean/bullet-svn/install-DP/lib/BulletDynamics.lib
Testing Bullet for use of double precision...
Bullet double precision detected. Automatically defining
BT_USE_DOUBLE_PRECISION for osgBullet.
Configuring done

Karrot

unread,
Nov 8, 2011, 4:15:20 AM11/8/11
to osgbullet-users
er, forgot to add:

At the point (after that output) the osgbullet_use_double_precision
checkbox appears, unchecked.

Note that, if I would just hit generate now, the project file would be
generated _with_ the flag.
However, if I would hit configure again, the unchecked checkbox would
override the test results, pressing generate now would create the
project file without the flag.

Karrot

unread,
Nov 8, 2011, 5:24:52 AM11/8/11
to osgbullet-users
fixed :

- set( OSGBULLET_USE_DOUBLE_PRECISION TRUE )
+ set( OSGBULLET_USE_DOUBLE_PRECISION ON CACHE BOOL "" FORCE )

by forcing the cache update on the bool, the checkbox comes up checked
after the test.

Mailed the patch.

Paul Martz

unread,
Nov 8, 2011, 11:04:26 AM11/8/11
to osgbull...@googlegroups.com

Ugh. I love/hate CMake. Thanks for digging, I'll get this checked in shortly
(have some other stuff going on right now).

And I'll also work on that (apparently separate) Debug versus Release issue I found.

Paul Martz

unread,
Nov 8, 2011, 3:10:08 PM11/8/11
to osgbull...@googlegroups.com
That fix is now committed. Thanks!
-Paul


On 11/8/2011 3:24 AM, Karrot wrote:

Reply all
Reply to author
Forward
0 new messages