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