Hi Robert,

as discussed on osg-users there is an issue with clang++ on OS X and iOS that 
results in
the following error:

Users/stephan/Documents/Projekte/cefix/cefix/ios/../../libs/ios/include/OpenThreads/Atomic:244:48:
error: cannot initialize a parameter of type 'void *' with an lvalue of
type 'const void *const'
    return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);

This can be solved by a cast to '(void*)ptrOld'.  This should be benign since 
both
'ptrOld' and 'ptrNew' are only read and the cast is in fact in place for all 
other
implementations as well.

On OS X the cast compiles cleanly on both g++ (i686-apple-darwin11-llvm-g++-4.2 
(GCC)
4.2.1) and clang++ (Apple clang version 3.1 (tags/Apple/clang-318.0.54)).

Also included is a modified src/osgViewer/CMakeLists.txt that more reliably 
detects OS X
versions 10.5, 10.6, and 10.7 and uses Cocoa on these platforms.  It also 
checks for the
new location of the SDK, that was changed with Xcode 4.3.

Cheers,
/ulrich
Index: src/OpenThreads/common/Atomic.cpp
===================================================================
--- src/OpenThreads/common/Atomic.cpp   (revision 13041)
+++ src/OpenThreads/common/Atomic.cpp   (working copy)
@@ -143,7 +143,7 @@
 AtomicPtr::assign(void* ptrNew, const void* const ptrOld)
 {
 #if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
-    return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);
+    return __sync_bool_compare_and_swap(&_ptr, (void*)ptrOld, ptrNew);
 #elif defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
     return ptrOld == InterlockedCompareExchangePointer((PVOID volatile*)&_ptr, 
(PVOID)ptrNew, (PVOID)ptrOld);
 #elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
Index: src/osgViewer/CMakeLists.txt
===================================================================
--- src/osgViewer/CMakeLists.txt        (revision 13041)
+++ src/osgViewer/CMakeLists.txt        (working copy)
@@ -68,12 +68,20 @@
         IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
             SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Windowing system type 
for graphics window creation, options only IOS.")
         ELSE()
-            IF (${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.7.sdk" 
OR ${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.6.sdk" OR 
${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.5.sdk")
+            # Default to Carbon (can we drop this at some point? I mean, 
really?)
+            SET(OSG_WINDOWING_SYSTEM "Carbon" 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 or X11.")
-            ELSE()
-                SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing 
system type for graphics window creation, options Carbon, Cocoa or X11.")
-            ENDIF()
+            # Check old and new Xcode SDK paths
+            SET(OSX_SDK_PATHS 
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
 "/Developer/SDKs")
+            FOREACH (P ${OSX_SDK_PATHS})
+                IF (${CMAKE_OSX_SYSROOT} STREQUAL "${P}/MacOSX10.7.sdk" OR
+                        ${CMAKE_OSX_SYSROOT} STREQUAL "${P}/MacOSX10.6.sdk" OR
+                        ${CMAKE_OSX_SYSROOT} STREQUAL "${P}/MacOSX10.5.sdk")
+                    MESSAGE(STATUS "Using Cocoa")
+                    SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing 
system type for graphics window creation, options Carbon, Cocoa or X11.")
+                    BREAK()
+                ENDIF()
+            ENDFOREACH()
         ENDIF()
 
     ELSE()

Attachment: clang-patch.tar.gz
Description: GNU Zip compressed data

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to