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