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