Commit b983e3a3 authored by Luke Redpath's avatar Luke Redpath

If a platform has a deployment target set, use that to determine if we should use legacy

ARCHs on iOS or not.
parent c6377023
......@@ -30,5 +30,16 @@ module Pod
def nil?
name.nil?
end
def deployment_target
if (opt = options[:deployment_target])
Pod::Version.new(opt)
end
end
def requires_legacy_ios_archs?
return unless deployment_target
(name == :ios) && (deployment_target < Pod::Version.new("4.3"))
end
end
end
......@@ -108,6 +108,9 @@ module Xcodeproj
def self.build_settings(platform, scheme)
settings = COMMON_BUILD_SETTINGS[:all].merge(COMMON_BUILD_SETTINGS[platform.name])
settings['COPY_PHASE_STRIP'] = scheme == :debug ? 'NO' : 'YES'
if platform.requires_legacy_ios_archs?
settings['ARCHS'] = "armv6 armv7"
end
if scheme == :debug
settings.merge!(COMMON_BUILD_SETTINGS[:debug])
settings['ONLY_ACTIVE_ARCH'] = 'YES' if platform == :osx
......
......@@ -51,4 +51,30 @@ describe 'Xcodeproj::Project' do
@project.build_configuration("Release").buildSettings["VALIDATE_PRODUCT"].should == "YES"
end
end
describe "for the :ios platform with a deployment target" do
it "sets ARCHS to 'armv6 armv7' for both configurations if the deployment target is less than 4.3" do
@project = Xcodeproj::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.0"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "armv6 armv7"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "armv6 armv7"
@project = Xcodeproj::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.1"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "armv6 armv7"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "armv6 armv7"
@project = Xcodeproj::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.2"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "armv6 armv7"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "armv6 armv7"
end
it "uses standard ARCHs if deployment target is 4.3 or above" do
@project = Xcodeproj::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.3"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
@project = Xcodeproj::Project.for_platform(Pod::Platform.new(:ios, :deployment_target => "4.4"))
@project.build_configuration("Debug").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
@project.build_configuration("Release").buildSettings["ARCHS"].should == "$(ARCHS_STANDARD_32_BIT)"
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment