|
|
|
@ -50,64 +50,66 @@ ENDIF()
|
|
|
|
|
# value is needed to find the correct version of OpenGL (X11 or Cocoa).
|
|
|
|
|
IF(APPLE AND NOT ANDROID)
|
|
|
|
|
|
|
|
|
|
# Here we check if the user specified IPhone SDK
|
|
|
|
|
# These options are formally defined later, but can also be specified
|
|
|
|
|
# by the user at the command line using the cmake -D switch
|
|
|
|
|
# Note that FORCE is used since the user will likely enable IPhone
|
|
|
|
|
# build via CMake GUI after already having configured once
|
|
|
|
|
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.")
|
|
|
|
|
# custom option to flag an iOS build
|
|
|
|
|
OPTION(OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF)
|
|
|
|
|
|
|
|
|
|
#set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
|
|
|
|
IF(${IPHONE_VERSION_MIN} LESS "7.0")
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "armv7;armv7s;arm64" CACHE STRING "Build architectures for iOS" FORCE)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
# set sdk and min versions
|
|
|
|
|
SET (IPHONE_SDKVER "10.2" CACHE STRING "IOS SDK-Version")
|
|
|
|
|
SET (IPHONE_VERSION_MIN "7.0" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
|
|
|
|
|
|
|
|
|
|
# get full path to sdk from requested versions
|
|
|
|
|
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
|
|
|
|
|
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
|
|
|
|
|
|
|
|
|
|
# optionally enable bitcode for the build
|
|
|
|
|
SET (IPHONE_ENABLE_BITCODE "NO" CACHE STRING "IOS Enable Bitcode")
|
|
|
|
|
|
|
|
|
|
# seamless toggle between device and simulator
|
|
|
|
|
SET(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
|
|
|
|
|
|
|
|
|
|
# set deployment target to min version
|
|
|
|
|
SET(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONE_VERSION_MIN}" CACHE STRING "Deployment target for iOS" FORCE)
|
|
|
|
|
|
|
|
|
|
# Set standard architectures
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")
|
|
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
|
#simulator uses i386 and x86_64 architectures
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for iOS Simulator" FORCE)
|
|
|
|
|
ENDIF()
|
|
|
|
|
# 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.")
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two separate projects
|
|
|
|
|
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
|
|
|
|
|
|
|
|
|
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.")
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
|
|
|
|
|
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
|
|
|
|
|
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
|
|
|
|
|
# These are set the first time CMake is run, and can be changed by
|
|
|
|
|
# the user at any time.
|
|
|
|
|
IF(OSG_OSX_VERSION VERSION_GREATER 10.7)
|
|
|
|
|
# 64 Bit Works, i386,ppc is not supported any more
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "Target OSX version")
|
|
|
|
|
ELSEIF(OSG_OSX_VERSION VERSION_EQUAL 10.7)
|
|
|
|
|
# 64 Bit Works, PPC is not supported any more
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
ELSEIF(OSG_OSX_VERSION VERSION_GREATER 10.4)
|
|
|
|
|
# 64-bit compiles are not supported with Carbon.
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "Target OSX version")
|
|
|
|
|
ELSEIF(OSG_OSX_VERSION VERSION_EQUAL 10.4)
|
|
|
|
|
# 64-bit compiles are not supported with Carbon.
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
ELSE()
|
|
|
|
|
# No Universal Binary support and SDK detection is too unreliable.
|
|
|
|
|
# Warn user and continue at their own peril.
|
|
|
|
|
MESSAGE(WARNING "OSX 10.3 and earlier not supported.")
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
|
|
|
|
|
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
|
|
|
|
|
# These are set the first time CMake is run, and can be changed by
|
|
|
|
|
# the user at any time.
|
|
|
|
|
IF(OSG_OSX_VERSION VERSION_GREATER 10.7)
|
|
|
|
|
# 64 Bit Works, i386,ppc is not supported any more
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "Target OSX version")
|
|
|
|
|
ELSEIF(OSG_OSX_VERSION VERSION_EQUAL 10.7)
|
|
|
|
|
# 64 Bit Works, PPC is not supported any more
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
ELSEIF(OSG_OSX_VERSION VERSION_GREATER 10.4)
|
|
|
|
|
# 64-bit compiles are not supported with Carbon.
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "Target OSX version")
|
|
|
|
|
ELSEIF(OSG_OSX_VERSION VERSION_EQUAL 10.4)
|
|
|
|
|
# 64-bit compiles are not supported with Carbon.
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX")
|
|
|
|
|
ELSE()
|
|
|
|
|
# No Universal Binary support and SDK detection is too unreliable.
|
|
|
|
|
# Warn user and continue at their own peril.
|
|
|
|
|
MESSAGE(WARNING "OSX 10.3 and earlier not supported.")
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PROJECT(OpenSceneGraph)
|
|
|
|
|
|
|
|
|
|
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
|
|
|
@ -218,40 +220,15 @@ ENDIF(OSG_MAINTAINER)
|
|
|
|
|
|
|
|
|
|
IF(NOT ANDROID)
|
|
|
|
|
IF(APPLE)
|
|
|
|
|
# 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
|
|
|
|
|
# set to true. Should really have an OSG_BUILD_PLATFORM variable that we set to our desired platform
|
|
|
|
|
OPTION(OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF)
|
|
|
|
|
OPTION(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR "Enable IPhoneSDK Simulator support" OFF)
|
|
|
|
|
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
|
|
|
|
|
|
|
|
|
#you need to manually set the default sdk version here
|
|
|
|
|
SET (IPHONE_SDKVER "10.2" CACHE STRING "IOS SDK-Version")
|
|
|
|
|
SET (IPHONE_VERSION_MIN "7.0" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
|
|
|
|
|
# set the sdk path as our sysroot, if we set this before the project is defined cmake fails to build its test program
|
|
|
|
|
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
|
|
|
|
|
|
|
|
|
#the below is taken from ogre, it states the gcc stuff needs to happen before PROJECT() is called. I've no clue if we even need it
|
|
|
|
|
# Force gcc <= 4.2 on iPhone
|
|
|
|
|
IF(IPHONE_VERSION_MIN LESS "6.0")
|
|
|
|
|
include(CMakeForceCompiler)
|
|
|
|
|
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
|
|
|
|
|
CMAKE_FORCE_CXX_COMPILER(llvm-gcc-4.2 GNU)
|
|
|
|
|
SET(GCC_THUMB_SUPPORT NO)
|
|
|
|
|
ENDIF()
|
|
|
|
|
# Set the path to OpenGL library
|
|
|
|
|
SET(OPENGL_gl_LIBRARY "${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES.framework")
|
|
|
|
|
|
|
|
|
|
#set either the device sdk or the simulator sdk. Can't find away to separate these in the same project
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
|
|
|
|
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
|
|
|
|
|
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
|
|
|
|
|
ELSE()
|
|
|
|
|
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer")
|
|
|
|
|
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
SET (IPHONE_ENABLE_BITCODE "NO" CACHE STRING "IOS Enable Bitcode")
|
|
|
|
|
|
|
|
|
|
# Apple iOS: Find OpenGLES
|
|
|
|
|
FIND_LIBRARY(OPENGLES_LIBRARY OpenGLES)
|
|
|
|
|
ELSE ()
|
|
|
|
|
FIND_LIBRARY(CARBON_LIBRARY Carbon)
|
|
|
|
|
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
|
|
|
|
@ -1105,41 +1082,15 @@ ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(APPLE AND NOT ANDROID)
|
|
|
|
|
|
|
|
|
|
#Here we check if the user specified IPhone SDK
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
|
|
|
|
|
|
|
|
|
#set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
|
|
|
|
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
|
|
|
|
IF(${IPHONE_VERSION_MIN} LESS "7.0")
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
|
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-thumb -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "armv7;armv7s;arm64" CACHE STRING "Build architectures for iOS" FORCE)
|
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
|
|
|
ENDIF()
|
|
|
|
|
# set osg window system to iOS
|
|
|
|
|
SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Windowing system type for graphics window creation, options only IOS." FORCE)
|
|
|
|
|
|
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN}" FORCE)
|
|
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
|
#simulator uses i386 and x86_64 architectures
|
|
|
|
|
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for iOS Simulator" FORCE)
|
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-thumb -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
|
|
|
|
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mios-simulator-version-min=${IPHONE_VERSION_MIN}" FORCE)
|
|
|
|
|
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two separate projects
|
|
|
|
|
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
|
|
|
|
|
|
|
|
|
#hack, force link to opengles
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -framework OpenGLES")
|
|
|
|
|
|
|
|
|
|
#use the IPhone windowing system
|
|
|
|
|
SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Forced IPhone windowing system on iOS" FORCE)
|
|
|
|
|
# set osg default image plugin
|
|
|
|
|
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for iOS" FORCE)
|
|
|
|
|
|
|
|
|
|
#I think this or similar will be required for IPhone apps
|
|
|
|
|
# ensure app bundles for example app
|
|
|
|
|
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" ON)
|
|
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
|