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