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