From 53e337611a189c231a9ff002a389f71eb0ed2fa4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 24 Nov 2014 15:19:20 +0000 Subject: [PATCH] From Jan Klimke, "i noticed, that there are a couple of additional flaws when building osg for Mac OS X 10.10 Yosemite. The mac os sdk version is recognized by the current CMAKE script as 10.1 instead of 10.10 since it cuts the version string from the 4th place. I introduced a more reliable version checking based on splitting the returned version code into MAJOR MINOR and PATCH parts and reassemble the OSG sdk version afterwards. I replaced the existing CMake code against the following (returning now version 10.10 as expected): # Determine the canonical name of the selected Platform SDK EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion" OUTPUT_VARIABLE OSG_OSX_SDK_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME}) LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR) LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR) LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH) SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}") Also i added the check for the new Version to some more find scripts. Additionally the nil object in Objective C now seems to be equivalent with a null_ptr that cannot be passed as GLInt anymore. So i switched this in the PixelBufferCocoa.mm to pass a zero instead of nil. " git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14527 16af8721-9629-0410-8352-f15c8da7e697 --- CMakeLists.txt | 24 ++++++++++++++++-------- CMakeModules/FindAVFoundation.cmake | 2 +- CMakeModules/FindQuickTime.cmake | 2 +- src/osgViewer/PixelBufferCocoa.mm | 2 +- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f571a82b..1a14d742f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,13 +166,18 @@ IF (OSG_MAINTAINER) ENDIF(OSG_MAINTAINER) -IF(APPLE AND NOT ANDROID) +IF(NOT ANDROID) +IF(APPLE) # Determine the canonical name of the selected Platform SDK EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion" OUTPUT_VARIABLE OSG_OSX_SDK_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) - STRING(SUBSTRING "${OSG_OSX_SDK_NAME}" 0 4 OSG_OSX_SDK_NAME) - SET(OSG_OSX_SDK_NAME "macosx${OSG_OSX_SDK_NAME}") + STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME}) + LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR) + LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR) + LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH) + + SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}") # Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working # Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below @@ -218,11 +223,14 @@ IF(APPLE AND NOT ANDROID) OPTION(OSG_COMPILE_FRAMEWORKS "compile frameworks instead of dylibs (experimental)" OFF) SET(OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR "@executable_path/../Frameworks" CACHE STRING "install name dir for compiled frameworks") ELSE() - IF(NOT ANDROID) - # Non-Apple: Find OpenGL - FIND_PACKAGE(OpenGL) - ENDIF() + # Non-Apple: Find OpenGL + FIND_PACKAGE(OpenGL) ENDIF() +ENDIF() + + + + IF(UNIX AND NOT ANDROID) # Not sure what this will do on Cygwin and Msys @@ -1044,7 +1052,7 @@ IF(APPLE AND NOT ANDROID) # FORCE is used because the options are not reflected in the UI otherwise. # Seems like a good place to add version specific compiler flags too. IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE) - IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9") + IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) # 64 Bit Works, i386,ppc is not supported any more SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE) diff --git a/CMakeModules/FindAVFoundation.cmake b/CMakeModules/FindAVFoundation.cmake index ff888f025..63bc3817c 100644 --- a/CMakeModules/FindAVFoundation.cmake +++ b/CMakeModules/FindAVFoundation.cmake @@ -30,7 +30,7 @@ ELSE() # AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG # so check the SDK-setting - IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9") + IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") # nothing special here ;-) ELSE() MESSAGE("AVFoundation disabled for SDK < 10.8") diff --git a/CMakeModules/FindQuickTime.cmake b/CMakeModules/FindQuickTime.cmake index 3d3cf6e1f..bffc99b94 100644 --- a/CMakeModules/FindQuickTime.cmake +++ b/CMakeModules/FindQuickTime.cmake @@ -65,7 +65,7 @@ ELSE() ENDIF() # Disable quicktime for >= 10.7, as it's officially deprecated - IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9") + IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}") SET(QUICKTIME_FOUND "NO") ENDIF() diff --git a/src/osgViewer/PixelBufferCocoa.mm b/src/osgViewer/PixelBufferCocoa.mm index 343840ff6..24c5d28a5 100644 --- a/src/osgViewer/PixelBufferCocoa.mm +++ b/src/osgViewer/PixelBufferCocoa.mm @@ -74,7 +74,7 @@ bool PixelBufferCocoa::realizeImplementation() _context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext]; NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget: _traits->target textureInternalFormat: _traits->format textureMaxMipMapLevel: _traits->level pixelsWide: _traits->width pixelsHigh: _traits->height]; - [_context setPixelBuffer: pbuffer cubeMapFace: _traits->face mipMapLevel:_traits->level currentVirtualScreen: nil]; + [_context setPixelBuffer: pbuffer cubeMapFace: _traits->face mipMapLevel:_traits->level currentVirtualScreen: 0]; [pool release];