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 # We need to include toolchain.gypi here for third-party sources that don't 32 # directly include it themselves. 33 'includes': ['toolchain.gypi'], 34 'variables': { 35 'component%': 'static_library', 36 'asan%': 0, 37 'tsan%': 0, 38 'visibility%': 'hidden', 39 'v8_enable_backtrace%': 0, 40 'v8_enable_i18n_support%': 1, 41 'v8_deprecation_warnings': 1, 42 'msvs_multi_core_compile%': '1', 43 'mac_deployment_target%': '10.5', 44 'variables': { 45 'variables': { 46 'variables': { 47 'conditions': [ 48 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \ 49 OS=="netbsd" or OS=="mac" or OS=="qnx"', { 50 # This handles the Unix platforms we generally deal with. 51 # Anything else gets passed through, which probably won't work 52 # very well; such hosts should pass an explicit target_arch 53 # to gyp. 54 'host_arch%': '<!pymod_do_main(detect_v8_host_arch)', 55 }, { 56 # OS!="linux" and OS!="freebsd" and OS!="openbsd" and 57 # OS!="netbsd" and OS!="mac" 58 'host_arch%': 'ia32', 59 }], 60 ], 61 }, 62 'host_arch%': '<(host_arch)', 63 'target_arch%': '<(host_arch)', 64 }, 65 'host_arch%': '<(host_arch)', 66 'target_arch%': '<(target_arch)', 67 'v8_target_arch%': '<(target_arch)', 68 }, 69 'host_arch%': '<(host_arch)', 70 'target_arch%': '<(target_arch)', 71 'v8_target_arch%': '<(v8_target_arch)', 72 'werror%': '-Werror', 73 74 # .gyp files or targets should set v8_code to 1 if they build V8 specific 75 # code, as opposed to external code. This variable is used to control such 76 # things as the set of warnings to enable, and whether warnings are treated 77 # as errors. 78 'v8_code%': 0, 79 80 # Speeds up Debug builds: 81 # 0 - Compiler optimizations off (debuggable) (default). This may 82 # be 5x slower than Release (or worse). 83 # 1 - Turn on compiler optimizations. This may be hard or impossible to 84 # debug. This may still be 2x slower than Release (or worse). 85 # 2 - Turn on optimizations, and also #undef DEBUG / #define NDEBUG 86 # (but leave V8_ENABLE_CHECKS and most other assertions enabled. 87 # This may cause some v8 tests to fail in the Debug configuration. 88 # This roughly matches the performance of a Release build and can 89 # be used by embedders that need to build their own code as debug 90 # but don't want or need a debug version of V8. This should produce 91 # near-release speeds. 92 'v8_optimized_debug%': 0, 93 94 # Relative path to icu.gyp from this file. 95 'icu_gyp_path': '../third_party/icu/icu.gyp', 96 97 'conditions': [ 98 ['(v8_target_arch=="arm" and host_arch!="arm") or \ 99 (v8_target_arch=="arm64" and host_arch!="arm64") or \ 100 (v8_target_arch=="mipsel" and host_arch!="mipsel") or \ 101 (v8_target_arch=="mips64el" and host_arch!="mips64el") or \ 102 (v8_target_arch=="x64" and host_arch!="x64") or \ 103 (OS=="android" or OS=="qnx")', { 104 'want_separate_host_toolset': 1, 105 }, { 106 'want_separate_host_toolset': 0, 107 }], 108 ['OS == "win"', { 109 'os_posix%': 0, 110 }, { 111 'os_posix%': 1, 112 }], 113 ['(v8_target_arch=="ia32" or v8_target_arch=="x64" or v8_target_arch=="x87") and \ 114 (OS=="linux" or OS=="mac")', { 115 'v8_enable_gdbjit%': 1, 116 }, { 117 'v8_enable_gdbjit%': 0, 118 }], 119 ['OS=="mac"', { 120 'clang%': 1, 121 }, { 122 'clang%': 0, 123 }], 124 ], 125 # Default ARM variable settings. 126 'arm_version%': 'default', 127 'arm_fpu%': 'vfpv3', 128 'arm_float_abi%': 'default', 129 'arm_thumb': 'default', 130 }, 131 'target_defaults': { 132 'variables': { 133 'v8_code%': '<(v8_code)', 134 }, 135 'default_configuration': 'Debug', 136 'configurations': { 137 'DebugBaseCommon': { 138 'cflags': [ '-g', '-O0' ], 139 }, 140 'Optdebug': { 141 'inherit_from': [ 'DebugBaseCommon', 'DebugBase2' ], 142 }, 143 'Debug': { 144 # Xcode insists on this empty entry. 145 }, 146 'Release': { 147 # Xcode insists on this empty entry. 148 }, 149 }, 150 'target_conditions': [ 151 ['v8_code == 0', { 152 'defines!': [ 153 'DEBUG', 154 ], 155 'conditions': [ 156 ['os_posix == 1 and OS != "mac"', { 157 'cflags!': [ 158 '-Werror', 159 ], 160 }], 161 ['OS == "mac"', { 162 'xcode_settings': { 163 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror 164 }, 165 }], 166 ['OS == "win"', { 167 'msvs_settings': { 168 'VCCLCompilerTool': { 169 'WarnAsError': 'false', 170 }, 171 }, 172 }], 173 ], 174 }], 175 ], 176 }, 177 'conditions': [ 178 ['asan==1', { 179 'target_defaults': { 180 'cflags_cc+': [ 181 '-fno-omit-frame-pointer', 182 '-gline-tables-only', 183 '-fsanitize=address', 184 '-w', # http://crbug.com/162783 185 ], 186 'cflags_cc!': [ 187 '-fomit-frame-pointer', 188 ], 189 'ldflags': [ 190 '-fsanitize=address', 191 ], 192 }, 193 }], 194 ['tsan==1', { 195 'target_defaults': { 196 'cflags+': [ 197 '-fno-omit-frame-pointer', 198 '-gline-tables-only', 199 '-fsanitize=thread', 200 '-fPIC', 201 '-Wno-c++11-extensions', 202 ], 203 'cflags!': [ 204 '-fomit-frame-pointer', 205 ], 206 'ldflags': [ 207 '-fsanitize=thread', 208 '-pie', 209 ], 210 'defines': [ 211 'THREAD_SANITIZER', 212 ], 213 }, 214 }], 215 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ 216 or OS=="netbsd"', { 217 'target_defaults': { 218 'cflags': [ 219 '-Wall', 220 '<(werror)', 221 '-W', 222 '-Wno-unused-parameter', 223 '-Wno-long-long', 224 '-pthread', 225 '-fno-exceptions', 226 '-pedantic', 227 # Don't warn about the "struct foo f = {0};" initialization pattern. 228 '-Wno-missing-field-initializers', 229 ], 230 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ], 231 'ldflags': [ '-pthread', ], 232 'conditions': [ 233 [ 'visibility=="hidden" and v8_enable_backtrace==0', { 234 'cflags': [ '-fvisibility=hidden' ], 235 }], 236 [ 'component=="shared_library"', { 237 'cflags': [ '-fPIC', ], 238 }], 239 ], 240 }, 241 }], 242 # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" 243 # or OS=="netbsd"' 244 ['OS=="qnx"', { 245 'target_defaults': { 246 'cflags': [ 247 '-Wall', 248 '<(werror)', 249 '-W', 250 '-Wno-unused-parameter', 251 '-fno-exceptions', 252 # Don't warn about the "struct foo f = {0};" initialization pattern. 253 '-Wno-missing-field-initializers', 254 ], 255 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ], 256 'conditions': [ 257 [ 'visibility=="hidden"', { 258 'cflags': [ '-fvisibility=hidden' ], 259 }], 260 [ 'component=="shared_library"', { 261 'cflags': [ '-fPIC' ], 262 }], 263 ], 264 'target_conditions': [ 265 [ '_toolset=="host" and host_os=="linux"', { 266 'cflags': [ '-pthread' ], 267 'ldflags': [ '-pthread' ], 268 'libraries': [ '-lrt' ], 269 }], 270 [ '_toolset=="target"', { 271 'cflags': [ '-Wno-psabi' ], 272 'libraries': [ '-lbacktrace', '-lsocket', '-lm' ], 273 }], 274 ], 275 }, 276 }], # OS=="qnx" 277 ['OS=="win"', { 278 'target_defaults': { 279 'defines': [ 280 '_CRT_SECURE_NO_DEPRECATE', 281 '_CRT_NONSTDC_NO_DEPRECATE', 282 '_USING_V110_SDK71_', 283 ], 284 'conditions': [ 285 ['component=="static_library"', { 286 'defines': [ 287 '_HAS_EXCEPTIONS=0', 288 ], 289 }], 290 ], 291 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'], 292 'msvs_disabled_warnings': [4355, 4800], 293 'msvs_settings': { 294 'VCCLCompilerTool': { 295 'MinimalRebuild': 'false', 296 'BufferSecurityCheck': 'true', 297 'EnableFunctionLevelLinking': 'true', 298 'RuntimeTypeInfo': 'false', 299 'WarningLevel': '3', 300 'WarnAsError': 'true', 301 'DebugInformationFormat': '3', 302 'Detect64BitPortabilityProblems': 'false', 303 'conditions': [ 304 [ 'msvs_multi_core_compile', { 305 'AdditionalOptions': ['/MP'], 306 }], 307 ['component=="shared_library"', { 308 'ExceptionHandling': '1', # /EHsc 309 }, { 310 'ExceptionHandling': '0', 311 }], 312 ], 313 }, 314 'VCLibrarianTool': { 315 'AdditionalOptions': ['/ignore:4221'], 316 }, 317 'VCLinkerTool': { 318 'MinimumRequiredVersion': '5.01', # XP. 319 'AdditionalDependencies': [ 320 'ws2_32.lib', 321 ], 322 'GenerateDebugInformation': 'true', 323 'MapFileName': '$(OutDir)\\$(TargetName).map', 324 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib', 325 'FixedBaseAddress': '1', 326 # LinkIncremental values: 327 # 0 == default 328 # 1 == /INCREMENTAL:NO 329 # 2 == /INCREMENTAL 330 'LinkIncremental': '1', 331 # SubSystem values: 332 # 0 == not set 333 # 1 == /SUBSYSTEM:CONSOLE 334 # 2 == /SUBSYSTEM:WINDOWS 335 'SubSystem': '1', 336 337 'conditions': [ 338 ['v8_enable_i18n_support==1', { 339 'AdditionalDependencies': [ 340 'advapi32.lib', 341 ], 342 }], 343 ], 344 }, 345 }, 346 }, 347 }], # OS=="win" 348 ['OS=="mac"', { 349 'xcode_settings': { 350 'SYMROOT': '<(DEPTH)/xcodebuild', 351 }, 352 'target_defaults': { 353 'xcode_settings': { 354 'ALWAYS_SEARCH_USER_PATHS': 'NO', 355 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99 356 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks 357 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic 358 # (Equivalent to -fPIC) 359 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions 360 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti 361 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings 362 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden 363 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', 364 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 365 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics 366 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor 367 # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min 368 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)', 369 'PREBINDING': 'NO', # No -Wl,-prebind 370 'SYMROOT': '<(DEPTH)/xcodebuild', 371 'USE_HEADERMAP': 'NO', 372 'OTHER_CFLAGS': [ 373 '-fno-strict-aliasing', 374 ], 375 'WARNING_CFLAGS': [ 376 '-Wall', 377 '-Wendif-labels', 378 '-W', 379 '-Wno-unused-parameter', 380 # Don't warn about the "struct foo f = {0};" initialization pattern. 381 '-Wno-missing-field-initializers', 382 ], 383 }, 384 'conditions': [ 385 ['werror==""', { 386 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO'}, 387 }, { 388 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES'}, 389 }], 390 ['clang==1', { 391 'xcode_settings': { 392 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 393 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x 394 }, 395 }], 396 ], 397 'target_conditions': [ 398 ['_type!="static_library"', { 399 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']}, 400 }], 401 ], # target_conditions 402 }, # target_defaults 403 }], # OS=="mac" 404 ], 405 } 406