Use simgear internal stuff for the singleton class.
This removes the other still present dependency on osg in the future sgcore library. It also remove the need for the NO_OPENSCENEGRAPH_INTERFACE compile time definition.
This commit is contained in:
parent
2cc5e776b3
commit
80274596df
@ -115,7 +115,6 @@ find_package(Threads REQUIRED)
|
||||
|
||||
if(SIMGEAR_HEADLESS)
|
||||
message(STATUS "headless mode")
|
||||
set(NO_OPENSCENEGRAPH_INTERFACE 1)
|
||||
else()
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
|
@ -46,7 +46,6 @@ if(SIMGEAR_SHARED)
|
||||
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
|
||||
|
||||
add_library(SimGearCore SHARED ${coreSources})
|
||||
set_property(TARGET SimGearCore PROPERTY COMPILE_FLAGS "-DNO_OPENSCENEGRAPH_INTERFACE=1")
|
||||
|
||||
# set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1)
|
||||
# message(STATUS "public header: ${publicHeaders}")
|
||||
|
@ -17,6 +17,3 @@
|
||||
#cmakedefine HAVE_LIBSVN_CLIENT_1
|
||||
|
||||
#cmakedefine GCC_ATOMIC_BUILTINS_FOUND
|
||||
|
||||
// set if building headless (no OSG or OpenGL libs)
|
||||
#cmakedefine NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
#include "singleton.hpp"
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
#include <osg/Referenced>
|
||||
#include <osg/ref_ptr>
|
||||
#endif
|
||||
#include "SGReferenced.hxx"
|
||||
#include "SGSharedPtr.hxx"
|
||||
|
||||
namespace simgear
|
||||
{
|
||||
@ -29,7 +27,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef NO_OPENSCENEGRAPH_INTERFACE
|
||||
template <typename RefClass>
|
||||
class SingletonRefPtr
|
||||
{
|
||||
@ -45,11 +42,11 @@ public:
|
||||
return singleton.ptr.get();
|
||||
}
|
||||
private:
|
||||
osg::ref_ptr<RefClass> ptr;
|
||||
SGSharedPtr<RefClass> ptr;
|
||||
};
|
||||
|
||||
template <typename RefClass>
|
||||
class ReferencedSingleton : public virtual osg::Referenced
|
||||
class ReferencedSingleton : public virtual SGReferenced
|
||||
{
|
||||
public:
|
||||
static RefClass* instance()
|
||||
@ -57,7 +54,6 @@ public:
|
||||
return SingletonRefPtr<RefClass>::instance();
|
||||
}
|
||||
};
|
||||
#endif // of NO_OPENSCENEGRAPH_INTERFACE
|
||||
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user