• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2012 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# Definitions to be used when building stand-alone V8 binaries.
29
30{
31  'variables': {
32    'library%': 'static_library',
33    'component%': 'static_library',
34    'visibility%': 'hidden',
35    'msvs_multi_core_compile%': '1',
36    'variables': {
37      'variables': {
38        'variables': {
39          'conditions': [
40            ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
41              # This handles the Linux platforms we generally deal with.
42              # Anything else gets passed through, which probably won't work
43              # very well; such hosts should pass an explicit target_arch
44              # to gyp.
45              'host_arch%':
46                '<!(uname -m | sed -e "s/i.86/ia32/;\
47                  s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mips/")',
48            }, {
49              # OS!="linux" and OS!="freebsd" and OS!="openbsd" and OS!="netbsd"
50              'host_arch%': 'ia32',
51            }],
52          ],
53        },
54        'host_arch%': '<(host_arch)',
55        'target_arch%': '<(host_arch)',
56      },
57      'host_arch%': '<(host_arch)',
58      'target_arch%': '<(target_arch)',
59      'v8_target_arch%': '<(target_arch)',
60    },
61    'host_arch%': '<(host_arch)',
62    'target_arch%': '<(target_arch)',
63    'v8_target_arch%': '<(v8_target_arch)',
64    'werror%': '-Werror',
65    'conditions': [
66      ['(v8_target_arch=="arm" and host_arch!="arm") or \
67        (v8_target_arch=="mips" and host_arch!="mips") or \
68        (v8_target_arch=="x64" and host_arch!="x64")', {
69        'want_separate_host_toolset': 1,
70      }, {
71        'want_separate_host_toolset': 0,
72      }],
73    ],
74  },
75  'target_defaults': {
76    'default_configuration': 'Debug',
77    'configurations': {
78      'Debug': {
79        'cflags': [ '-g', '-O0' ],
80      },
81    },
82  },
83  'conditions': [
84    ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
85       or OS=="netbsd"', {
86      'target_defaults': {
87        'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
88                    '-Wnon-virtual-dtor', '-pthread', '-fno-rtti',
89                    '-fno-exceptions', '-pedantic' ],
90        'ldflags': [ '-pthread', ],
91        'conditions': [
92          [ 'OS=="linux"', {
93            'cflags': [ '-ansi' ],
94          }],
95          [ 'visibility=="hidden"', {
96            'cflags': [ '-fvisibility=hidden' ],
97          }],
98          [ 'component=="shared_library"', {
99            'cflags': [ '-fPIC', ],
100          }],
101        ],
102      },
103    }],
104    # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
105    #  or OS=="netbsd"'
106    ['OS=="win"', {
107      'target_defaults': {
108        'defines': [
109          '_CRT_SECURE_NO_DEPRECATE',
110          '_CRT_NONSTDC_NO_DEPRECATE',
111        ],
112        'conditions': [
113          ['component=="static_library"', {
114            'defines': [
115              '_HAS_EXCEPTIONS=0',
116            ],
117          }],
118        ],
119        'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
120        'msvs_disabled_warnings': [4355, 4800],
121        'msvs_settings': {
122          'VCCLCompilerTool': {
123            'MinimalRebuild': 'false',
124            'BufferSecurityCheck': 'true',
125            'EnableFunctionLevelLinking': 'true',
126            'RuntimeTypeInfo': 'false',
127            'WarningLevel': '3',
128            'WarnAsError': 'true',
129            'DebugInformationFormat': '3',
130            'Detect64BitPortabilityProblems': 'false',
131            'conditions': [
132              [ 'msvs_multi_core_compile', {
133                'AdditionalOptions': ['/MP'],
134              }],
135              ['component=="shared_library"', {
136                'ExceptionHandling': '1',  # /EHsc
137              }, {
138                'ExceptionHandling': '0',
139              }],
140            ],
141          },
142          'VCLibrarianTool': {
143            'AdditionalOptions': ['/ignore:4221'],
144          },
145          'VCLinkerTool': {
146            'AdditionalDependencies': [
147              'ws2_32.lib',
148            ],
149            'GenerateDebugInformation': 'true',
150            'MapFileName': '$(OutDir)\\$(TargetName).map',
151            'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
152            'FixedBaseAddress': '1',
153            # LinkIncremental values:
154            #   0 == default
155            #   1 == /INCREMENTAL:NO
156            #   2 == /INCREMENTAL
157            'LinkIncremental': '1',
158            # SubSystem values:
159            #   0 == not set
160            #   1 == /SUBSYSTEM:CONSOLE
161            #   2 == /SUBSYSTEM:WINDOWS
162            'SubSystem': '1',
163          },
164        },
165      },
166    }],  # OS=="win"
167    ['OS=="mac"', {
168      'target_defaults': {
169        'xcode_settings': {
170          'ALWAYS_SEARCH_USER_PATHS': 'NO',
171          'GCC_C_LANGUAGE_STANDARD': 'ansi',        # -ansi
172          'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
173          'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
174                                                    # (Equivalent to -fPIC)
175          'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
176          'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
177          'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
178          # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
179          'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
180          'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
181          'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
182          'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
183          'GCC_VERSION': '4.2',
184          'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
185          'MACOSX_DEPLOYMENT_TARGET': '10.4',       # -mmacosx-version-min=10.4
186          'PREBINDING': 'NO',                       # No -Wl,-prebind
187          'USE_HEADERMAP': 'NO',
188          'OTHER_CFLAGS': [
189            '-fno-strict-aliasing',
190          ],
191          'WARNING_CFLAGS': [
192            '-Wall',
193            '-Wendif-labels',
194            '-W',
195            '-Wno-unused-parameter',
196            '-Wnon-virtual-dtor',
197          ],
198        },
199        'target_conditions': [
200          ['_type!="static_library"', {
201            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
202          }],
203        ],  # target_conditions
204      },  # target_defaults
205    }],  # OS=="mac"
206  ],
207}
208