blob: ee91e78899f0b9d726e10c978d89be49fdb98c88 [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001# Copyright 2012 the V8 project authors. All rights reserved.
Ben Murdoch69a99ed2011-11-30 16:03:39 +00002# Redistribution and use in source and binary forms, with or without
3# modification, are permitted provided that the following conditions are
4# met:
5#
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above
9# copyright notice, this list of conditions and the following
10# disclaimer in the documentation and/or other materials provided
11# with the distribution.
12# * Neither the name of Google Inc. nor the names of its
13# contributors may be used to endorse or promote products derived
14# from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28# Definitions to be used when building stand-alone V8 binaries.
29
30{
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031 # We need to include toolchain.gypi here for third-party sources that don't
32 # directly include it themselves.
33 'includes': ['toolchain.gypi'],
Ben Murdoch69a99ed2011-11-30 16:03:39 +000034 'variables': {
Ben Murdoch69a99ed2011-11-30 16:03:39 +000035 'component%': 'static_library',
Emily Bernierd0a1eb72015-03-24 16:35:39 -040036 'make_clang_dir%': '../third_party/llvm-build/Release+Asserts',
37 'clang_xcode%': 0,
Ben Murdochb8a8cc12014-11-26 15:28:44 +000038 'asan%': 0,
39 'tsan%': 0,
Ben Murdoch69a99ed2011-11-30 16:03:39 +000040 'visibility%': 'hidden',
Ben Murdochb8a8cc12014-11-26 15:28:44 +000041 'v8_enable_backtrace%': 0,
42 'v8_enable_i18n_support%': 1,
43 'v8_deprecation_warnings': 1,
Ben Murdoch69a99ed2011-11-30 16:03:39 +000044 'msvs_multi_core_compile%': '1',
Ben Murdochb8a8cc12014-11-26 15:28:44 +000045 'mac_deployment_target%': '10.5',
Ben Murdoch69a99ed2011-11-30 16:03:39 +000046 'variables': {
47 'variables': {
Ben Murdoch3ef787d2012-04-12 10:51:47 +010048 'variables': {
49 'conditions': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +000050 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
51 OS=="netbsd" or OS=="mac" or OS=="qnx"', {
52 # This handles the Unix platforms we generally deal with.
Ben Murdoch3ef787d2012-04-12 10:51:47 +010053 # Anything else gets passed through, which probably won't work
54 # very well; such hosts should pass an explicit target_arch
55 # to gyp.
Ben Murdochb8a8cc12014-11-26 15:28:44 +000056 'host_arch%': '<!pymod_do_main(detect_v8_host_arch)',
Ben Murdoch3ef787d2012-04-12 10:51:47 +010057 }, {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000058 # OS!="linux" and OS!="freebsd" and OS!="openbsd" and
59 # OS!="netbsd" and OS!="mac"
Ben Murdoch3ef787d2012-04-12 10:51:47 +010060 'host_arch%': 'ia32',
61 }],
62 ],
63 },
64 'host_arch%': '<(host_arch)',
65 'target_arch%': '<(host_arch)',
Ben Murdoch69a99ed2011-11-30 16:03:39 +000066 },
67 'host_arch%': '<(host_arch)',
Ben Murdoch3ef787d2012-04-12 10:51:47 +010068 'target_arch%': '<(target_arch)',
Ben Murdoch69a99ed2011-11-30 16:03:39 +000069 'v8_target_arch%': '<(target_arch)',
70 },
71 'host_arch%': '<(host_arch)',
72 'target_arch%': '<(target_arch)',
73 'v8_target_arch%': '<(v8_target_arch)',
Ben Murdoch3ef787d2012-04-12 10:51:47 +010074 'werror%': '-Werror',
Ben Murdochb8a8cc12014-11-26 15:28:44 +000075
76 # .gyp files or targets should set v8_code to 1 if they build V8 specific
77 # code, as opposed to external code. This variable is used to control such
78 # things as the set of warnings to enable, and whether warnings are treated
79 # as errors.
80 'v8_code%': 0,
81
82 # Speeds up Debug builds:
83 # 0 - Compiler optimizations off (debuggable) (default). This may
84 # be 5x slower than Release (or worse).
85 # 1 - Turn on compiler optimizations. This may be hard or impossible to
86 # debug. This may still be 2x slower than Release (or worse).
87 # 2 - Turn on optimizations, and also #undef DEBUG / #define NDEBUG
88 # (but leave V8_ENABLE_CHECKS and most other assertions enabled.
89 # This may cause some v8 tests to fail in the Debug configuration.
90 # This roughly matches the performance of a Release build and can
91 # be used by embedders that need to build their own code as debug
92 # but don't want or need a debug version of V8. This should produce
93 # near-release speeds.
94 'v8_optimized_debug%': 0,
95
Emily Bernierd0a1eb72015-03-24 16:35:39 -040096 # Use external files for startup data blobs:
97 # the JS builtins sources and the start snapshot.
98 # Embedders that don't use standalone.gypi will need to add
99 # their own default value.
100 'v8_use_external_startup_data%': 0,
101
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000102 # Relative path to icu.gyp from this file.
103 'icu_gyp_path': '../third_party/icu/icu.gyp',
104
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000105 'conditions': [
106 ['(v8_target_arch=="arm" and host_arch!="arm") or \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000107 (v8_target_arch=="arm64" and host_arch!="arm64") or \
108 (v8_target_arch=="mipsel" and host_arch!="mipsel") or \
109 (v8_target_arch=="mips64el" and host_arch!="mips64el") or \
110 (v8_target_arch=="x64" and host_arch!="x64") or \
111 (OS=="android" or OS=="qnx")', {
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000112 'want_separate_host_toolset': 1,
113 }, {
114 'want_separate_host_toolset': 0,
115 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000116 ['OS == "win"', {
117 'os_posix%': 0,
118 }, {
119 'os_posix%': 1,
120 }],
121 ['(v8_target_arch=="ia32" or v8_target_arch=="x64" or v8_target_arch=="x87") and \
122 (OS=="linux" or OS=="mac")', {
123 'v8_enable_gdbjit%': 1,
124 }, {
125 'v8_enable_gdbjit%': 0,
126 }],
127 ['OS=="mac"', {
128 'clang%': 1,
129 }, {
130 'clang%': 0,
131 }],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000132 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000133 # Default ARM variable settings.
134 'arm_version%': 'default',
135 'arm_fpu%': 'vfpv3',
136 'arm_float_abi%': 'default',
137 'arm_thumb': 'default',
Paul Lind18a7ebb2014-12-17 22:29:32 -0800138
139 # Default MIPS variable settings.
140 'mips_arch_variant%': 'r2',
141 # Possible values fp32, fp64, fpxx.
142 # fp32 - 32 32-bit FPU registers are available, doubles are placed in
143 # register pairs.
144 # fp64 - 32 64-bit FPU registers are available.
145 # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime
146 # detection
147 'mips_fpu_mode%': 'fp32',
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000148 },
149 'target_defaults': {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000150 'variables': {
151 'v8_code%': '<(v8_code)',
152 },
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000153 'default_configuration': 'Debug',
154 'configurations': {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000155 'DebugBaseCommon': {
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000156 'cflags': [ '-g', '-O0' ],
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400157 'conditions': [
158 ['(v8_target_arch=="ia32" or v8_target_arch=="x87") and \
159 OS=="linux"', {
160 'defines': [
161 '_GLIBCXX_DEBUG'
162 ],
163 }],
164 ],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000165 },
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000166 'Optdebug': {
167 'inherit_from': [ 'DebugBaseCommon', 'DebugBase2' ],
168 },
169 'Debug': {
170 # Xcode insists on this empty entry.
171 },
172 'Release': {
173 # Xcode insists on this empty entry.
174 },
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000175 },
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000176 'target_conditions': [
177 ['v8_code == 0', {
178 'defines!': [
179 'DEBUG',
180 ],
181 'conditions': [
182 ['os_posix == 1 and OS != "mac"', {
183 'cflags!': [
184 '-Werror',
185 ],
186 }],
187 ['OS == "mac"', {
188 'xcode_settings': {
189 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror
190 },
191 }],
192 ['OS == "win"', {
193 'msvs_settings': {
194 'VCCLCompilerTool': {
195 'WarnAsError': 'false',
196 },
197 },
198 }],
199 ],
200 }],
201 ],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000202 },
203 'conditions': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000204 ['asan==1', {
205 'target_defaults': {
206 'cflags_cc+': [
207 '-fno-omit-frame-pointer',
208 '-gline-tables-only',
209 '-fsanitize=address',
210 '-w', # http://crbug.com/162783
211 ],
212 'cflags_cc!': [
213 '-fomit-frame-pointer',
214 ],
215 'ldflags': [
216 '-fsanitize=address',
217 ],
218 },
219 }],
220 ['tsan==1', {
221 'target_defaults': {
222 'cflags+': [
223 '-fno-omit-frame-pointer',
224 '-gline-tables-only',
225 '-fsanitize=thread',
226 '-fPIC',
227 '-Wno-c++11-extensions',
228 ],
229 'cflags!': [
230 '-fomit-frame-pointer',
231 ],
232 'ldflags': [
233 '-fsanitize=thread',
234 '-pie',
235 ],
236 'defines': [
237 'THREAD_SANITIZER',
238 ],
239 },
240 }],
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100241 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
242 or OS=="netbsd"', {
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000243 'target_defaults': {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000244 'cflags': [
245 '-Wall',
246 '<(werror)',
247 '-W',
248 '-Wno-unused-parameter',
249 '-Wno-long-long',
250 '-pthread',
251 '-fno-exceptions',
252 '-pedantic',
253 # Don't warn about the "struct foo f = {0};" initialization pattern.
254 '-Wno-missing-field-initializers',
255 ],
256 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000257 'ldflags': [ '-pthread', ],
258 'conditions': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000259 [ 'visibility=="hidden" and v8_enable_backtrace==0', {
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000260 'cflags': [ '-fvisibility=hidden' ],
261 }],
262 [ 'component=="shared_library"', {
263 'cflags': [ '-fPIC', ],
264 }],
265 ],
266 },
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100267 }],
268 # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
269 # or OS=="netbsd"'
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000270 ['OS=="qnx"', {
271 'target_defaults': {
272 'cflags': [
273 '-Wall',
274 '<(werror)',
275 '-W',
276 '-Wno-unused-parameter',
277 '-fno-exceptions',
278 # Don't warn about the "struct foo f = {0};" initialization pattern.
279 '-Wno-missing-field-initializers',
280 ],
281 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
282 'conditions': [
283 [ 'visibility=="hidden"', {
284 'cflags': [ '-fvisibility=hidden' ],
285 }],
286 [ 'component=="shared_library"', {
287 'cflags': [ '-fPIC' ],
288 }],
289 ],
290 'target_conditions': [
291 [ '_toolset=="host" and host_os=="linux"', {
292 'cflags': [ '-pthread' ],
293 'ldflags': [ '-pthread' ],
294 'libraries': [ '-lrt' ],
295 }],
296 [ '_toolset=="target"', {
297 'cflags': [ '-Wno-psabi' ],
298 'libraries': [ '-lbacktrace', '-lsocket', '-lm' ],
299 }],
300 ],
301 },
302 }], # OS=="qnx"
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000303 ['OS=="win"', {
304 'target_defaults': {
305 'defines': [
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000306 '_CRT_SECURE_NO_DEPRECATE',
307 '_CRT_NONSTDC_NO_DEPRECATE',
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000308 '_USING_V110_SDK71_',
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000309 ],
310 'conditions': [
311 ['component=="static_library"', {
312 'defines': [
313 '_HAS_EXCEPTIONS=0',
314 ],
315 }],
316 ],
317 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
318 'msvs_disabled_warnings': [4355, 4800],
319 'msvs_settings': {
320 'VCCLCompilerTool': {
321 'MinimalRebuild': 'false',
322 'BufferSecurityCheck': 'true',
323 'EnableFunctionLevelLinking': 'true',
324 'RuntimeTypeInfo': 'false',
325 'WarningLevel': '3',
326 'WarnAsError': 'true',
327 'DebugInformationFormat': '3',
328 'Detect64BitPortabilityProblems': 'false',
329 'conditions': [
330 [ 'msvs_multi_core_compile', {
331 'AdditionalOptions': ['/MP'],
332 }],
333 ['component=="shared_library"', {
334 'ExceptionHandling': '1', # /EHsc
335 }, {
336 'ExceptionHandling': '0',
337 }],
338 ],
339 },
340 'VCLibrarianTool': {
341 'AdditionalOptions': ['/ignore:4221'],
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400342 'conditions': [
343 ['v8_target_arch=="x64"', {
344 'TargetMachine': '17', # x64
345 }, {
346 'TargetMachine': '1', # ia32
347 }],
348 ],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000349 },
350 'VCLinkerTool': {
351 'AdditionalDependencies': [
352 'ws2_32.lib',
353 ],
354 'GenerateDebugInformation': 'true',
355 'MapFileName': '$(OutDir)\\$(TargetName).map',
356 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
357 'FixedBaseAddress': '1',
358 # LinkIncremental values:
359 # 0 == default
360 # 1 == /INCREMENTAL:NO
361 # 2 == /INCREMENTAL
362 'LinkIncremental': '1',
363 # SubSystem values:
364 # 0 == not set
365 # 1 == /SUBSYSTEM:CONSOLE
366 # 2 == /SUBSYSTEM:WINDOWS
367 'SubSystem': '1',
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000368
369 'conditions': [
370 ['v8_enable_i18n_support==1', {
371 'AdditionalDependencies': [
372 'advapi32.lib',
373 ],
374 }],
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400375 ['v8_target_arch=="x64"', {
376 'MinimumRequiredVersion': '5.02', # Server 2003.
377 'TargetMachine': '17', # x64
378 }, {
379 'MinimumRequiredVersion': '5.01', # XP.
380 'TargetMachine': '1', # ia32
381 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000382 ],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000383 },
384 },
385 },
386 }], # OS=="win"
387 ['OS=="mac"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000388 'xcode_settings': {
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400389 'SDKROOT': 'macosx',
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000390 'SYMROOT': '<(DEPTH)/xcodebuild',
391 },
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000392 'target_defaults': {
393 'xcode_settings': {
394 'ALWAYS_SEARCH_USER_PATHS': 'NO',
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000395 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000396 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
397 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
398 # (Equivalent to -fPIC)
399 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
400 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
401 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
402 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
403 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
404 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
405 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000406 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor
407 # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
408 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000409 'PREBINDING': 'NO', # No -Wl,-prebind
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000410 'SYMROOT': '<(DEPTH)/xcodebuild',
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000411 'USE_HEADERMAP': 'NO',
412 'OTHER_CFLAGS': [
413 '-fno-strict-aliasing',
414 ],
415 'WARNING_CFLAGS': [
416 '-Wall',
417 '-Wendif-labels',
418 '-W',
419 '-Wno-unused-parameter',
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000420 # Don't warn about the "struct foo f = {0};" initialization pattern.
421 '-Wno-missing-field-initializers',
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000422 ],
423 },
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000424 'conditions': [
425 ['werror==""', {
426 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO'},
427 }, {
428 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES'},
429 }],
430 ['clang==1', {
431 'xcode_settings': {
432 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
433 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x
434 },
435 }],
436 ],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000437 'target_conditions': [
438 ['_type!="static_library"', {
439 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
440 }],
441 ], # target_conditions
442 }, # target_defaults
443 }], # OS=="mac"
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400444 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
445 'and OS!="win"', {
446 'make_global_settings': [
447 ['CC', '<(make_clang_dir)/bin/clang'],
448 ['CXX', '<(make_clang_dir)/bin/clang++'],
449 ['CC.host', '$(CC)'],
450 ['CXX.host', '$(CXX)'],
451 ],
452 }],
453 ['clang==1 and OS=="win"', {
454 'make_global_settings': [
455 # On Windows, gyp's ninja generator only looks at CC.
456 ['CC', '<(make_clang_dir)/bin/clang-cl'],
457 ],
458 }],
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000459 ],
460}