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 # Base compiler configuration. | 5 # Base compiler configuration. |
6 config("compiler") { | 6 config("compiler") { |
7 include_dirs = [ "//", root_gen_dir ] | 7 include_dirs = [ "//", root_gen_dir ] |
8 if (is_win) { | 8 if (is_win) { |
9 cflags = [ | 9 cflags = [ |
10 "/Gy", # Enable function-level linking. | 10 "/Gy", # Enable function-level linking. |
(...skipping 21 matching lines...) Expand all Loading... |
32 # Stack protection. | 32 # Stack protection. |
33 # TODO(brettw) why do we have different values for all of these cases? | 33 # TODO(brettw) why do we have different values for all of these cases? |
34 if (is_mac) { | 34 if (is_mac) { |
35 cflags += "-fstack-protector-all" | 35 cflags += "-fstack-protector-all" |
36 } else if (is_chromeos) { | 36 } else if (is_chromeos) { |
37 cflags += "-fstack-protector-strong" | 37 cflags += "-fstack-protector-strong" |
38 } else if (is_linux) { | 38 } else if (is_linux) { |
39 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] | 39 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] |
40 } | 40 } |
41 | 41 |
42 # Mac-specific compiler flags setup. | |
43 # ---------------------------------- | |
44 if (is_mac) { | 42 if (is_mac) { |
| 43 # Mac-specific compiler flags setup. |
| 44 # ---------------------------------- |
| 45 |
45 # These flags are shared between the C compiler and linker. | 46 # These flags are shared between the C compiler and linker. |
46 common_mac_flags = [ | 47 common_mac_flags = [ |
47 # TODO(brettw) obviously this arch flag needs to be parameterized. | |
48 "-arch i386", | |
49 | |
50 # Set which SDK to use. | 48 # Set which SDK to use. |
51 # TODO(brettw) this needs to be configurable somehow. | 49 # TODO(brettw) this needs to be configurable somehow. |
52 "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOS
X.platform/Developer/SDKs/MacOSX10.7.sdk", | 50 "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOS
X.platform/Developer/SDKs/MacOSX10.7.sdk", |
53 | 51 |
54 "-mmacosx-version-min=10.6", | 52 "-mmacosx-version-min=10.6", |
55 ] | 53 ] |
56 | 54 |
| 55 # CPU architecture. |
| 56 if (cpu_arch == "x64") { |
| 57 common_mac_flags += "-arch x86_64" |
| 58 } else if (cpu_arch == "x32") { |
| 59 common_mac_flags += "-arch i386" |
| 60 } |
| 61 |
57 cflags += common_mac_flags + [ | 62 cflags += common_mac_flags + [ |
58 # Without this, the constructors and destructors of a C++ object inside | 63 # Without this, the constructors and destructors of a C++ object inside |
59 # an Objective C struct won't be called, which is very bad. | 64 # an Objective C struct won't be called, which is very bad. |
60 "-fobjc-call-cxx-cdtors", | 65 "-fobjc-call-cxx-cdtors", |
61 ] | 66 ] |
62 | 67 |
63 cflags_c += [ "-std=c99" ] | 68 cflags_c += [ "-std=c99" ] |
64 cflags_cc += [ "-std=gnu++11" ] | 69 cflags_cc += [ "-std=gnu++11" ] |
65 | 70 |
66 ldflags += common_mac_flags + [ | 71 ldflags += common_mac_flags + [ |
67 "-L.", | 72 "-L.", |
68 | 73 |
69 # TODO(brettW) I don't understand these options. | 74 # TODO(brettW) I don't understand these options. |
70 "-Wl,-rpath,@loader_path/.", | 75 "-Wl,-rpath,@loader_path/.", |
71 "-Wl,-rpath,@loader_path/../../..", | 76 "-Wl,-rpath,@loader_path/../../..", |
72 ] | 77 ] |
| 78 } else { |
| 79 # Non-Mac Posix compiler flags setup. |
| 80 # ----------------------------------- |
| 81 |
| 82 # CPU architecture. We may or may not be doing a cross compile now, so for |
| 83 # simplicity we always explicitly set the architecture. |
| 84 if (cpu_arch == "x64") { |
| 85 cflags += "-m64" |
| 86 ldflags += "-m64" |
| 87 } else if (cpu_arch == "x32") { |
| 88 cflags += "-m32" |
| 89 ldflags += "-m32" |
| 90 } |
73 } | 91 } |
74 | 92 |
75 # Linux-specific compiler flags setup. | 93 # Linux-specific compiler flags setup. |
76 # ------------------------------------ | 94 # ------------------------------------ |
77 if (is_linux) { | 95 if (is_linux) { |
78 cflags += [ | 96 cflags += [ |
79 "-fPIC", | 97 "-fPIC", |
80 "-pthread", | 98 "-pthread", |
81 "-pipe", # Use pipes for communicating between sub-processes. Faster. | 99 "-pipe", # Use pipes for communicating between sub-processes. Faster. |
82 ] | 100 ] |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } else { | 405 } else { |
388 cflags = [ "-g1" ] | 406 cflags = [ "-g1" ] |
389 } | 407 } |
390 } | 408 } |
391 | 409 |
392 config("no_symbols") { | 410 config("no_symbols") { |
393 if (!is_win) { | 411 if (!is_win) { |
394 cflags = [ "-g0" ] | 412 cflags = [ "-g0" ] |
395 } | 413 } |
396 } | 414 } |
OLD | NEW |