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