common.gypi revision 69a99ed0b2b2ef69d393c371b03db3a98aaf880e
1# Copyright 2011 the V8 project authors. All rights reserved.
2# 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# Shared definitions for all V8-related targets.
29
30{
31  'variables': {
32    'use_system_v8%': 0,
33    'msvs_use_common_release': 0,
34    'gcc_version%': 'unknown',
35    'v8_compress_startup_data%': 'off',
36    'v8_target_arch%': '<(target_arch)',
37
38    # Setting 'v8_can_use_unaligned_accesses' to 'true' will allow the code
39    # generated by V8 to do unaligned memory access, and setting it to 'false'
40    # will ensure that the generated code will always do aligned memory
41    # accesses. The default value of 'default' will try to determine the correct
42    # setting. Note that for Intel architectures (ia32 and x64) unaligned memory
43    # access is allowed for all CPUs.
44    'v8_can_use_unaligned_accesses%': 'default',
45
46    # Setting 'v8_can_use_vfp_instructions' to 'true' will enable use of ARM VFP
47    # instructions in the V8 generated code. VFP instructions will be enabled
48    # both for the snapshot and for the ARM target. Leaving the default value
49    # of 'false' will avoid VFP instructions in the snapshot and use CPU feature
50    # probing when running on the target.
51    'v8_can_use_vfp_instructions%': 'false',
52
53    # Setting v8_use_arm_eabi_hardfloat to true will turn on V8 support for ARM
54    # EABI calling convention where double arguments are passed in VFP
55    # registers. Note that the GCC flag '-mfloat-abi=hard' should be used as
56    # well when compiling for the ARM target.
57    'v8_use_arm_eabi_hardfloat%': 'false',
58
59    'v8_enable_debugger_support%': 1,
60
61    'v8_enable_disassembler%': 0,
62
63    'v8_enable_gdbjit%': 0,
64
65    # Enable profiling support. Only required on Windows.
66    'v8_enable_prof%': 0,
67
68    # Chrome needs this definition unconditionally. For standalone V8 builds,
69    # it's handled in build/standalone.gypi.
70    'want_separate_host_toolset%': 1,
71
72    'v8_use_snapshot%': 'true',
73    'host_os%': '<(OS)',
74    'v8_use_liveobjectlist%': 'false',
75  },
76  'target_defaults': {
77    'conditions': [
78      ['v8_enable_debugger_support==1', {
79        'defines': ['ENABLE_DEBUGGER_SUPPORT',],
80      }],
81      ['v8_enable_disassembler==1', {
82        'defines': ['ENABLE_DISASSEMBLER',],
83      }],
84      ['v8_enable_gdbjit==1', {
85        'defines': ['ENABLE_GDB_JIT_INTERFACE',],
86      }],
87      ['OS!="mac"', {
88        # TODO(mark): The OS!="mac" conditional is temporary. It can be
89        # removed once the Mac Chromium build stops setting target_arch to
90        # ia32 and instead sets it to mac. Other checks in this file for
91        # OS=="mac" can be removed at that time as well. This can be cleaned
92        # up once http://crbug.com/44205 is fixed.
93        'conditions': [
94          ['v8_target_arch=="arm"', {
95            'defines': [
96              'V8_TARGET_ARCH_ARM',
97            ],
98            'conditions': [
99              [ 'v8_can_use_unaligned_accesses=="true"', {
100                'defines': [
101                  'CAN_USE_UNALIGNED_ACCESSES=1',
102                ],
103              }],
104              [ 'v8_can_use_unaligned_accesses=="false"', {
105                'defines': [
106                  'CAN_USE_UNALIGNED_ACCESSES=0',
107                ],
108              }],
109              [ 'v8_can_use_vfp_instructions=="true"', {
110                'defines': [
111                  'CAN_USE_VFP_INSTRUCTIONS',
112                ],
113              }],
114              [ 'v8_use_arm_eabi_hardfloat=="true"', {
115                'defines': [
116                  'USE_EABI_HARDFLOAT=1',
117                  'CAN_USE_VFP_INSTRUCTIONS',
118                ],
119                'cflags': [
120                  '-mfloat-abi=hard',
121                ],
122              }, {
123                'defines': [
124                  'USE_EABI_HARDFLOAT=0',
125                ],
126              }],
127              # The ARM assembler assumes the host is 32 bits,
128              # so force building 32-bit host tools.
129              ['host_arch=="x64"', {
130                'target_conditions': [
131                  ['_toolset=="host"', {
132                    'cflags': ['-m32'],
133                    'ldflags': ['-m32'],
134                  }],
135                ],
136              }],
137            ],
138          }],
139          ['v8_target_arch=="ia32"', {
140            'defines': [
141              'V8_TARGET_ARCH_IA32',
142            ],
143          }],
144          ['v8_target_arch=="mips"', {
145            'defines': [
146              'V8_TARGET_ARCH_MIPS',
147            ],
148          }],
149          ['v8_target_arch=="x64"', {
150            'defines': [
151              'V8_TARGET_ARCH_X64',
152            ],
153          }],
154        ],
155      }],
156      ['v8_use_liveobjectlist=="true"', {
157        'defines': [
158          'ENABLE_DEBUGGER_SUPPORT',
159          'INSPECTOR',
160          'OBJECT_PRINT',
161          'LIVEOBJECTLIST',
162        ],
163      }],
164      ['v8_compress_startup_data=="bz2"', {
165        'defines': [
166          'COMPRESS_STARTUP_DATA_BZ2',
167        ],
168      }],
169      ['OS=="win" and v8_enable_prof==1', {
170        'msvs_settings': {
171          'VCLinkerTool': {
172            'GenerateMapFile': 'true',
173          },
174        },
175      }],
176    ],
177    'configurations': {
178      'Debug': {
179        'defines': [
180          'DEBUG',
181          'ENABLE_DISASSEMBLER',
182          'V8_ENABLE_CHECKS',
183          'OBJECT_PRINT',
184        ],
185        'msvs_settings': {
186          'VCCLCompilerTool': {
187            'Optimization': '0',
188
189            'conditions': [
190              ['OS=="win" and component=="shared_library"', {
191                'RuntimeLibrary': '3',  # /MDd
192              }, {
193                'RuntimeLibrary': '1',  # /MTd
194              }],
195            ],
196          },
197          'VCLinkerTool': {
198            'LinkIncremental': '2',
199            # For future reference, the stack size needs to be increased
200            # when building for Windows 64-bit, otherwise some test cases
201            # can cause stack overflow.
202            # 'StackReserveSize': '297152',
203          },
204        },
205        'conditions': [
206          ['OS=="freebsd" or OS=="openbsd"', {
207            'cflags': [ '-I/usr/local/include' ],
208          }],
209          ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
210            'cflags': [ '-Wall', '-Werror', '-W', '-Wno-unused-parameter',
211                        '-Wnon-virtual-dtor' ],
212          }],
213        ],
214      },
215      'Release': {
216        'conditions': [
217          ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
218            'cflags!': [
219              '-O2',
220              '-Os',
221            ],
222            'cflags': [
223              '-fdata-sections',
224              '-ffunction-sections',
225              '-fomit-frame-pointer',
226              '-O3',
227            ],
228            'conditions': [
229              [ 'gcc_version==44', {
230                'cflags': [
231                  # Avoid crashes with gcc 4.4 in the v8 test suite.
232                  '-fno-tree-vrp',
233                ],
234              }],
235            ],
236          }],
237          ['OS=="freebsd" or OS=="openbsd"', {
238            'cflags': [ '-I/usr/local/include' ],
239          }],
240          ['OS=="mac"', {
241            'xcode_settings': {
242              'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
243
244              # -fstrict-aliasing.  Mainline gcc
245              # enables this at -O2 and above,
246              # but Apple gcc does not unless it
247              # is specified explicitly.
248              'GCC_STRICT_ALIASING': 'YES',
249            },
250          }],
251          ['OS=="win"', {
252            'msvs_configuration_attributes': {
253              'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
254              'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
255              'CharacterSet': '1',
256            },
257            'msvs_settings': {
258              'VCCLCompilerTool': {
259                'Optimization': '2',
260                'InlineFunctionExpansion': '2',
261                'EnableIntrinsicFunctions': 'true',
262                'FavorSizeOrSpeed': '0',
263                'OmitFramePointers': 'true',
264                'StringPooling': 'true',
265
266                'conditions': [
267                  ['OS=="win" and component=="shared_library"', {
268                    'RuntimeLibrary': '2',  #/MD
269                  }, {
270                    'RuntimeLibrary': '0',  #/MT
271                  }],
272                ],
273              },
274              'VCLinkerTool': {
275                'LinkIncremental': '1',
276                'OptimizeReferences': '2',
277                'OptimizeForWindows98': '1',
278                'EnableCOMDATFolding': '2',
279                # For future reference, the stack size needs to be
280                # increased when building for Windows 64-bit, otherwise
281                # some test cases can cause stack overflow.
282                # 'StackReserveSize': '297152',
283              },
284            },
285          }],
286        ],
287      },
288    },
289  },
290}
291