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

Side by Side Diff: tools/gn/secondary/build/config/compiler/BUILD.gn

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

Powered by Google App Engine
This is Rietveld 408576698