# Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
# Use of this source code is governed by a BSD-style license that can be | |
# found in the LICENSE file. | |
# runtime_library ------------------------------------------------------------- | |
# | |
# Sets the runtime library and associated options. | |
# | |
# We don't bother making multiple versions that are toggle-able since there | |
# is more than one axis of control (which makes it complicated) and there's | |
# no practical reason for anybody to change this since the CRT must agree. | |
config("runtime_library") { | |
if (is_component_build) { | |
# Component mode: dynamic CRT. | |
defines = [ "COMPONENT_BUILD" ] | |
if (is_win) { | |
# Since the library is shared, it requires exceptions or will give errors | |
# about things not matching, so keep exceptions on. | |
if (is_debug) { | |
cflags = [ "/MDd" ] | |
} else { | |
cflags = [ "/MD" ] | |
} | |
} | |
} else { | |
# Static CRT. | |
if (is_win) { | |
# We don't use exceptions, and when we link statically we can just get | |
# rid of them entirely. | |
defines = [ "_HAS_EXCEPTIONS=0" ] | |
if (is_debug) { | |
cflags = [ "/MTd" ] | |
} else { | |
cflags = [ "/MT" ] | |
} | |
} | |
} | |
if (is_win) { | |
defines += [ | |
"__STD_C", | |
"__STDC_CONSTANT_MACROS", | |
"__STDC_FORMAT_MACROS", | |
"_CRT_RAND_S", | |
"_CRT_SECURE_NO_DEPRECATE", | |
"_SCL_SECURE_NO_DEPRECATE", | |
"_UNICODE", | |
"UNICODE", | |
] | |
} | |
} | |
# chromium_code --------------------------------------------------------------- | |
# | |
# Toggles between higher and lower warnings for code that is (or isn't) | |
# part of Chromium. | |
config("chromium_code") { | |
if (is_win) { | |
cflags = [ | |
"/W4", # Warning level 4. | |
] | |
} | |
} | |
config("no_chromium_code") { | |
if (is_win) { | |
cflags = [ | |
"/W3", # Warning level 3. | |
"/wd4800", # Disable warning when forcing value to bool. | |
] | |
defines = [ | |
"_CRT_NONSTDC_NO_WARNINGS", | |
"_CRT_NONSTDC_NO_DEPRECATE", | |
] | |
} | |
} | |
# rtti ------------------------------------------------------------------------ | |
# | |
# Allows turning Run-Time Type Identification on or off. | |
config("rtti") { | |
if (is_win) { | |
cflags = [ "/GR" ] | |
} | |
} | |
config("no_rtti") { | |
if (is_win) { | |
cflags = [ "/GR-" ] | |
} | |
} | |
# Warnings --------------------------------------------------------------------- | |
config("disable_annoying_warnings") { | |
if (is_win) { | |
# Please keep ordered and add names if you add more. | |
cflags = [ | |
"/wd4018", # Comparing signed and unsigned values. | |
"/wd4100", # Unreferenced formal function parameter. | |
"/wd4121", # Alignment of a member was sensitive to packing. | |
"/wd4125", # Decimal digit terminates octal escape sequence. | |
"/wd4127", # Conditional expression is constant. | |
"/wd4130", # Logical operation on address of string constant. | |
# TODO(brettw) is this necessary? If so, it should probably be on whoever | |
# is silly enough to be doing this rather than globally. | |
#"/wd4131", # Function uses old-style declarator. | |
"/wd4189", # A variable was declared and initialized but never used. | |
"/wd4201", # Nonstandard extension used: nameless struct/union. | |
"/wd4238", # Nonstandard extension used: class rvalue used as lvalue. | |
"/wd4244", # Conversion: possible loss of data. | |
"/wd4245", # Conversion: signed/unsigned mismatch, | |
"/wd4251", # Class needs to have dll-interface. | |
"/wd4310", # Cast truncates constant value. | |
"/wd4351", # Elements of array will be default initialized. | |
"/wd4355", # 'this' used in base member initializer list. | |
"/wd4396", # Inline friend template thing. | |
"/wd4428", # Universal character name encountered in source. | |
"/wd4481", # Nonstandard extension: override specifier. | |
"/wd4503", # Decorated name length exceeded, name was truncated. | |
"/wd4505", # Unreferenced local function has been removed. | |
"/wd4510", # Default constructor could not be generated. | |
"/wd4512", # Assignment operator could not be generated. | |
"/wd4530", # Exception handler used, but unwind semantics not enabled. | |
"/wd4610", # Class can never be instantiated, constructor required. | |
"/wd4611", # C++ object destruction and 'catch'. | |
"/wd4701", # Potentially uninitialized local variable name used. | |
"/wd4702", # Unreachable code. | |
"/wd4706", # Assignment within conditional expression. | |
"/wd4819", # Character not in the current code page. | |
] | |
} | |
} |