code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

Library version detection #363

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if the Bullet libraries included some kind of version 
information.

For my needs, I mostly want a preprocessor check so if something in bullet 
changes, I can #ifdef 
a section of my code — we have a distributed developer group, it's easier to 
do this for small 
things like the m_ERP renaming than to ask everyone to update their bullet at 
the same time.
There is a svn command 'svnversion' which will return the current version 
number.  It may have a 
suffix like 'M' if there are locally modified files, so I suggest piping it 
through something like:
sed 's/^\([[:digit:]]*\).*/\1/'
to extract just the numeric portion.

I would envision having some kind of version.{h,cpp} in each library (actually, 
I think could just 
have one top-level file and then have each library install/compile a copy?), 
with a #define 
BULLET_VERSION xxx in the header and extern const char* 
BULLET_VERSION_STR=#BULLET_VERSION; in the cpp (having both allows particularly 
paranoid 
clients to check that the header version matches the linked version)

The trick with all this is getting the build system to get this to work, which 
is where I fall short on 
supplying a patch. :(
One method would be to have cmake run svnversion and generate the build system 
to supply the 
result as a -D flag during compilation, but then the version info only gets 
updated if cmake is 
re-run.  The alternative is to convince cmake to add a build target to check 
the version number 
on every build and regenerate version.h as necessary...

There's a thread about this general process which might be helpful:
http://www.cmake.org/pipermail/cmake/2009-June/030144.html

I guess the other obvious alternative is to use a release number like 276 
instead of the svn 
version... would probably be good enough and a lot easier :)

Original issue reported on code.google.com by ejtt...@gmail.com on 12 Mar 2010 at 3:37

GoogleCodeExporter commented 9 years ago
This is already available.

See Bullet/src/btScalar.h

#define BT_BULLET_VERSION 276

inline int      btGetVersion()
{
return BT_BULLET_VERSION;
}

Thanks,
Erwin

Original comment by erwin.coumans on 12 Mar 2010 at 6:56

GoogleCodeExporter commented 9 years ago
Oops sorry I didn't find this earlier, works for me.

Original comment by ejtt...@gmail.com on 12 Mar 2010 at 9:38

GoogleCodeExporter commented 9 years ago
Thanks, let's close the issue (and add it to the docs/wiki)

Original comment by erwin.coumans on 13 Mar 2010 at 5:28