KhronosGroup / OpenCOLLADA

652 stars 252 forks source link

Support multiple opencollada versions in source code #604

Closed gaiaclary closed 5 years ago

gaiaclary commented 5 years ago

Hi;

For Blender we want to support multiple opencollada library versions in our builds. We need this because build platforms in general do not guarantee to always have the newest library versions available.

So i am thinking about adding something similar to this into the c++ code:

#define OLD_API 1
#if OPENCOLLADA _API == OLD_API
// use old API
#else 
// use new API
#endif 

But i do not know how to get the opencollada version number. Also we are using CMAKE so if we can access the opencollada version number from there, then cmake could set the value of OPENCOLLADA_API either to 1(old) or 2(new) and then we are done.

Please advise. Thanks

gaiaclary commented 5 years ago

According to issue https://github.com/KhronosGroup/OpenCOLLADA/issues/531 we can get the collada version number from the file COLLADABU/VersionInfo.h In this file we should find a revision number encoded in the String variable CURRENT_REVISION However the revision number is not set in the archived zip files:

https://github.com/KhronosGroup/OpenCOLLADA/archive/v1.6.68.zip https://github.com/KhronosGroup/OpenCOLLADA/archive/v1.6.67.zip https://github.com/KhronosGroup/OpenCOLLADA/archive/v1.6.66.zip

In all those zip files the version string is:

const String CURRENT_REVISION = "1.6.developer_version";

BTW: What about adding a strictly numeric Preprocessor Define into the version header file? This would make our life a lot easier at the end :

define OPENCOLLADA_VERSION 010668

could be used without effort:

if OPENCOLLADA_VERSION > 010665

...

else

...

endif

thanks

gaiaclary commented 5 years ago

Closing because i have a proposal for improvement on all of this :)