OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/sysroot.gni") | 5 import("//build/config/sysroot.gni") |
6 import("//build/config/mac/mac_sdk.gni") | 6 import("//build/config/mac/mac_sdk.gni") |
7 | 7 |
| 8 # This is included by reference in the //build/config/compiler config that |
| 9 # is applied to all targets. It is here to separate out the logic. |
| 10 # |
| 11 # This is applied to BOTH desktop Mac and iOS targets. |
| 12 config("compiler") { |
| 13 # These flags are shared between the C compiler and linker. |
| 14 common_mac_flags = [] |
| 15 |
| 16 # CPU architecture. |
| 17 if (current_cpu == "x64") { |
| 18 common_mac_flags += [ |
| 19 "-arch", |
| 20 "x86_64", |
| 21 ] |
| 22 } else if (current_cpu == "x86") { |
| 23 common_mac_flags += [ |
| 24 "-arch", |
| 25 "i386", |
| 26 ] |
| 27 } else if (current_cpu == "arm") { |
| 28 # TODO(GYP): we may need to distinguish between "arm64", "armv7", |
| 29 # and "armv7s" for iOS, and hence need multiple current_cpu values |
| 30 # rather than just "arm". |
| 31 common_mac_flags += [ |
| 32 "-arch", |
| 33 "arm64", |
| 34 ] |
| 35 } |
| 36 |
| 37 asmflags = common_mac_flags |
| 38 cflags = common_mac_flags |
| 39 |
| 40 # Without this, the constructors and destructors of a C++ object inside |
| 41 # an Objective C struct won't be called, which is very bad. |
| 42 cflags_objcc = [ "-fobjc-call-cxx-cdtors" ] |
| 43 |
| 44 cflags_c = [ "-std=c99" ] |
| 45 cflags_objc = cflags_c |
| 46 |
| 47 ldflags = common_mac_flags |
| 48 } |
| 49 |
8 # This is included by reference in the //build/config/compiler:runtime_library | 50 # This is included by reference in the //build/config/compiler:runtime_library |
9 # config that is applied to all targets. It is here to separate out the logic | 51 # config that is applied to all targets. It is here to separate out the logic |
10 # that is Mac-only. Please see that target for advice on what should go in | 52 # that is Mac-only. Please see that target for advice on what should go in |
11 # :runtime_library vs. :compiler. | 53 # :runtime_library vs. :compiler. |
12 config("runtime_library") { | 54 config("runtime_library") { |
13 common_flags = [ | 55 common_flags = [ |
14 "-isysroot", | 56 "-isysroot", |
15 sysroot, | 57 sysroot, |
16 "-mmacosx-version-min=$mac_deployment_target", | 58 "-mmacosx-version-min=$mac_deployment_target", |
17 ] | 59 ] |
(...skipping 17 matching lines...) Expand all Loading... |
35 "-Wl,-rpath,@loader_path/../../..", | 77 "-Wl,-rpath,@loader_path/../../..", |
36 ] | 78 ] |
37 } | 79 } |
38 } | 80 } |
39 | 81 |
40 # On Mac, this is used only for executables. | 82 # On Mac, this is used only for executables. |
41 config("mac_executable_flags") { | 83 config("mac_executable_flags") { |
42 # Remove this when targeting >=10.7 since it is the default in that config. | 84 # Remove this when targeting >=10.7 since it is the default in that config. |
43 ldflags = [ "-Wl,-pie" ] # Position independent. | 85 ldflags = [ "-Wl,-pie" ] # Position independent. |
44 } | 86 } |
OLD | NEW |