diff --git a/build/common.gypi b/build/common.gypi index a2b7835d0..541e914e4 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -5,6 +5,26 @@ { 'variables': { 'component%': 'static_library', + # angle_code is set to 1 for the core ANGLE targets defined in src/build_angle.gyp. + # angle_code is set to 0 for test code, sample code, and third party code. + # When angle_code is 1, we build with additional warning flags on Mac and Linux. + 'angle_code%': 0, + 'gcc_or_clang_warnings': [ + '-Wall', + '-Wchar-subscripts', + '-Werror', + '-Wextra', + '-Wformat=2', + '-Winit-self', + '-Wno-sign-compare', + '-Wno-unused-function', + '-Wno-unused-parameter', + '-Wno-unknown-pragmas', + '-Wpacked', + '-Wpointer-arith', + '-Wundef', + '-Wwrite-strings', + ], }, 'target_defaults': { 'default_configuration': 'Debug', @@ -130,6 +150,20 @@ }, }, }], + ['angle_code==1', { + 'target_defaults': { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)'] + }, + }], + ['OS!="win" and OS!="mac"', { + 'cflags': ['<@(gcc_or_clang_warnings)'] + }], + ] + } + }], ], } diff --git a/src/build_angle.gyp b/src/build_angle.gyp index d88a4d203..fcf4eb31d 100644 --- a/src/build_angle.gyp +++ b/src/build_angle.gyp @@ -3,6 +3,9 @@ # found in the LICENSE file. { + 'variables': { + 'angle_code': 1, + }, 'target_defaults': { 'defines': [ 'ANGLE_DISABLE_TRACE',