Would it make sense to remove the Video Mode line from the default template in the future so that it'll work on both iPhone and iPad?
Other notes:
- The template should use (!NSClassFromString(@"CADisplayLink")) to check if CADisplayLink is supported instead of checking the system version.
- I tried downloading the binary Ogre iPhone SDK, but it wouldn't run in the latest simulator (4.1). Was Ogre built with the 3.0 SDK? In iOS 3.2, Apple changed the simulator ABI and broke a lot of static libraries. In general, Apple recommends that people always build with the latest SDK, but set their deployment target to the lowest version they want to support.
- The CMake configuration should use "$(ARCHS_STANDARD_32_BIT)" instead of "armv6;armv7;" for CMAKE_OSX_ARCHITECTURES. During build, this turns into "armv6 armv7" for the device, and "i386" for the simulator. This in turn requires an edit to the generated Xcode project:
Code: Select all
sed -i '~' -e 's/ARCHS = $(ARCHS_STANDARD_32_BIT);/ARCHS = "$(ARCHS_STANDARD_32_BIT)";/g' OGRE.xcodeproj/project.pbxproj
Code: Select all
#!/usr/bin/env ruby
require 'FileUtils'
include FileUtils
platforms = %w(iphoneos iphonesimulator)
configurations = %w(Debug Release)
SDKBUILDDIR=`pwd`.strip
def platform_build_dir(platform)
"#{SDKBUILDDIR}/build/#{platform}"
end
def platform_root_dir(platform)
`xcodebuild -version -sdk #{platform} PlatformPath`.strip
end
def check_exit(unused)
raise "error: child process exited with #{$?}." if $? != 0
end
should_clean = ARGV[0] == "clean"
platform_root = platform_root_dir "iphoneos"
puts "Using platform_root: \"#{platform_root}\". Use xcode-select to switch."
lipo = "#{platform_root}/Developer/usr/bin/lipo"
ogre_version = nil
platforms.each do |platform|
b = platform_build_dir platform
rm_rf [b] if should_clean
mkdir_p b
cd b do
puts "Building platform #{platform} in #{`pwd`.strip}"
check_exit(system("cmake -DOGRE_BUILD_PLATFORM_IPHONE:BOOL=TRUE -DOGRE_INSTALL_DEPENDENCIES:BOOL=TRUE -G Xcode ../../../.."))
check_exit(system("sed -i '~' -e 's/ARCHS = $(ARCHS_STANDARD_32_BIT);/ARCHS = \"$(ARCHS_STANDARD_32_BIT)\";/g' OGRE.xcodeproj/project.pbxproj"))
ogre_version=`cat version.txt`
configurations.each do |configuration|
check_exit(system("xcodebuild -project OGRE.xcodeproj -target install -parallelizeTargets -configuration #{configuration} -sdk #{platform}"))
end
end
end
combined_build_dir = platform_build_dir "combined"
mkdir_p combined_build_dir
# Combine device and simulator binaries for convenient linking from Xcode
configurations.each do |configuration|
libnames = platforms.map{|p| "#{platform_build_dir p}/lib/#{configuration}/*.a" }.
map{|p| Dir.glob p }.flatten.map{|p| File.basename p }
dst_dir = "#{combined_build_dir}/lib/#{configuration}"
rm_rf [dst_dir] if should_clean
mkdir_p dst_dir
libnames.each do |libname|
next if libname =~ /^Sample_/
paths = platforms.map{|p| "#{platform_build_dir p}/lib/#{configuration}/#{libname}" }
paths_args = paths.map{|p| "\"#{p}\"" }.join ' '
check_exit(system("\"#{lipo}\" -create -output \"#{dst_dir}/#{libname}\" #{paths_args}"))
end
end
# Bring over libraries of dependencies
configurations.each do |configuration|
dst_dir = "#{combined_build_dir}/lib/#{configuration}"
check_exit(system("cp \"../../iPhoneDependencies/lib/#{configuration}/\"* \"#{dst_dir}/\""))
end
# Copy header files
rm_rf ["#{combined_build_dir}/include"] if should_clean
cp_r "#{platform_build_dir 'iphoneos'}/sdk/include", "#{combined_build_dir}"