build: unconditionally disable -Werror
[platform/upstream/nodejs.git] / common.gypi
1 {
2   'variables': {
3     'visibility%': 'hidden',         # V8's visibility setting
4     'target_arch%': 'ia32',          # set v8's target architecture
5     'host_arch%': 'ia32',            # set v8's host architecture
6     'want_separate_host_toolset': 0, # V8 should not build target and host
7     'library%': 'static_library',    # allow override to 'shared_library' for DLL/.so builds
8     'component%': 'static_library',  # NB. these names match with what V8 expects
9     'msvs_multi_core_compile': '0',  # we do enable multicore compiles, but not using the V8 way
10     'gcc_version%': 'unknown',
11     'clang%': 0,
12     'python%': 'python',
13
14     # Enable V8's post-mortem debugging only on unix flavors.
15     'conditions': [
16       ['OS == "win"', {
17         'os_posix': 0,
18         'v8_postmortem_support': 'false'
19       }, {
20         'os_posix': 1,
21         'v8_postmortem_support': 'true'
22       }]
23     ],
24   },
25
26   'target_defaults': {
27     'default_configuration': 'Release',
28     'configurations': {
29       'Debug': {
30         'defines': [ 'DEBUG', '_DEBUG' ],
31         'cflags': [ '-g', '-O0' ],
32         'conditions': [
33           ['target_arch=="x64"', {
34             'msvs_configuration_platform': 'x64',
35           }],
36         ],
37         'msvs_settings': {
38           'VCCLCompilerTool': {
39             'RuntimeLibrary': 1, # static debug
40             'Optimization': 0, # /Od, no optimization
41             'MinimalRebuild': 'false',
42             'OmitFramePointers': 'false',
43             'BasicRuntimeChecks': 3, # /RTC1
44           },
45           'VCLinkerTool': {
46             'LinkIncremental': 2, # enable incremental linking
47           },
48         },
49         'xcode_settings': {
50           'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
51         },
52       },
53       'Release': {
54         'cflags': [ '-O3', '-ffunction-sections', '-fdata-sections' ],
55         'conditions': [
56           ['target_arch=="x64"', {
57             'msvs_configuration_platform': 'x64',
58           }],
59           ['OS=="solaris"', {
60             # pull in V8's postmortem metadata
61             'ldflags': [ '-Wl,-z,allextract' ]
62           }, {
63             # Doesn't work with the Solaris linker.
64             'ldflags': [ '-Wl,--gc-sections' ],
65           }],
66           ['clang == 0 and gcc_version >= 40', {
67             'cflags': [ '-fno-tree-vrp' ],  # Work around compiler bug.
68           }],
69           ['clang == 0 and gcc_version <= 44', {
70             'cflags': [ '-fno-tree-sink' ],  # Work around compiler bug.
71           }],
72           ['OS!="mac" and OS!="win"', {
73             'cflags': [ '-fno-omit-frame-pointer' ],
74           }],
75         ],
76         'msvs_settings': {
77           'VCCLCompilerTool': {
78             'RuntimeLibrary': 0, # static release
79             'Optimization': 3, # /Ox, full optimization
80             'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
81             'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
82             'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
83             'OmitFramePointers': 'true',
84             'EnableFunctionLevelLinking': 'true',
85             'EnableIntrinsicFunctions': 'true',
86             'RuntimeTypeInfo': 'false',
87             'ExceptionHandling': '0',
88             'AdditionalOptions': [
89               '/MP', # compile across multiple CPUs
90             ],
91           },
92           'VCLibrarianTool': {
93             'AdditionalOptions': [
94               '/LTCG', # link time code generation
95             ],
96           },
97           'VCLinkerTool': {
98             'LinkTimeCodeGeneration': 1, # link-time code generation
99             'OptimizeReferences': 2, # /OPT:REF
100             'EnableCOMDATFolding': 2, # /OPT:ICF
101             'LinkIncremental': 1, # disable incremental linking
102           },
103         },
104       }
105     },
106     # Forcibly disable -Werror.  We support a wide range of compilers, it's
107     # simply not feasible to squelch all warnings, never mind that the
108     # libraries in deps/ are not under our control.
109     'cflags!': ['-Werror'],
110     'msvs_settings': {
111       'VCCLCompilerTool': {
112         'StringPooling': 'true', # pool string literals
113         'DebugInformationFormat': 3, # Generate a PDB
114         'WarningLevel': 3,
115         'BufferSecurityCheck': 'true',
116         'ExceptionHandling': 1, # /EHsc
117         'SuppressStartupBanner': 'true',
118         'WarnAsError': 'false',
119       },
120       'VCLibrarianTool': {
121       },
122       'VCLinkerTool': {
123         'conditions': [
124           ['target_arch=="x64"', {
125             'TargetMachine' : 17 # /MACHINE:X64
126           }],
127         ],
128         'GenerateDebugInformation': 'true',
129         'RandomizedBaseAddress': 2, # enable ASLR
130         'DataExecutionPrevention': 2, # enable DEP
131         'AllowIsolation': 'true',
132         'SuppressStartupBanner': 'true',
133         'target_conditions': [
134           ['_type=="executable"', {
135             'SubSystem': 1, # console executable
136           }],
137         ],
138       },
139     },
140     'msvs_disabled_warnings': [4351, 4355, 4800],
141     'conditions': [
142       ['OS == "win"', {
143         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
144         'defines': [
145           'WIN32',
146           # we don't really want VC++ warning us about
147           # how dangerous C functions are...
148           '_CRT_SECURE_NO_DEPRECATE',
149           # ... or that C implementations shouldn't use
150           # POSIX names
151           '_CRT_NONSTDC_NO_DEPRECATE',
152           'BUILDING_V8_SHARED=1',
153           'BUILDING_UV_SHARED=1',
154         ],
155       }],
156       [ 'OS in "linux freebsd openbsd solaris"', {
157         'cflags': [ '-pthread', ],
158         'ldflags': [ '-pthread' ],
159       }],
160       [ 'OS in "linux freebsd openbsd solaris android"', {
161         'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
162         'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
163         'ldflags': [ '-rdynamic' ],
164         'target_conditions': [
165           ['_type=="static_library"', {
166             'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
167           }],
168         ],
169         'conditions': [
170           [ 'target_arch=="ia32"', {
171             'cflags': [ '-m32' ],
172             'ldflags': [ '-m32' ],
173           }],
174           [ 'target_arch=="x64"', {
175             'cflags': [ '-m64' ],
176             'ldflags': [ '-m64' ],
177           }],
178           [ 'OS=="solaris"', {
179             'cflags': [ '-pthreads' ],
180             'ldflags': [ '-pthreads' ],
181             'cflags!': [ '-pthread' ],
182             'ldflags!': [ '-pthread' ],
183           }],
184         ],
185       }],
186       [ 'OS=="android"', {
187         'defines': ['_GLIBCXX_USE_C99_MATH'],
188         'libraries': [ '-llog' ],
189       }],
190       ['OS=="mac"', {
191         'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
192         'xcode_settings': {
193           'ALWAYS_SEARCH_USER_PATHS': 'NO',
194           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
195           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
196                                                     # (Equivalent to -fPIC)
197           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
198           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
199           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
200           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
201           'PREBINDING': 'NO',                       # No -Wl,-prebind
202           'MACOSX_DEPLOYMENT_TARGET': '10.5',       # -mmacosx-version-min=10.5
203           'USE_HEADERMAP': 'NO',
204           'OTHER_CFLAGS': [
205             '-fno-strict-aliasing',
206           ],
207           'WARNING_CFLAGS': [
208             '-Wall',
209             '-Wendif-labels',
210             '-W',
211             '-Wno-unused-parameter',
212           ],
213         },
214         'target_conditions': [
215           ['_type!="static_library"', {
216             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
217           }],
218         ],
219         'conditions': [
220           ['target_arch=="ia32"', {
221             'xcode_settings': {'ARCHS': ['i386']},
222           }],
223           ['target_arch=="x64"', {
224             'xcode_settings': {'ARCHS': ['x86_64']},
225           }],
226         ],
227       }],
228       ['OS=="freebsd" and node_use_dtrace=="true"', {
229         'libraries': [ '-lelf' ],
230       }]
231     ],
232   }
233 }