aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/protobuf/xcodegen.proto4
-rw-r--r--src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java20
2 files changed, 22 insertions, 2 deletions
diff --git a/src/main/protobuf/xcodegen.proto b/src/main/protobuf/xcodegen.proto
index ddfc10f4bf..9e12a1da2a 100644
--- a/src/main/protobuf/xcodegen.proto
+++ b/src/main/protobuf/xcodegen.proto
@@ -38,6 +38,10 @@ message Control {
// Absolute path to the root of the current Bazel user workspace.
optional string workspace_root = 4;
+
+ // CPU architectures (armv7, arm64, i386, x86_64, etc.) used to build for
+ // targets in the project.pbxproj file.
+ repeated string cpu_architecture = 5;
}
// Information about dependency on a separate target.
diff --git a/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java b/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java
index a5c96ccbac..01b6579da7 100644
--- a/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java
+++ b/src/objc_tools/xcodegen/java/com/google/devtools/build/xcode/xcodegen/XcodeprojGeneration.java
@@ -331,6 +331,23 @@ public class XcodeprojGeneration {
return (NSArray) NSObject.wrap(result.build().asList());
}
+ /**
+ * Returns the {@code ARCHS} array for a target's build config given the list of architecture
+ * strings. If none is given, an array with default architectures "armv7" and "arm64" will be
+ * returned.
+ */
+ private static NSArray cpuArchitectures(Iterable<String> architectures) {
+ if (Iterables.isEmpty(architectures)) {
+ return new NSArray(new NSString("armv7"), new NSString("arm64"));
+ } else {
+ ImmutableSet.Builder<NSString> result = new ImmutableSet.Builder<>();
+ for (String architecture : architectures) {
+ result.add(new NSString(architecture));
+ }
+ return (NSArray) NSObject.wrap(result.build().asList());
+ }
+ }
+
private static PBXFrameworksBuildPhase buildLibraryInfo(
LibraryObjects libraryObjects, TargetControl target) {
BuildPhaseBuilder builder = libraryObjects.newBuildPhase();
@@ -370,8 +387,7 @@ public class XcodeprojGeneration {
RelativePaths.fromString(fileSystem, control.getPbxproj()));
NSDictionary projBuildConfigMap = new NSDictionary();
- projBuildConfigMap.put("ARCHS", new NSArray(
- new NSString("armv7"), new NSString("arm64")));
+ projBuildConfigMap.put("ARCHS", cpuArchitectures(control.getCpuArchitectureList()));
projBuildConfigMap.put("CLANG_ENABLE_OBJC_ARC", "YES");
projBuildConfigMap.put("SDKROOT", "iphoneos");
projBuildConfigMap.put("IPHONEOS_DEPLOYMENT_TARGET", "7.0");