add 'scheme' and 'products' variables for vendor_project/xcode, fix use of 'xcodeproj'

This commit is contained in:
Laurent Sansonetti
2011-12-10 22:51:16 +01:00
parent 412d6126f2
commit 6801f9d356

View File

@@ -36,18 +36,28 @@ module Motion; module Project;
end
projs[0]
end
target = opts.delete(:target) || File.basename(xcodeproj, '.xcodeproj')
target = opts.delete(:target)
scheme = opts.delete(:scheme)
if target and scheme
$stderr.puts "Both :target and :scheme are provided"
exit 1
end
configuration = opts.delete(:configuration) || 'Release'
# Build project into `build' directory. We delete the build directory each time because
# Xcode is too stupid to be trusted to use the same build directory for different
# platform builds.
rm_rf 'build'
sh "/usr/bin/xcodebuild -target #{target} -configuration #{configuration} -sdk #{platform.downcase}#{@config.sdk_version} #{archs.map { |x| '-arch ' + x }.join(' ')} CONFIGURATION_BUILD_DIR=build build"
xcopts = ''
xcopts << "-target \"#{target}\" " if target
xcopts << "-scheme \"#{scheme}\" " if scheme
sh "/usr/bin/xcodebuild -project \"#{xcodeproj}\" #{xcopts} -configuration \"#{configuration}\" -sdk #{platform.downcase}#{@config.sdk_version} #{archs.map { |x| '-arch ' + x }.join(' ')} CONFIGURATION_BUILD_DIR=build build"
# Copy .a files into the platform build directory.
prods = opts.delete(:products)
Dir.glob('build/*.a').each do |lib|
lib = File.readlink(lib)
next if prods and !prods.include?(File.basename(lib))
lib = File.readlink(lib) if File.symlink?(lib)
sh "/bin/cp \"#{lib}\" \"#{build_dir}\""
end
end