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