From 80274596dfb0daf3564581e9e855f3debf483b12 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Sat, 3 Mar 2012 14:10:37 +0100 Subject: [PATCH] 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. --- CMakeLists.txt | 1 - simgear/CMakeLists.txt | 1 - simgear/simgear_config_cmake.h.in | 3 --- simgear/structure/Singleton.hxx | 12 ++++-------- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1e985ad..281b366f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 096a800c..3ad734fa 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -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}") diff --git a/simgear/simgear_config_cmake.h.in b/simgear/simgear_config_cmake.h.in index a1192283..563f9f73 100644 --- a/simgear/simgear_config_cmake.h.in +++ b/simgear/simgear_config_cmake.h.in @@ -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 diff --git a/simgear/structure/Singleton.hxx b/simgear/structure/Singleton.hxx index 35c712a2..dda5f78c 100644 --- a/simgear/structure/Singleton.hxx +++ b/simgear/structure/Singleton.hxx @@ -3,10 +3,8 @@ #include "singleton.hpp" -#ifndef NO_OPENSCENEGRAPH_INTERFACE -#include -#include -#endif +#include "SGReferenced.hxx" +#include "SGSharedPtr.hxx" namespace simgear { @@ -29,7 +27,6 @@ public: } }; -#ifndef NO_OPENSCENEGRAPH_INTERFACE template class SingletonRefPtr { @@ -45,11 +42,11 @@ public: return singleton.ptr.get(); } private: - osg::ref_ptr ptr; + SGSharedPtr ptr; }; template -class ReferencedSingleton : public virtual osg::Referenced +class ReferencedSingleton : public virtual SGReferenced { public: static RefClass* instance() @@ -57,7 +54,6 @@ public: return SingletonRefPtr::instance(); } }; -#endif // of NO_OPENSCENEGRAPH_INTERFACE } #endif