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