OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import("//build/config/sysroot.gni") |
| 6 import("//build/config/mac/mac_sdk.gni") |
| 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 == "armv7" || current_cpu == "arm") { |
| 28 common_mac_flags += [ |
| 29 "-arch", |
| 30 "armv7", |
| 31 ] |
| 32 } else if (current_cpu == "arm64") { |
| 33 common_mac_flags += [ |
| 34 "-arch", |
| 35 "arm64", |
| 36 ] |
| 37 } |
| 38 |
| 39 asmflags = common_mac_flags |
| 40 cflags = common_mac_flags |
| 41 |
| 42 # Without this, the constructors and destructors of a C++ object inside |
| 43 # an Objective C struct won't be called, which is very bad. |
| 44 cflags_objcc = [ "-fobjc-call-cxx-cdtors" ] |
| 45 |
| 46 cflags_c = [ "-std=c99" ] |
| 47 cflags_objc = cflags_c |
| 48 |
| 49 ldflags = common_mac_flags |
| 50 } |
| 51 |
| 52 # This is included by reference in the //build/config/compiler:runtime_library |
| 53 # config that is applied to all targets. It is here to separate out the logic |
| 54 # that is Mac-only. Please see that target for advice on what should go in |
| 55 # :runtime_library vs. :compiler. |
| 56 config("runtime_library") { |
| 57 common_flags = [ |
| 58 "-isysroot", |
| 59 sysroot, |
| 60 "-mmacosx-version-min=$mac_deployment_target", |
| 61 ] |
| 62 |
| 63 asmflags = common_flags |
| 64 cflags = common_flags |
| 65 ldflags = common_flags |
| 66 } |
| 67 |
| 68 # On Mac, this is used for everything except static libraries. |
| 69 config("mac_dynamic_flags") { |
| 70 ldflags = [] |
| 71 |
| 72 if (is_component_build) { |
| 73 ldflags += [ |
| 74 # Path for loading shared libraries for unbundled binaries. |
| 75 "-Wl,-rpath,@loader_path/.", |
| 76 |
| 77 # Path for loading shared libraries for bundled binaries. Get back from |
| 78 # Binary.app/Contents/MacOS. |
| 79 "-Wl,-rpath,@loader_path/../../..", |
| 80 ] |
| 81 } |
| 82 } |
| 83 |
| 84 # On Mac, this is used only for executables. |
| 85 config("mac_executable_flags") { |
| 86 # Remove this when targeting >=10.7 since it is the default in that config. |
| 87 ldflags = [ "-Wl,-pie" ] # Position independent. |
| 88 } |
OLD | NEW |