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

Side by Side Diff: build/config/win/BUILD.gn

Issue 1368263002: Separate out compiler and runtime configs on Windows and Android GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import("//build/config/compiler/compiler.gni") 5 import("//build/config/compiler/compiler.gni")
6 import("//build/config/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/win/visual_studio_version.gni") 7 import("//build/config/win/visual_studio_version.gni")
8 8
9 assert(is_win)
10
11 # This is included by reference in the //build/config/compiler config that
12 # is applied to all targets. It is here to separate out the logic that is
13 # Windows-only.
14 config("compiler") {
15 cflags = [
16 "/Gy", # Enable function-level linking.
17 "/GS", # Enable buffer security checking.
18 "/FS", # Preserve previous PDB behavior.
19 "/bigobj", # Some of our files are bigger than the regular limits.
20 ]
21
22 # Force C/C++ mode for the given GN detected file type. This is necessary
23 # for precompiled headers where the same source file is compiled in both
24 # modes.
25 cflags_c = [ "/TC" ]
26 cflags_cc = [ "/TP" ]
27
28 # Work around crbug.com/526851, bug in VS 2015 RTM compiler.
29 if (visual_studio_version == "2015") {
30 cflags += [ "/Zc:sizedDealloc-" ]
31 }
32
33 # Building with Clang on Windows is a work in progress and very
34 # experimental. See crbug.com/82385.
35 # Keep this in sync with the similar block in build/common.gypi
36 if (is_clang) {
37 cflags += [
38 # Many files use intrinsics without including this header.
39 # TODO(hans): Fix those files, or move this to sub-GYPs.
40 "/FIIntrin.h",
41 ]
42
43 if (visual_studio_version == "2013") {
44 cflags += [ "-fmsc-version=1800" ]
45 } else if (visual_studio_version == "2015") {
46 cflags += [ "-fmsc-version=1900" ]
47 }
48
49 if (current_cpu == "x86") {
50 cflags += [ "-m32" ]
51 } else {
52 cflags += [ "-m64" ]
53 }
54
55 if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
56 "True") {
57 cflags += [
58 # cmd.exe doesn't understand ANSI escape codes by default,
59 # so only enable them if something emulating them is around.
60 "-fansi-escape-codes",
61 ]
62 }
63 }
64
65 if (is_syzyasan) {
66 # SyzyAsan needs /PROFILE turned on to produce appropriate pdbs.
67 assert(!is_win_fastlink, "/PROFILE and /DEBUG:FASTLINK are incompatible")
68 ldflags = [ "/PROFILE" ]
69 }
70 }
71
72 # This is included by reference in the //build/config/compiler:runtime_library
73 # config that is applied to all targets. It is here to separate out the logic
74 # that is Windows-only. Please see that target for advice on what should go in
75 # :runtime_library vs. :compiler.
76 config("runtime_library") {
77 cflags = []
78
79 defines = [
80 "__STD_C",
81 "_CRT_RAND_S",
82 "_CRT_SECURE_NO_DEPRECATE",
83 "_HAS_EXCEPTIONS=0",
84 "_SCL_SECURE_NO_DEPRECATE",
85 ]
86
87 if (is_component_build) {
88 # Component mode: dynamic CRT. Since the library is shared, it requires
89 # exceptions or will give errors about things not matching, so keep
90 # exceptions on.
91 if (is_debug) {
92 cflags += [ "/MDd" ]
93 } else {
94 cflags += [ "/MD" ]
95 }
96 } else {
97 if (current_os != "win") {
98 # WindowsRT: use the dynamic CRT.
99 if (is_debug) {
100 cflags += [ "/MDd" ]
101 } else {
102 cflags += [ "/MD" ]
103 }
104 } else {
105 # Desktop Windows: static CRT.
106 if (is_debug) {
107 cflags += [ "/MTd" ]
108 } else {
109 cflags += [ "/MT" ]
110 }
111 }
112 }
113 }
114
9 # Compiler setup for the Windows SDK. Applied to all targets. 115 # Compiler setup for the Windows SDK. Applied to all targets.
10 config("sdk") { 116 config("sdk") {
11 # The include path is the stuff returned by the script. 117 # The include path is the stuff returned by the script.
12 #include_dirs = msvc_config[0] TODO(brettw) make this work. 118 #include_dirs = msvc_config[0] TODO(brettw) make this work.
13 119
14 defines = [ 120 defines = [
15 "_ATL_NO_OPENGL", 121 "_ATL_NO_OPENGL",
16 "_WINDOWS", 122 "_WINDOWS",
17 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS", 123 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
18 "NTDDI_VERSION=0x06030000", 124 "NTDDI_VERSION=0x06030000",
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 305
200 # Internal stuff -------------------------------------------------------------- 306 # Internal stuff --------------------------------------------------------------
201 307
202 # Config used by the MIDL template to disable warnings. 308 # Config used by the MIDL template to disable warnings.
203 config("midl_warnings") { 309 config("midl_warnings") {
204 if (is_clang) { 310 if (is_clang) {
205 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". 311 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_".
206 cflags = [ "-Wno-extra-tokens" ] 312 cflags = [ "-Wno-extra-tokens" ]
207 } 313 }
208 } 314 }
OLDNEW
« no previous file with comments | « build/config/compiler/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698