Revert "Use simgear internal stuff for the singleton class."

This reverts commit 80274596df.
This commit is contained in:
Mathias Froehlich
2012-03-03 18:21:49 +01:00
parent 13f96cdcc9
commit c74e212494
4 changed files with 13 additions and 4 deletions

View File

@@ -115,6 +115,7 @@ 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)

View File

@@ -46,6 +46,7 @@ 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}")

View File

@@ -17,3 +17,6 @@
#cmakedefine HAVE_LIBSVN_CLIENT_1
#cmakedefine GCC_ATOMIC_BUILTINS_FOUND
// set if building headless (no OSG or OpenGL libs)
#cmakedefine NO_OPENSCENEGRAPH_INTERFACE

View File

@@ -3,8 +3,10 @@
#include "singleton.hpp"
#include "SGReferenced.hxx"
#include "SGSharedPtr.hxx"
#ifndef NO_OPENSCENEGRAPH_INTERFACE
#include <osg/Referenced>
#include <osg/ref_ptr>
#endif
namespace simgear
{
@@ -27,6 +29,7 @@ public:
}
};
#ifndef NO_OPENSCENEGRAPH_INTERFACE
template <typename RefClass>
class SingletonRefPtr
{
@@ -42,11 +45,11 @@ public:
return singleton.ptr.get();
}
private:
SGSharedPtr<RefClass> ptr;
osg::ref_ptr<RefClass> ptr;
};
template <typename RefClass>
class ReferencedSingleton : public virtual SGReferenced
class ReferencedSingleton : public virtual osg::Referenced
{
public:
static RefClass* instance()
@@ -54,6 +57,7 @@ public:
return SingletonRefPtr<RefClass>::instance();
}
};
#endif // of NO_OPENSCENEGRAPH_INTERFACE
}
#endif