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