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