From 0b88ad24b27f1ef683261565854a681cba2500d8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 21 Feb 2012 11:30:07 +0000 Subject: [PATCH] From Olaf Flebbe, "Macos X cleanup: I added AFAIK proper defaults for several Macos X Version API targets. * In order to determine which defaults to apply, consult the CMAKE_OSX_SYSROOT variable pointing to the used SDK, not the pure existence of an SDK. * Defaults are now: 10.7: Support Intel 32 and 64 Bit Cocoa with imageio picture reader 10.6 + 10.5: Support Cocoa with imageio on Intel and PowerPC 10.4: Carbon, Quicktime and PowerPC Now OSG compiles out of the box for MacOSX 10.7. , tested with gcc and clang with FlightGear." --- CMakeLists.txt | 15 +++++++++------ src/osgDB/CMakeLists.txt | 2 -- src/osgViewer/CMakeLists.txt | 7 ++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd327746b..0fc70e11b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -822,15 +822,18 @@ IF(APPLE) # This is really fragile, but CMake doesn't provide the OS system # version information we need. (Darwin versions can be changed # independently of OS X versions.) - # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically. - IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk) - # 64-bit compiles are not supported with Carbon. We should enable - # 64-bit compilation by default once osgviewer has been - # rewritten with Cocoa. - #SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) + IF (${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.7.sdk") + SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) + # 64 Bit Works, PPC is not supported any more + SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) + ELSEIF(${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.5.sdk" OR ${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.6.sdk") + SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) + # 64-bit compiles are not supported with Carbon. SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) + SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) ELSE() diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index b4adbdcfe..25ac27a4d 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -127,8 +127,6 @@ IF(APPLE) SET(OSGDB_PLATFORM_SPECIFIC_LIBRARIES ${CARBON_LIBRARY}) ENDIF() - SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "standard image plugin for os x, options are quicktime, imageio") - IF(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX STREQUAL "quicktime") ADD_DEFINITIONS(-DDARWIN_QUICKTIME) ELSE() diff --git a/src/osgViewer/CMakeLists.txt b/src/osgViewer/CMakeLists.txt index f1ba894ac..932c9d145 100644 --- a/src/osgViewer/CMakeLists.txt +++ b/src/osgViewer/CMakeLists.txt @@ -68,7 +68,12 @@ ELSE() 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() - SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.") + 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") + + 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() ENDIF() ELSE()