Merge pull request #672 from ccochran/OpenSceneGraph-3.6
Xcode 9/10 build fixes for OSG 3.6
This commit is contained in:
commit
ef8fd268de
173
CMakeLists.txt
173
CMakeLists.txt
@ -50,64 +50,66 @@ ENDIF()
|
|||||||
# value is needed to find the correct version of OpenGL (X11 or Cocoa).
|
# value is needed to find the correct version of OpenGL (X11 or Cocoa).
|
||||||
IF(APPLE AND NOT ANDROID)
|
IF(APPLE AND NOT ANDROID)
|
||||||
|
|
||||||
# Here we check if the user specified IPhone SDK
|
# custom option to flag an iOS build
|
||||||
# These options are formally defined later, but can also be specified
|
OPTION(OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF)
|
||||||
# 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.")
|
|
||||||
|
|
||||||
#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(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 sdk and min versions
|
||||||
ELSE()
|
SET (IPHONE_SDKVER "10.2" CACHE STRING "IOS SDK-Version")
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "armv7;armv7s;arm64" CACHE STRING "Build architectures for iOS" FORCE)
|
SET (IPHONE_VERSION_MIN "7.0" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
|
||||||
ENDIF()
|
|
||||||
|
# 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()
|
ELSE()
|
||||||
#simulator uses i386 and x86_64 architectures
|
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for iOS Simulator" FORCE)
|
IF(OSG_OSX_VERSION VERSION_LESS 10.5)
|
||||||
ENDIF()
|
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 defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
|
||||||
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
# 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
|
||||||
ELSE()
|
# the user at any time.
|
||||||
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
|
IF(OSG_OSX_VERSION VERSION_GREATER 10.7)
|
||||||
IF(OSG_OSX_VERSION VERSION_LESS 10.5)
|
# 64 Bit Works, i386,ppc is not supported any more
|
||||||
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
|
||||||
ELSE()
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "Target OSX version")
|
||||||
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
|
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()
|
||||||
|
|
||||||
# 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()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
PROJECT(OpenSceneGraph)
|
PROJECT(OpenSceneGraph)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
||||||
@ -218,40 +220,15 @@ ENDIF(OSG_MAINTAINER)
|
|||||||
|
|
||||||
IF(NOT ANDROID)
|
IF(NOT ANDROID)
|
||||||
IF(APPLE)
|
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 the sdk path as our sysroot, if we set this before the project is defined cmake fails to build its test program
|
||||||
SET (IPHONE_SDKVER "10.2" CACHE STRING "IOS SDK-Version")
|
SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)
|
||||||
SET (IPHONE_VERSION_MIN "7.0" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
|
|
||||||
|
|
||||||
#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
|
# Set the path to OpenGL library
|
||||||
# Force gcc <= 4.2 on iPhone
|
SET(OPENGL_gl_LIBRARY "${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES.framework")
|
||||||
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 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 ()
|
ELSE ()
|
||||||
FIND_LIBRARY(CARBON_LIBRARY Carbon)
|
FIND_LIBRARY(CARBON_LIBRARY Carbon)
|
||||||
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
|
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
|
||||||
@ -1107,41 +1084,15 @@ ENDIF()
|
|||||||
|
|
||||||
IF(APPLE AND NOT ANDROID)
|
IF(APPLE AND NOT ANDROID)
|
||||||
|
|
||||||
#Here we check if the user specified IPhone SDK
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
|
||||||
|
|
||||||
#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
|
# set osg window system to iOS
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE)
|
SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Windowing system type for graphics window creation, options only IOS." FORCE)
|
||||||
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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN}" FORCE)
|
# set osg default image plugin
|
||||||
|
|
||||||
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_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for iOS" FORCE)
|
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)
|
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" ON)
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
|
@ -225,7 +225,7 @@ MACRO(SETUP_LIBRARY LIB_NAME)
|
|||||||
)
|
)
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
||||||
@ -336,7 +336,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@ -429,7 +429,7 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
|||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
17
README.md
17
README.md
@ -88,13 +88,14 @@ Many of the example programs use command-line arguments. When double-clicking on
|
|||||||
|
|
||||||
## Section 3. Release notes on iOS build, by Thomas Hogarth
|
## Section 3. Release notes on iOS build, by Thomas Hogarth
|
||||||
|
|
||||||
With CMake, XCode and the iOS sdk installed you can generate an iOS XCode project using the following command line:
|
With CMake 3.11, XCode 9.4 and the iOS sdk 11.4 installed you can generate an iOS XCode project using the following command line:
|
||||||
|
|
||||||
export THIRDPARTY_PATH=/path/to/my/3rdParty
|
export THIRDPARTY_PATH=/path/to/3rdParty
|
||||||
cmake ./ -G Xcode -DOSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
|
cmake ./ -G Xcode -DOSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
|
||||||
-DIPHONE_SDKVER="10.2" \
|
-DIPHONE_SDKVER="11.4" \
|
||||||
-DIPHONE_VERSION_MIN="8.0" \
|
-DIPHONE_VERSION_MIN="10.0" \
|
||||||
-DOPENGL_PROFILE:STRING=GLES2 \
|
-DOPENGL_PROFILE:STRING=GLES3 \
|
||||||
|
-DOSG_CPP_EXCEPTIONS_AVAILABLE:BOOL=ON \
|
||||||
-DBUILD_OSG_APPLICATIONS:BOOL=OFF \
|
-DBUILD_OSG_APPLICATIONS:BOOL=OFF \
|
||||||
-DBUILD_OSG_EXAMPLES:BOOL=ON \
|
-DBUILD_OSG_EXAMPLES:BOOL=ON \
|
||||||
-DOSG_WINDOWING_SYSTEM:STRING=IOS \
|
-DOSG_WINDOWING_SYSTEM:STRING=IOS \
|
||||||
@ -105,15 +106,15 @@ With CMake, XCode and the iOS sdk installed you can generate an iOS XCode projec
|
|||||||
-DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a" \
|
-DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a" \
|
||||||
-DFREETYPE_INCLUDE_DIR_freetype2:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include/freetype" \
|
-DFREETYPE_INCLUDE_DIR_freetype2:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include/freetype" \
|
||||||
-DFREETYPE_INCLUDE_DIR_ft2build:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include" \
|
-DFREETYPE_INCLUDE_DIR_ft2build:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include" \
|
||||||
-DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreeType_iphone_universal.a" \
|
-DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreetype2.a" \
|
||||||
-DTIFF_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/tiff-ios-device/include" \
|
-DTIFF_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/tiff-ios-device/include" \
|
||||||
-DTIFF_LIBRARY:PATH="$THIRDPARTY_PATH/tiff-ios-device/lib/libtiff.a" \
|
-DTIFF_LIBRARY:PATH="$THIRDPARTY_PATH/tiff-ios-device/lib/libtiff.a" \
|
||||||
-DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \
|
-DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \
|
||||||
-DGDAL_LIBRARY:PATH="$THIRDPARTY_PATH/gdal-ios-device/lib/libgdal.a"
|
-DGDAL_LIBRARY:PATH="$THIRDPARTY_PATH/gdal-ios-device/lib/libgdal.a"
|
||||||
|
|
||||||
|
|
||||||
Be sure to set the THIRDPARTY_PATH to the path containing your thirdparty dependencies. Set IPHONE_SDKVER to the version of the iOS sdk you have installed, in this instance 10.2. IPHONE_VERSION_MIN controls the base sdk used by xcode, and lastly set OPENGL_PROFILE to the version of GLES you want to use.
|
Be sure to set the THIRDPARTY_PATH to the path containing your thirdparty dependencies. Set IPHONE_SDKVER to the version of the iOS sdk you have installed, in this instance 11.4. IPHONE_VERSION_MIN controls the deployment sdk used by xcode, and lastly set OPENGL_PROFILE to the version of GLES you want to use.
|
||||||
|
|
||||||
Once this completes an XCode project will have been generated in the osg root folder. Open the generated Xcode project, select the example_osgViewerIPhone target. In 'General' tab set a development team. In the 'Build Settings' tab search for 'Other Linker Flags', then for each target type (debug, release etc) that you want to use open the list of arguments and delete the 'OpenGL' line and the '-framework' line above it. This is because cmake has tried to add the desktop OpenGL library which we don't want.
|
Once this completes an XCode project will have been generated in the osg root folder. Open the generated Xcode project, select the example_osgViewerIPhone target. In 'General' tab set a development team.
|
||||||
|
|
||||||
Once this is done you should be able to build and deploy the `example_osgViewerIPhone` target on your device.
|
Once this is done you should be able to build and deploy the `example_osgViewerIPhone` target on your device.
|
||||||
|
@ -243,13 +243,11 @@ ELSE(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
#needed on win32 or the linker get confused by _declspec declarations
|
#needed on win32 or the linker get confused by _declspec declarations
|
||||||
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
|
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(osgstaticviewer)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
|
|
||||||
# IPHONE_PORT@tom
|
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
|
||||||
ADD_SUBDIRECTORY(osgviewerIPhone)
|
ADD_SUBDIRECTORY(osgviewerIPhone)
|
||||||
|
ELSE()
|
||||||
|
ADD_SUBDIRECTORY(osgstaticviewer)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
# IPHONE_PORT@tom
|
|
||||||
|
|
||||||
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
|
|||||||
#backup setting
|
#backup setting
|
||||||
SET(TMP_OSG_BUILD_APPLICATION_BUNDLES {$OSG_BUILD_APPLICATION_BUNDLES})
|
SET(TMP_OSG_BUILD_APPLICATION_BUNDLES {$OSG_BUILD_APPLICATION_BUNDLES})
|
||||||
SET(OSG_BUILD_APPLICATION_BUNDLES TRUE)
|
SET(OSG_BUILD_APPLICATION_BUNDLES TRUE)
|
||||||
SET(MACOSX_DEPLOYMENT_TARGET, ${IPHONE_VERSION_MIN})
|
#SET(MACOSX_DEPLOYMENT_TARGET, ${IPHONE_VERSION_MIN})
|
||||||
SETUP_EXAMPLE(osgViewerIPhone)
|
SETUP_EXAMPLE(osgViewerIPhone)
|
||||||
SET_TARGET_PROPERTIES(example_osgViewerIPhone PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
|
SET_TARGET_PROPERTIES(example_osgViewerIPhone PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
|
||||||
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONE_VERSION_MIN}
|
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONE_VERSION_MIN}
|
||||||
@ -35,4 +35,4 @@ SET_TARGET_PROPERTIES(example_osgViewerIPhone PROPERTIES XCODE_ATTRIBUTE_CODE_SI
|
|||||||
|
|
||||||
#restore setting
|
#restore setting
|
||||||
SET(OSG_BUILD_APPLICATION_BUNDLES {$TMP_OSG_BUILD_APPLICATION_BUNDLES})
|
SET(OSG_BUILD_APPLICATION_BUNDLES {$TMP_OSG_BUILD_APPLICATION_BUNDLES})
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS "-framework QuartzCore -framework Foundation -framework OpenGLES -framework UIKit -framework ImageIO -framework CoreImage -framework MobileCoreServices -framework CoreGraphics")
|
SET(CMAKE_EXE_LINKER_FLAGS "-framework QuartzCore -framework Foundation -framework UIKit -framework ImageIO -framework CoreImage -framework MobileCoreServices -framework CoreGraphics")
|
||||||
|
@ -130,7 +130,7 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE ${IPHONE_ENABLE_BITCODE})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -126,7 +126,7 @@ SET(TARGET_SRC
|
|||||||
)
|
)
|
||||||
|
|
||||||
IF(APPLE AND NOT ANDROID)
|
IF(APPLE AND NOT ANDROID)
|
||||||
IF(NOT OSG_BUILD_PLATFORM_IPHONE AND NOT OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(NOT OSG_BUILD_PLATFORM_IPHONE)
|
||||||
# Needs CoreFoundation calls and a Carbon function
|
# Needs CoreFoundation calls and a Carbon function
|
||||||
SET(OSGDB_PLATFORM_SPECIFIC_LIBRARIES ${CARBON_LIBRARY} ${COCOA_LIBRARY})
|
SET(OSGDB_PLATFORM_SPECIFIC_LIBRARIES ${CARBON_LIBRARY} ${COCOA_LIBRARY})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -5,7 +5,7 @@ ENDIF()
|
|||||||
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS} )
|
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS} )
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
IF(NOT OSG_BUILD_PLATFORM_IPHONE AND NOT OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(NOT OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
|
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
SET(TARGET_SRC ReaderWriterImageIO.cpp )
|
SET(TARGET_SRC ReaderWriterImageIO.cpp )
|
||||||
|
|
||||||
IF (APPLE)
|
IF (APPLE)
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
# compile FileUtils.cpp as objective-c++
|
# compile as objective-c++
|
||||||
SET_SOURCE_FILES_PROPERTIES(ReaderWriterImageIO.cpp
|
SET_SOURCE_FILES_PROPERTIES(ReaderWriterImageIO.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
|
||||||
PROPERTIES COMPILE_FLAGS "-x objective-c++"
|
|
||||||
)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ ELSE()
|
|||||||
# X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
|
# X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
# hack for finding the iphone opengl es lib
|
# hack for finding the iphone opengl es lib
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET(OPENGL_INCLUDE_DIR ${IPHONE_SDKROOT}/System/Library/Frameworks)
|
SET(OPENGL_INCLUDE_DIR ${IPHONE_SDKROOT}/System/Library/Frameworks)
|
||||||
SET(OPENGL_LIBRARIES ${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES)
|
SET(OPENGL_LIBRARIES ${IPHONE_SDKROOT}/System/Library/Frameworks/OpenGLES)
|
||||||
ELSE()
|
ELSE()
|
||||||
|
Loading…
Reference in New Issue
Block a user