| 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 import("//build/config/clang/clang.gni") | 5 import("//build/config/clang/clang.gni") |
| 6 import("//build/config/compiler/compiler.gni") | 6 import("//build/config/compiler/compiler.gni") |
| 7 import("//build/config/sanitizers/sanitizers.gni") | 7 import("//build/config/sanitizers/sanitizers.gni") |
| 8 import("//build/config/win/visual_studio_version.gni") | |
| 9 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
| 10 | 9 |
| 11 assert(is_win) | 10 assert(is_win) |
| 12 | 11 |
| 13 declare_args() { | 12 declare_args() { |
| 14 # Set this to true to enable static analysis through Visual Studio's | 13 # Set this to true to enable static analysis through Visual Studio's |
| 15 # /analyze. This dramatically slows compiles and reports thousands of | 14 # /analyze. This dramatically slows compiles and reports thousands of |
| 16 # warnings, so normally this is done on a build machine and only the new | 15 # warnings, so normally this is done on a build machine and only the new |
| 17 # warnings are examined. | 16 # warnings are examined. |
| 18 use_vs_code_analysis = false | 17 use_vs_code_analysis = false |
| (...skipping 22 matching lines...) Expand all Loading... |
| 41 "/FS", # Preserve previous PDB behavior. | 40 "/FS", # Preserve previous PDB behavior. |
| 42 "/bigobj", # Some of our files are bigger than the regular limits. | 41 "/bigobj", # Some of our files are bigger than the regular limits. |
| 43 ] | 42 ] |
| 44 | 43 |
| 45 # Force C/C++ mode for the given GN detected file type. This is necessary | 44 # Force C/C++ mode for the given GN detected file type. This is necessary |
| 46 # for precompiled headers where the same source file is compiled in both | 45 # for precompiled headers where the same source file is compiled in both |
| 47 # modes. | 46 # modes. |
| 48 cflags_c = [ "/TC" ] | 47 cflags_c = [ "/TC" ] |
| 49 cflags_cc = [ "/TP" ] | 48 cflags_cc = [ "/TP" ] |
| 50 | 49 |
| 51 # Flags not supported in version 2013. | 50 cflags += [ |
| 52 if (visual_studio_version != "2013" && visual_studio_version != "2013e") { | 51 # Tell the compiler to crash on failures. This is undocumented |
| 53 cflags += [ | 52 # and unsupported but very handy. |
| 54 # Tell the compiler to crash on failures. This is undocumented | 53 "/d2FastFail", |
| 55 # and unsupported but very handy. | |
| 56 "/d2FastFail", | |
| 57 ] | |
| 58 } | |
| 59 | 54 |
| 60 if (visual_studio_version == "2015") { | 55 # Work around crbug.com/526851, bug in VS 2015 RTM compiler. |
| 61 cflags += [ | 56 "/Zc:sizedDealloc-", |
| 62 # Work around crbug.com/526851, bug in VS 2015 RTM compiler. | |
| 63 "/Zc:sizedDealloc-", | |
| 64 | 57 |
| 65 # Disable thread-safe statics to avoid overhead and because | 58 # Disable thread-safe statics to avoid overhead and because |
| 66 # they are disabled on other platforms. See crbug.com/587210 | 59 # they are disabled on other platforms. See crbug.com/587210 |
| 67 # and -fno-threadsafe-statics. | 60 # and -fno-threadsafe-statics. |
| 68 "/Zc:threadSafeInit-", | 61 "/Zc:threadSafeInit-", |
| 69 ] | 62 ] |
| 70 } | |
| 71 | 63 |
| 72 # Building with Clang on Windows is a work in progress and very | 64 # Building with Clang on Windows is a work in progress and very |
| 73 # experimental. See crbug.com/82385. | 65 # experimental. See crbug.com/82385. |
| 74 # Keep this in sync with the similar block in build/common.gypi | |
| 75 if (is_clang) { | 66 if (is_clang) { |
| 76 if (visual_studio_version == "2013") { | 67 cflags += [ "-fmsc-version=1900" ] |
| 77 cflags += [ "-fmsc-version=1800" ] | |
| 78 } else if (visual_studio_version == "2015") { | |
| 79 cflags += [ "-fmsc-version=1900" ] | |
| 80 } | |
| 81 | 68 |
| 82 if (current_cpu == "x86") { | 69 if (current_cpu == "x86") { |
| 83 cflags += [ "-m32" ] | 70 cflags += [ "-m32" ] |
| 84 } else { | 71 } else { |
| 85 cflags += [ "-m64" ] | 72 cflags += [ "-m64" ] |
| 86 } | 73 } |
| 87 | 74 |
| 88 if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") == | 75 if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") == |
| 89 "True") { | 76 "True") { |
| 90 cflags += [ | 77 cflags += [ |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 405 |
| 419 # Internal stuff -------------------------------------------------------------- | 406 # Internal stuff -------------------------------------------------------------- |
| 420 | 407 |
| 421 # Config used by the MIDL template to disable warnings. | 408 # Config used by the MIDL template to disable warnings. |
| 422 config("midl_warnings") { | 409 config("midl_warnings") { |
| 423 if (is_clang) { | 410 if (is_clang) { |
| 424 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". | 411 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". |
| 425 cflags = [ "-Wno-extra-tokens" ] | 412 cflags = [ "-Wno-extra-tokens" ] |
| 426 } | 413 } |
| 427 } | 414 } |
| OLD | NEW |