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 includes = [ "//" ] | 7 includes = [ "//" ] |
8 if (is_win) { | 8 if (is_win) { |
9 cflags = [ | 9 cflags = [ |
10 # TODO(brettw) these probably need to be refactored. | 10 # TODO(brettw) these probably need to be refactored. |
11 "/Od", "/WX", "/Zi", "/Gy", "/GS", "/RTC1", "/EHsc", | 11 "/Od", "/WX", "/Zi", "/Gy", "/GS", "/RTC1", "/EHsc", |
12 ] | 12 ] |
13 } else { | 13 } else { |
14 cflags = [ | 14 cflags = [ |
15 # TODO(brettw) obviously this needs to be parameterized. | 15 # TODO(brettw) obviously this needs to be parameterized. |
16 "-arch i386", | 16 "-arch i386", |
17 | 17 |
18 # See http://crbug.com/32204 | 18 # See http://crbug.com/32204 |
19 "-fno-strict-aliasing", | 19 "-fno-strict-aliasing", |
20 | 20 |
21 "-fno-threadsafe-statics", | 21 "-fno-threadsafe-statics", |
22 "-fstack-protector-all", | 22 "-fstack-protector-all", |
23 "-fvisibility-hidden", | 23 "-fvisibility=hidden", |
24 "-fvisibility-inlines-hidden", | 24 "-fvisibility-inlines-hidden", |
25 ] | 25 ] |
26 # !!! Please keep additions sorted alphabetically. | 26 # !!! Please keep additions sorted alphabetically. |
27 | 27 |
28 # TODO(brettw) these should be clang-only. | 28 # TODO(brettw) these should be clang-only. |
29 # if (is_clang) { | 29 # if (is_clang) { |
30 cflags += [ | 30 cflags += [ |
31 "-fcolor-diagnostics", | 31 "-fcolor-diagnostics", |
32 ] | 32 ] |
33 #} | 33 #} |
34 | 34 |
35 cflags_c = [ | 35 cflags_c = [ |
36 "-std=c99", | 36 "-std=c99", |
37 ] | 37 ] |
38 | 38 |
39 cflags_cc = [ | 39 cflags_cc = [ |
40 "-fno-exceptions", | 40 "-fno-exceptions", |
41 "-std=gnu++11", | 41 "-std=gnu++11", |
42 ] | 42 ] |
43 } | 43 } |
44 | 44 |
45 if (is_mac) { | 45 if (is_mac) { |
46 cflags += [ | 46 # These are used for both compiler and linker flags on Mac. |
| 47 common_mac_flags = [ |
| 48 # TODO(brettw) obviously this needs to be parameterized. |
| 49 "-arch i386", |
| 50 |
47 # Set which SDK to use. | 51 # Set which SDK to use. |
48 # TODO(brettw) this needs to be configurable somehow. | 52 # TODO(brettw) this needs to be configurable somehow. |
49 "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.
platform/Developer/SDKs/MacOSX10.7.sdk", | 53 "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.
platform/Developer/SDKs/MacOSX10.7.sdk", |
50 | 54 |
51 "-mmacosx-version-min=10.6", | 55 "-mmacosx-version-min=10.6", |
52 ] | 56 ] |
| 57 |
| 58 # Mac compiler flags. |
| 59 cflags += [ |
| 60 # Without this, the constructors and destructors of a C++ object inside |
| 61 # an Objective C struct won't be called, which is very bad. |
| 62 "-fobjc-call-cxx-cdtors", |
| 63 ] |
| 64 cflags += common_mac_flags |
| 65 |
| 66 # Mac linker flags. |
| 67 ldflags = [ |
| 68 "-L.", |
| 69 |
| 70 # TODO(brettW) I don't understand these options. |
| 71 "-Wl,-rpath,@loader_path/.", |
| 72 "-Wl,-rpath,@loader_path/../../..", |
| 73 ] |
| 74 ldflags += common_mac_flags |
53 } | 75 } |
54 } | 76 } |
55 | 77 |
56 # runtime_library ------------------------------------------------------------- | 78 # runtime_library ------------------------------------------------------------- |
57 # | 79 # |
58 # Sets the runtime library and associated options. | 80 # Sets the runtime library and associated options. |
59 # | 81 # |
60 # We don't bother making multiple versions that are toggle-able since there | 82 # We don't bother making multiple versions that are toggle-able since there |
61 # is more than one axis of control (which makes it complicated) and there's | 83 # is more than one axis of control (which makes it complicated) and there's |
62 # no practical reason for anybody to change this since the CRT must agree. | 84 # no practical reason for anybody to change this since the CRT must agree. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 # Toggles between higher and lower warnings for code that is (or isn't) | 129 # Toggles between higher and lower warnings for code that is (or isn't) |
108 # part of Chromium. | 130 # part of Chromium. |
109 | 131 |
110 config("chromium_code") { | 132 config("chromium_code") { |
111 if (is_win) { | 133 if (is_win) { |
112 cflags = [ | 134 cflags = [ |
113 "/W4", # Warning level 4. | 135 "/W4", # Warning level 4. |
114 ] | 136 ] |
115 } else if (is_mac) { | 137 } else if (is_mac) { |
116 cflags = [ | 138 cflags = [ |
| 139 "-Wall", |
117 "-Werror", | 140 "-Werror", |
118 "-Wextra", | 141 "-Wextra", |
119 ] | 142 ] |
120 } | 143 } |
121 } | 144 } |
122 config("no_chromium_code") { | 145 config("no_chromium_code") { |
123 if (is_win) { | 146 if (is_win) { |
124 cflags = [ | 147 cflags = [ |
125 "/W3", # Warning level 3. | 148 "/W3", # Warning level 3. |
126 "/wd4800", # Disable warning when forcing value to bool. | 149 "/wd4800", # Disable warning when forcing value to bool. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 256 |
234 # Clang spots more unused functions. | 257 # Clang spots more unused functions. |
235 "-Wno-unused-function", | 258 "-Wno-unused-function", |
236 | 259 |
237 # Warns when a const char[] is converted to bool. | 260 # Warns when a const char[] is converted to bool. |
238 "-Wstring-conversion", | 261 "-Wstring-conversion", |
239 ] | 262 ] |
240 #} #is_clang | 263 #} #is_clang |
241 } | 264 } |
242 } | 265 } |
OLD | NEW |