1# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5{
6    'includes': [ 'common_defines.gypi', ],
7    'variables':
8    {
9        'angle_build_tests%': '1',
10        'angle_build_samples%': '1',
11        # angle_code is set to 1 for the core ANGLE targets defined in src/build_angle.gyp.
12        # angle_code is set to 0 for test code, sample code, and third party code.
13        # When angle_code is 1, we build with additional warning flags on Mac and Linux.
14        'angle_code%': 0,
15        'release_symbols%': 'true',
16        'gcc_or_clang_warnings':
17        [
18            '-Wall',
19            '-Wchar-subscripts',
20            '-Werror',
21            '-Wextra',
22            '-Wformat=2',
23            '-Winit-self',
24            '-Wno-sign-compare',
25            '-Wno-unused-function',
26            '-Wno-unused-parameter',
27            '-Wno-unknown-pragmas',
28            '-Wpacked',
29            '-Wpointer-arith',
30            '-Wundef',
31            '-Wwrite-strings',
32            '-Wno-reorder',
33            '-Wno-format-nonliteral',
34        ],
35    },
36    'target_defaults':
37    {
38        'default_configuration': 'Debug',
39        'variables':
40        {
41            'warn_as_error%': 1,
42        },
43        'target_conditions':
44        [
45            ['warn_as_error == 1',
46            {
47                'msvs_settings':
48                {
49                    'VCCLCompilerTool':
50                    {
51                        'WarnAsError': 'true',
52                    },
53                },
54            }],
55        ],
56        'configurations':
57        {
58            'Common_Base':
59            {
60                'abstract': 1,
61                'msvs_configuration_attributes':
62                {
63                    'OutputDirectory': '$(SolutionDir)$(ConfigurationName)_$(Platform)',
64                    'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
65                    'CharacterSet': '0',    # ASCII
66                },
67                'msvs_settings':
68                {
69                    'VCCLCompilerTool':
70                    {
71                        'AdditionalOptions': ['/MP'],
72                        'BufferSecurityCheck': 'true',
73                        'DebugInformationFormat': '3',
74                        'ExceptionHandling': '0',
75                        'EnableFunctionLevelLinking': 'true',
76                        'MinimalRebuild': 'false',
77                        'RuntimeTypeInfo': 'true',
78                        'WarningLevel': '4',
79                    },
80                    'VCLinkerTool':
81                    {
82                        'FixedBaseAddress': '1',
83                        'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
84                        'MapFileName': '$(OutDir)\\$(TargetName).map',
85                        # Most of the executables we'll ever create are tests
86                        # and utilities with console output.
87                        'SubSystem': '1',    # /SUBSYSTEM:CONSOLE
88                    },
89                    'VCResourceCompilerTool':
90                    {
91                        'Culture': '1033',
92                    },
93                },
94            },    # Common_Base
95
96            'Debug_Base':
97            {
98                'abstract': 1,
99                'msvs_settings':
100                {
101                    'VCCLCompilerTool':
102                    {
103                        'Optimization': '0',    # /Od
104                        'BasicRuntimeChecks': '3',
105                        'RuntimeLibrary': '1',    # /MTd (debug static)
106                    },
107                    'VCLinkerTool':
108                    {
109                        'GenerateDebugInformation': 'true',
110                        'LinkIncremental': '2',
111                    },
112                },
113                'xcode_settings':
114                {
115                    'COPY_PHASE_STRIP': 'NO',
116                    'GCC_OPTIMIZATION_LEVEL': '0',
117                },
118            },    # Debug_Base
119
120            'Release_Base':
121            {
122                'abstract': 1,
123                'msvs_settings':
124                {
125                    'VCCLCompilerTool':
126                    {
127                        'Optimization': '2',    # /Os
128                        'RuntimeLibrary': '0',    # /MT (static)
129                    },
130                    'VCLinkerTool':
131                    {
132                        'GenerateDebugInformation': '<(release_symbols)',
133                        'LinkIncremental': '1',
134                    },
135                },
136            },    # Release_Base
137
138            'x86_Base':
139            {
140                'abstract': 1,
141                'msvs_configuration_platform': 'Win32',
142                'msvs_settings':
143                {
144                    'VCLinkerTool':
145                    {
146                        'TargetMachine': '1',
147                        'AdditionalLibraryDirectories':
148                        [
149                            '<(windows_sdk_path)/Lib/win8/um/x86',
150                        ],
151                    },
152                    'VCLibrarianTool':
153                    {
154                        'TargetMachine': '1',
155                        'AdditionalLibraryDirectories':
156                        [
157                            '<(windows_sdk_path)/Lib/win8/um/x86',
158                        ],
159                    },
160                },
161            }, # x86_Base
162
163            'x64_Base':
164            {
165                'abstract': 1,
166                'msvs_configuration_platform': 'x64',
167                'msvs_settings':
168                {
169                    'VCLinkerTool':
170                    {
171                        'TargetMachine': '17', # x86 - 64
172                        'AdditionalLibraryDirectories':
173                        [
174                            '<(windows_sdk_path)/Lib/win8/um/x64',
175                        ],
176                    },
177                    'VCLibrarianTool':
178                    {
179                        'AdditionalLibraryDirectories':
180                        [
181                            '<(windows_sdk_path)/Lib/win8/um/x64',
182                        ],
183                    },
184                },
185            },    # x64_Base
186
187            # Concrete configurations
188            'Debug':
189            {
190                'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
191            },
192            'Release':
193            {
194                'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
195            },
196            'conditions':
197            [
198                [ 'OS == "win" and MSVS_VERSION != "2010e"',
199                {
200                    'Debug_x64':
201                    {
202                        'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
203                    },
204                    'Release_x64':
205                    {
206                        'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
207                    },
208                }],
209            ],
210        },    # configurations
211    },    # target_defaults
212    'conditions':
213    [
214        ['OS == "win"',
215        {
216            'target_defaults':
217            {
218                'msvs_cygwin_dirs': ['../third_party/cygwin'],
219            },
220        },
221        { # OS != win
222            'target_defaults':
223            {
224                'cflags': [ '-fPIC' ],
225            },
226        }],
227        ['OS != "win" and OS != "mac"',
228        {
229            'target_defaults':
230            {
231                'cflags':
232                [
233                    '-pthread',
234                    '-fno-exceptions',
235                ],
236                'ldflags':
237                [
238                    '-pthread',
239                ],
240                'configurations':
241                {
242                    'Debug':
243                    {
244                        'variables':
245                        {
246                            'debug_optimize%': '0',
247                        },
248                        'defines':
249                        [
250                            '_DEBUG',
251                        ],
252                        'cflags':
253                        [
254                            '-O>(debug_optimize)',
255                            '-g',
256                        ],
257                    }
258                },
259            },
260        }],
261        ['angle_code==1',
262        {
263            'target_defaults':
264            {
265                'conditions':
266                [
267                    ['OS == "mac"',
268                    {
269                        'xcode_settings':
270                        {
271                            'WARNING_CFLAGS': ['<@(gcc_or_clang_warnings)']
272                        },
273                    }],
274                    ['OS != "win" and OS != "mac"',
275                    {
276                        'cflags': ['<@(gcc_or_clang_warnings)']
277                    }],
278                ]
279            }
280        }],
281    ],
282}
283