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