Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3356)

Unified Diff: build/common.gypi

Issue 156473005: Add support for sub-architecture when building for iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a typo Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 43f73de1845bbf7255a8ae320a09b397e14bb083..e859749716089e2129bea36d4cd461b263ab4367 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -136,8 +136,9 @@
'host_arch%': '<(host_arch)',
# Default architecture we're building for is the architecture we're
- # building on.
+ # building on, and possibly sub-architecture (for iOS builds).
'target_arch%': '<(host_arch)',
+ 'target_subarch%': '',
# This is set when building the Android WebView inside the Android
# build system, using the 'android' gyp backend. The WebView code is
@@ -220,6 +221,18 @@
}, {
'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
}],
+
+ # Set the default "target_subarch" on iOS. Valid values are "arm32",
+ # "arm64" and "both" (meaning a fat binary).
+ #
+ # TODO(sdefresne): change the default from "arm32" to "both" for
+ # "target_subarch" once http://crbug.com/339477 is fixed.
+ #
+ # TODO(sdefresne): set the "target_arch" to "arm" once compilation
+ # of skia has been fixed for simulator. http://crbug.com/342377
+ ['OS=="ios"', {
+ 'target_subarch%': 'arm32',
+ }],
],
},
@@ -227,6 +240,7 @@
'chromeos%': '<(chromeos)',
'host_arch%': '<(host_arch)',
'target_arch%': '<(target_arch)',
+ 'target_subarch%': '<(target_subarch)',
'toolkit_views%': '<(toolkit_views)',
'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
'desktop_linux%': '<(desktop_linux)',
@@ -866,6 +880,7 @@
'branding%': '<(branding)',
'buildtype%': '<(buildtype)',
'target_arch%': '<(target_arch)',
+ 'target_subarch%': '<(target_subarch)',
'host_arch%': '<(host_arch)',
'toolkit_views%': '<(toolkit_views)',
'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
@@ -1082,6 +1097,13 @@
'clang%': '<(clang)',
'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
+ # Control which version of clang to use when 'clang' is set to 1 when
+ # building for iOS (Apple has not yet open-sourced support for "arm64"
+ # so when building for that 'target_arch' we have to use clang shipped
+ # with Xcode that does not supports some flags).
+ # TODO(sdefresne): remove this once http://crbug.com/341453 is fixed.
+ 'clang_xcode%': 0,
+
# These two variables can be set in GYP_DEFINES while running
# |gclient runhooks| to let clang run a plugin in every compilation.
# Only has an effect if 'clang=1' is in GYP_DEFINES as well.
@@ -1726,7 +1748,13 @@
['"<(GENERATOR)"=="ninja"', {
'clang%': 1,
'host_os%': "mac",
- }]
+ }],
+ # Apple has not upstreamed the support for "arm64" yet, so when
+ # building for "arm64" or "both", we need to use the clang that
+ # is provided with Xcode.
+ ['target_subarch!="arm32"', {
+ 'clang_xcode%': 1,
+ }],
],
}],
['enable_extensions==1', {
@@ -4029,9 +4057,6 @@
# Note that the prebuilt Clang binaries should not be used for iOS
# development except for ASan builds.
['clang==1', {
- 'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
- 'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
-
# gnu++11 instead of c++11 is needed because some code uses
# typeof() (a GNU extension).
# TODO(thakis): Eventually switch this to c++11 instead of
@@ -4066,24 +4091,37 @@
# Warns when a const char[] is converted to bool.
'-Wstring-conversion',
+ ],
- # Clang considers the `register` keyword as deprecated, but e.g.
- # code generated by flex (used in angle) contains that keyword.
- # http://crbug.com/255186
- '-Wno-deprecated-register',
+ 'conditions': [
+ ['clang_xcode==0', {
+ 'CC': '$(SOURCE_ROOT)/<(clang_dir)/clang',
+ 'LDPLUSPLUS': '$(SOURCE_ROOT)/<(clang_dir)/clang++',
+
+ 'WARNING_CFLAGS': [
+ # Clang considers the `register` keyword as deprecated, but
+ # e.g. code generated by flex (used in angle) contains that
+ # keyword. http://crbug.com/255186
+ #
+ # Note: clang as shipped with Xcode is older and does not
+ # treat the `register` as deprecated and does not define
+ # this flag, so don't enable it if "clang_xcode" is "1".
+ '-Wno-deprecated-register',
+ ],
+ }],
],
}],
- ['clang==1 and clang_use_chrome_plugins==1', {
+ ['clang==1 and clang_xcode==0 and clang_use_chrome_plugins==1', {
'OTHER_CFLAGS': [
'<@(clang_chrome_plugins_flags)',
],
}],
- ['clang==1 and clang_load!=""', {
+ ['clang==1 and clang_xcode==0 and clang_load!=""', {
'OTHER_CFLAGS': [
'-Xclang', '-load', '-Xclang', '<(clang_load)',
],
}],
- ['clang==1 and clang_add_plugin!=""', {
+ ['clang==1 and clang_xcode==0 and clang_add_plugin!=""', {
'OTHER_CFLAGS': [
'-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
],
@@ -4364,14 +4402,32 @@
# Match OS X clang C++11 warning settings.
'-Wno-c++11-narrowing',
],
+
+ # Limit the valid architectures depending on "target_subarch".
+ # This need to include the "arm" architectures but also the "x86"
+ # ones (they are used when building for the simulator).
+ 'conditions': [
+ ['target_subarch=="arm32"', {
+ 'VALID_ARCHS': ['armv7', 'i386'],
+ }],
+ ['target_subarch=="arm64"', {
+ 'VALID_ARCHS': ['arm64', 'x86_64'],
+ }],
+ ['target_subarch=="both"', {
+ 'VALID_ARCHS': ['arm64', 'armv7', 'x86_64', 'i386'],
+ }],
+ ],
},
'target_conditions': [
['_toolset=="host"', {
'xcode_settings': {
'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
+ 'VALID_ARCHS': [
+ 'x86_64',
+ ],
'ARCHS': [
- 'x86_64'
+ 'x86_64',
],
},
}],
@@ -4381,6 +4437,7 @@
# since we can't negate the iphone deployment target above, we
# instead set it here for target only.
'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_deployment_target)',
+ 'ARCHS': ['$(ARCHS_STANDARD_INCLUDING_64_BIT)'],
},
}],
['_type=="executable"', {
@@ -4777,7 +4834,8 @@
],
},
}],
- ['clang==1 and OS!="win"', {
+ ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
+ 'and OS!="win"', {
'make_global_settings': [
['CC', '<(make_clang_dir)/bin/clang'],
['CXX', '<(make_clang_dir)/bin/clang++'],
@@ -4813,7 +4871,8 @@
# TODO(yyanagisawa): supports GENERATOR==make
# make generator doesn't support CC_wrapper without CC
# in make_global_settings yet.
- ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
+ ['use_goma==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) and '
+ '("<(GENERATOR)"=="ninja" or clang==1)', {
'make_global_settings': [
['CC_wrapper', '<(gomadir)/gomacc'],
['CXX_wrapper', '<(gomadir)/gomacc'],
@@ -4861,7 +4920,6 @@
['OS=="ios"', {
# Target both iPhone and iPad.
'TARGETED_DEVICE_FAMILY': '1,2',
- 'VALID_ARCHS': 'armv7 i386',
}, { # OS!="ios"
'conditions': [
['target_arch=="x64"', {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698