CMake: Win32 option added to OSG_WINDOWING_SYSTEM

This commit is contained in:
Konstantin S. Matveyev 2019-04-14 00:47:36 +03:00
parent b5dff94107
commit 036bb7b472
2 changed files with 133 additions and 134 deletions

View File

@ -50,8 +50,9 @@ ENDIF()
# value is needed to find the correct version of OpenGL (X11 or Cocoa).
IF(ANDROID)
SET(OSG_WINDOWING_SYSTEM "None" CACHE STRING "None Windowing system type for graphics window creation.")
SET(OSG_WINDOWING_SYSTEM "None" CACHE STRING "Windowing system type for graphics window creation; options: None.")
ELSIF(WIN32)
SET(OSG_WINDOWING_SYSTEM "Win32" CACHE STRING "Windowing system type for graphics window creation; options: Win32 or None.")
ELSIF(APPLE)
# custom option to flag an iOS build
OPTION(OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF)
@ -81,9 +82,9 @@ ELSIF(APPLE)
ELSE()
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
IF(OSG_OSX_VERSION VERSION_LESS 10.5)
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.")
ELSE()
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.")
ENDIF()
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
@ -111,7 +112,7 @@ ELSIF(APPLE)
ENDIF()
ENDIF()
ELSE()
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation. options only X11")
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.")
ENDIF()

View File

@ -57,7 +57,7 @@ SET(LIB_COMMON_FILES
# Collect all the configuration files
SET(LIB_EXTRA_LIBS)
IF(WIN32 AND NOT ANDROID)
IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Win32")
#
# Enable workaround for OpenGL driver issues when used in multithreaded/multiscreen with NVidia drivers on Windows XP
# For example: osgviewer dumptruck.osg was showing total garbage (screen looked like shattered, splashed hedgehog)
@ -80,157 +80,155 @@ IF(WIN32 AND NOT ANDROID)
GraphicsWindowWin32.cpp
PixelBufferWin32.cpp
)
ELSE()
IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa")
ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)
ELSIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa")
ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)
IF(OSG_COMPILE_FRAMEWORKS)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
ELSE()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
)
ENDIF()
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowCocoa.mm
DarwinUtils.h
DarwinUtils.mm
PixelBufferCocoa.mm
IF(OSG_COMPILE_FRAMEWORKS)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
ELSE()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
)
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
ENDIF()
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowCocoa.mm
DarwinUtils.h
DarwinUtils.mm
PixelBufferCocoa.mm
)
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
IF(OSG_COMPILE_FRAMEWORKS)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon
${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
${HEADER_PATH}/api/Carbon/PixelBufferCarbon
)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/PixelBufferCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
ELSE()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon
${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
${HEADER_PATH}/api/Carbon/PixelBufferCarbon
)
ENDIF()
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowCarbon.cpp
DarwinUtils.h
DarwinUtils.mm
PixelBufferCarbon.cpp
IF(OSG_COMPILE_FRAMEWORKS)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon
${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
${HEADER_PATH}/api/Carbon/PixelBufferCarbon
)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/PixelBufferCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
ELSE()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon
${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
${HEADER_PATH}/api/Carbon/PixelBufferCarbon
)
ENDIF()
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${AGL_LIBRARY} ${LIB_EXTRA_LIBS})
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowCarbon.cpp
DarwinUtils.h
DarwinUtils.mm
PixelBufferCarbon.cpp
)
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "IOS")
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${AGL_LIBRARY} ${LIB_EXTRA_LIBS})
ADD_DEFINITIONS(-DUSE_IOS_IMPLEMENTATION)
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "IOS")
IF(OSG_COMPILE_FRAMEWORKS)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
${HEADER_PATH}/api/IOS/GraphicsWindowIOS
)
ADD_DEFINITIONS(-DUSE_IOS_IMPLEMENTATION)
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/IOS/GraphicsWindowIOS PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/IOS)
ELSE()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/IOS/GraphicsWindowIOS
#${HEADER_PATH}/api/IOS/PixelBufferIOS
)
ENDIF()
IF(OSG_COMPILE_FRAMEWORKS)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
${HEADER_PATH}/api/IOS/GraphicsWindowIOS
)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowIOS.mm
IOSUtils.h
IOSUtils.mm
SET_PROPERTY(SOURCE ${HEADER_PATH}/api/IOS/GraphicsWindowIOS PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/IOS)
ELSE()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/IOS/GraphicsWindowIOS
#${HEADER_PATH}/api/IOS/PixelBufferIOS
)
ENDIF()
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowIOS.mm
IOSUtils.h
IOSUtils.mm
)
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "X11")
# X11 for everybody else
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})
PKG_CHECK_MODULES(XRANDR xrandr)
IF(XRANDR_FOUND)
OPTION(OSGVIEWER_USE_XRANDR "Set to ON to enable Xrandr support for GraphicsWindowX11." ON)
ELSE()
SET(OSGVIEWER_USE_XRANDR OFF)
ENDIF()
ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "X11")
# X11 for everybody else
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(XINERAMA xinerama)
IF(XINERAMA_FOUND)
SET(OSGVIEWER_USE_XINERAMA ON)
ELSE()
SET(OSGVIEWER_USE_XINERAMA OFF)
ENDIF()
PKG_CHECK_MODULES(XRANDR xrandr)
IF(XRANDR_FOUND)
OPTION(OSGVIEWER_USE_XRANDR "Set to ON to enable Xrandr support for GraphicsWindowX11." ON)
ELSE()
SET(OSGVIEWER_USE_XRANDR OFF)
ENDIF()
PKG_CHECK_MODULES(XINERAMA xinerama)
IF(XINERAMA_FOUND)
SET(OSGVIEWER_USE_XINERAMA ON)
ELSE()
SET(OSGVIEWER_USE_XINERAMA OFF)
ENDIF()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/X11/GraphicsHandleX11
${HEADER_PATH}/api/X11/GraphicsWindowX11
${HEADER_PATH}/api/X11/PixelBufferX11
)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowX11.cpp
PixelBufferX11.cpp
)
IF(OSGVIEWER_USE_XRANDR)
ADD_DEFINITIONS(-DOSGVIEWER_USE_XRANDR)
SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XRANDR_INCLUDE_DIRS} )
IF(X11_Xrandr_LIB)
SET(LIB_EXTRA_LIBS ${X11_Xrandr_LIB} ${LIB_EXTRA_LIBS})
ELSE()
SET(LIB_EXTRA_LIBS ${XRANDR_LIBRARIES} ${LIB_EXTRA_LIBS})
ENDIF()
ENDIF()
IF(OSGVIEWER_USE_XINERAMA)
ADD_DEFINITIONS(-DOSGVIEWER_USE_XINERAMA)
SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XINERAMA_INCLUDE_DIRS} )
SET(LIB_EXTRA_LIBS -lXinerama ${LIB_EXTRA_LIBS})
ENDIF()
# X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
IF(APPLE)
# hack for finding the iphone opengl es lib
IF(OSG_BUILD_PLATFORM_IPHONE)
SET(OPENGL_INCLUDE_DIR ${IPHONE_SDKROOT}/System/Library/Frameworks)
SET(OPENGL_LIBRARIES ${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES)
ELSE()
SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
ENDIF()
ELSE(APPLE)
SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
ENDIF(APPLE)
ELSE()
MESSAGE(STATUS "Windowing system not supported")
SET(OSGVIEWER_USE_XRANDR OFF)
SET(OSGVIEWER_USE_XINERAMA OFF)
ENDIF()
SET(TARGET_H_NO_MODULE_INSTALL
${HEADER_PATH}/api/X11/GraphicsHandleX11
${HEADER_PATH}/api/X11/GraphicsWindowX11
${HEADER_PATH}/api/X11/PixelBufferX11
)
SET(LIB_COMMON_FILES ${LIB_COMMON_FILES}
GraphicsWindowX11.cpp
PixelBufferX11.cpp
)
IF(OSGVIEWER_USE_XRANDR)
ADD_DEFINITIONS(-DOSGVIEWER_USE_XRANDR)
SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XRANDR_INCLUDE_DIRS} )
IF(X11_Xrandr_LIB)
SET(LIB_EXTRA_LIBS ${X11_Xrandr_LIB} ${LIB_EXTRA_LIBS})
ELSE()
SET(LIB_EXTRA_LIBS ${XRANDR_LIBRARIES} ${LIB_EXTRA_LIBS})
ENDIF()
ENDIF()
IF(OSGVIEWER_USE_XINERAMA)
ADD_DEFINITIONS(-DOSGVIEWER_USE_XINERAMA)
SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XINERAMA_INCLUDE_DIRS} )
SET(LIB_EXTRA_LIBS -lXinerama ${LIB_EXTRA_LIBS})
ENDIF()
# X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
IF(APPLE)
# hack for finding the iphone opengl es lib
IF(OSG_BUILD_PLATFORM_IPHONE)
SET(OPENGL_INCLUDE_DIR ${IPHONE_SDKROOT}/System/Library/Frameworks)
SET(OPENGL_LIBRARIES ${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES)
ELSE()
SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
ENDIF()
ELSE(APPLE)
SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
ENDIF(APPLE)
ELSE()
MESSAGE(STATUS "Windowing system not supported")
ENDIF()