From Wang Rui, "I've finally completed the static build support for dotosg wrapper and
serialization libraries. My submission mainly includes: 1. Add two new macros USE_DOTOSGWRAPPER_LIBRARY and USE_SERIALIZER_WRAPPER_LIBRARY. Applications using static OSG must include corresponding static-link libraries and use these two macros to predefine native format wrappers. Please see osgstaticviewer and present3D in the attachment for details. 2. Add a LibraryWrapper.cpp file in each osgWrappers/deprecated-dotosg/... and osgWrappers/serializers/... subfolder, which calls all USE_...WRAPPERS macros inside. The LibraryWrapper file is automatically generated by the wrapper_includer.cpp (with some slight fixes), which is also attached for your reference. The deprecated-dotosg/osgAnimation is not included because it doesn't us REGISTER_DOTOSGWRAPPER to define its wrappers. 3. Modify the ReaderWriterOSG.cpp to prevent calling loadWrappers() when static build. 4. An uncorrelated fix to Serializer and ObjectWrapper.cpp, which ensures version variables of serialziers are initialized, and serializers out-of-version are not written to model files. "
This commit is contained in:
@@ -637,10 +637,18 @@ struct PluginFunctionProxy
|
||||
extern "C" void dotosgwrapper_##classname(void); \
|
||||
static osgDB::PluginFunctionProxy proxy_dotosgwrapper_##classname(dotosgwrapper_##classname);
|
||||
|
||||
#define USE_DOTOSGWRAPPER_LIBRARY(libname) \
|
||||
extern "C" void dotosgwrapper_library_##libname(void); \
|
||||
static osgDB::PluginFunctionProxy proxy_dotosgwrapper_library_##libname(dotosgwrapper_library_##libname);
|
||||
|
||||
#define USE_SERIALIZER_WRAPPER(classname) \
|
||||
extern "C" void wrapper_serializer_##classname(void); \
|
||||
static osgDB::PluginFunctionProxy proxy_serializer_##classname(wrapper_serializer_##classname);
|
||||
|
||||
#define USE_SERIALIZER_WRAPPER_LIBRARY(libname) \
|
||||
extern "C" void wrapper_serializer_library_##libname(void); \
|
||||
static osgDB::PluginFunctionProxy proxy_serializer_library_##libname(wrapper_serializer_library_##libname);
|
||||
|
||||
#define USE_COMPRESSOR_WRAPPER(classname) \
|
||||
extern "C" void wrapper_serializer_##classname(void); \
|
||||
static osgDB::PluginFunctionProxy proxy_compressor_##classname(wrapper_compressor_##classname);
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
typedef bool (*Writer)( OutputStream&, const C& );
|
||||
|
||||
UserSerializer( const char* name, Checker cf, Reader rf, Writer wf )
|
||||
: _name(name), _checker(cf), _reader(rf), _writer(wf) {}
|
||||
: BaseSerializer(), _name(name), _checker(cf), _reader(rf), _writer(wf) {}
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj )
|
||||
{
|
||||
@@ -198,7 +198,7 @@ class TemplateSerializer : public BaseSerializer
|
||||
{
|
||||
public:
|
||||
TemplateSerializer( const char* name )
|
||||
: _name(name) {}
|
||||
: BaseSerializer(), _name(name) {}
|
||||
|
||||
virtual bool read( InputStream& is, osg::Object& obj ) = 0;
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj ) = 0;
|
||||
|
||||
Reference in New Issue
Block a user