build: compile with -D__DARWIN_64_BIT_INO_T on OS X
[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     'library%': 'static_library',    # allow override to 'shared_library' for DLL/.so builds
7     'component%': 'static_library',  # NB. these names match with what V8 expects
8     'msvs_multi_core_compile': '0',  # we do enable multicore compiles, but not using the V8 way
9   },
10
11   'target_defaults': {
12     'default_configuration': 'Debug',
13     'configurations': {
14       'Debug': {
15         'defines': [ 'DEBUG', '_DEBUG' ],
16         'cflags': [ '-g', '-O0' ],
17         'msvs_settings': {
18           'VCCLCompilerTool': {
19             'target_conditions': [
20               ['library=="static_library"', {
21                 'RuntimeLibrary': 1, # static debug
22               }, {
23                 'RuntimeLibrary': 3, # DLL debug
24               }],
25             ],
26             'Optimization': 0, # /Od, no optimization
27             'MinimalRebuild': 'true',
28             'OmitFramePointers': 'false',
29             'BasicRuntimeChecks': 3, # /RTC1
30           },
31           'VCLinkerTool': {
32             'LinkIncremental': 2, # enable incremental linking
33           },
34         },
35       },
36       'Release': {
37         'defines': [ 'NDEBUG' ],
38         'cflags': [ '-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections' ],
39         'msvs_settings': {
40           'VCCLCompilerTool': {
41             'target_conditions': [
42               ['library=="static_library"', {
43                 'RuntimeLibrary': 0, # static release
44               }, {
45                 'RuntimeLibrary': 2, # debug release
46               }],
47             ],
48             'Optimization': 3, # /Ox, full optimization
49             'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
50             'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
51             'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
52             'OmitFramePointers': 'true',
53             'EnableFunctionLevelLinking': 'true',
54             'EnableIntrinsicFunctions': 'true',
55             'AdditionalOptions': [
56               '/MP', # compile across multiple CPUs
57             ],
58           },
59           'VCLibrarianTool': {
60             'AdditionalOptions': [
61               '/LTCG', # link time code generation
62             ],
63           },
64           'VCLinkerTool': {
65             'LinkTimeCodeGeneration': 1, # link-time code generation
66             'OptimizeReferences': 2, # /OPT:REF
67             'EnableCOMDATFolding': 2, # /OPT:ICF
68             'LinkIncremental': 1, # disable incremental linking
69           },
70         },
71       }
72     },
73     'msvs_settings': {
74       'VCCLCompilerTool': {
75         'StringPooling': 'true', # pool string literals
76         'DebugInformationFormat': 3, # Generate a PDB
77         'WarningLevel': 3,
78         'BufferSecurityCheck': 'true',
79         'ExceptionHandling': 1, # /EHsc
80         'SuppressStartupBanner': 'true',
81         'WarnAsError': 'false',
82       },
83       'VCLibrarianTool': {
84       },
85       'VCLinkerTool': {
86         'GenerateDebugInformation': 'true',
87         'RandomizedBaseAddress': 2, # enable ASLR
88         'DataExecutionPrevention': 2, # enable DEP
89         'AllowIsolation': 'true',
90         'SuppressStartupBanner': 'true',
91         'target_conditions': [
92           ['_type=="executable"', {
93             'SubSystem': 1, # console executable
94           }],
95         ],
96       },
97     },
98     'conditions': [
99       ['OS == "win"', {
100         'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
101         'defines': [
102           'WIN32',
103           # we don't really want VC++ warning us about
104           # how dangerous C functions are...
105           '_CRT_SECURE_NO_DEPRECATE',
106           # ... or that C implementations shouldn't use
107           # POSIX names
108           '_CRT_NONSTDC_NO_DEPRECATE',
109           'BUILDING_V8_SHARED=1',
110           'BUILDING_UV_SHARED=1',
111         ],
112       }],
113       [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
114         'cflags': [ '-Wall', '-pthread', ],
115         'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
116         'ldflags': [ '-pthread', ],
117         'conditions': [
118           [ 'target_arch=="ia32"', {
119             'cflags': [ '-m32' ],
120             'ldflags': [ '-m32' ],
121           }],
122           [ 'OS=="linux"', {
123             'cflags': [ '-ansi' ],
124           }],
125           [ 'visibility=="hidden"', {
126             'cflags': [ '-fvisibility=hidden' ],
127           }],
128         ],
129       }],
130       ['OS=="mac"', {
131         'defines': ['__DARWIN_64_BIT_INO_T=1'],
132         'xcode_settings': {
133           'ALWAYS_SEARCH_USER_PATHS': 'NO',
134           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
135           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
136                                                     # (Equivalent to -fPIC)
137           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
138           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
139           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
140           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
141           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
142           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
143           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
144           'GCC_VERSION': '4.2',
145           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
146           'MACOSX_DEPLOYMENT_TARGET': '10.4',       # -mmacosx-version-min=10.4
147           'PREBINDING': 'NO',                       # No -Wl,-prebind
148           'USE_HEADERMAP': 'NO',
149           'OTHER_CFLAGS': [
150             '-fno-strict-aliasing',
151           ],
152           'WARNING_CFLAGS': [
153             '-Wall',
154             '-Wendif-labels',
155             '-W',
156             '-Wno-unused-parameter',
157           ],
158         },
159         'target_conditions': [
160           ['_type!="static_library"', {
161             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
162           }],
163         ],
164       }],
165     ],
166   }
167 }