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