Fix osgViewer `USE_GRAPHICSWINDOW` without a windowing system

There is no way for the user to know whether OSG was compiled with a
windowing system.

This means calling USE_GRAPHICSWINDOW() in client libraries was unsafe
in the case of the "None" windowing system, as it would fail to link.

Turns the call into a no-op in that case.
OpenSceneGraph-3.6
Gleb Mazovetskiy 4 years ago committed by Robert Osfield
parent 4093860c32
commit 44d3da02a9

@ -121,6 +121,9 @@ ELSE()
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.") SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.")
ENDIF() ENDIF()
IF(OSG_WINDOWING_SYSTEM STREQUAL "None")
SET(OSG_WINDOWING_SYSTEM_NONE ON INTERNAL "No windowing system")
ENDIF()
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}) SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})

@ -283,7 +283,9 @@ struct GraphicsWindowFunctionProxy
extern "C" void graphicswindow_##ext(void); \ extern "C" void graphicswindow_##ext(void); \
static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext); static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext);
#if defined(_WIN32) #if defined(OSG_WINDOWING_SYSTEM_NONE)
#define USE_GRAPHICS_WINDOW()
#elif defined(_WIN32)
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32) #define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32)
#elif defined(__APPLE__) #elif defined(__APPLE__)
#if defined(OSG_WINDOWING_SYSTEM_CARBON) #if defined(OSG_WINDOWING_SYSTEM_CARBON)

@ -37,5 +37,6 @@
#cmakedefine OSG_USE_DEPRECATED_API #cmakedefine OSG_USE_DEPRECATED_API
#cmakedefine OSG_ENVVAR_SUPPORTED #cmakedefine OSG_ENVVAR_SUPPORTED
#cmakedefine OSG_WINDOWING_SYSTEM_CARBON #cmakedefine OSG_WINDOWING_SYSTEM_CARBON
#cmakedefine OSG_WINDOWING_SYSTEM_NONE
#endif #endif

Loading…
Cancel
Save