Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 { | 5 { |
| 6 'target_defaults': { | 6 'target_defaults': { |
| 7 'variables': { | 7 'variables': { |
| 8 # This code gets run a lot and debugged rarely, so it should be fast | 8 # This code gets run a lot and debugged rarely, so it should be fast |
| 9 # by default. See http://crbug.com/388949. | 9 # by default. See http://crbug.com/388949. |
| 10 'debug_optimize': '2', | 10 'debug_optimize': '2', |
| 11 'win_debug_Optimization': '0', | 11 'win_debug_Optimization': '0', |
| 12 # Run time checks are incompatible with any level of optimizations. | 12 # Run time checks are incompatible with any level of optimizations. |
| 13 'win_debug_RuntimeChecks': '0', | 13 'win_debug_RuntimeChecks': '0', |
| 14 }, | 14 }, |
| 15 }, | 15 }, |
| 16 'variables': { | 16 'variables': { |
| 17 'tcmalloc_dir': '../../third_party/tcmalloc/chromium', | 17 'tcmalloc_dir': '../../third_party/tcmalloc/chromium', |
| 18 'use_vtable_verify%': 0, | 18 'use_vtable_verify%': 0, |
| 19 # Provide a way to force disable debugallocation in Debug builds | |
| 20 # e.g. for profiling (it's more rare to profile Debug builds, | |
| 21 # but people sometimes need to do that). | |
| 22 'disable_debugallocation%': 0, | |
| 19 }, | 23 }, |
| 20 'targets': [ | 24 'targets': [ |
| 21 # Only executables and not libraries should depend on the | 25 # Only executables and not libraries should depend on the |
| 22 # allocator target; only the application (the final executable) | 26 # allocator target; only the application (the final executable) |
| 23 # knows what allocator makes sense. | 27 # knows what allocator makes sense. |
| 24 { | 28 { |
| 25 'target_name': 'allocator', | 29 'target_name': 'allocator', |
| 30 # TODO(primiano): This should be type: none for the noop cases (an empty | |
| 31 # static lib can confuse some gyp generators). Fix it once the refactoring | |
| 32 # (crbug.com/564618) bring this file to a saner state (less conditions). | |
|
Nico
2015/12/03 14:36:00
s/less/fewer/ i think (but i'm not a native speake
Mark Mentovai
2015/12/03 14:46:48
Nico wrote:
| |
| 26 'type': 'static_library', | 33 'type': 'static_library', |
| 27 'direct_dependent_settings': { | 34 'conditions': [ |
| 28 'configurations': { | 35 # TODO(primiano): in next CL this should check win_use_allocator_shim. |
| 29 'Common_Base': { | 36 # Right now that would produce a non-zero ninja diff for asan=1. |
| 30 'msvs_settings': { | 37 ['OS=="win" and component!="shared_library"', { |
| 31 'VCLinkerTool': { | 38 'msvs_settings': { |
| 32 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'], | 39 # TODO(sgk): merge this with build/common.gypi settings |
| 33 'AdditionalDependencies': [ | 40 'VCLibrarianTool': { |
| 34 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib' | 41 'AdditionalOptions': ['/ignore:4006,4221'], |
| 35 ], | 42 }, |
| 43 'VCLinkerTool': { | |
| 44 'AdditionalOptions': ['/ignore:4006'], | |
| 45 }, | |
| 46 }, | |
| 47 'dependencies': [ | |
| 48 'libcmt', | |
| 49 ], | |
| 50 'include_dirs': [ | |
| 51 '.', # TODO(primiano): remove in next CL, not really needed. | |
| 52 '../..', | |
| 53 ], | |
| 54 'sources': [ | |
| 55 'allocator_shim_win.cc', | |
| 56 ], | |
| 57 'configurations': { | |
| 58 'Debug_Base': { | |
| 59 'msvs_settings': { | |
| 60 'VCCLCompilerTool': { | |
| 61 'RuntimeLibrary': '0', | |
| 62 }, | |
| 63 }, | |
| 64 # TODO(primiano): remove this 'conditions' section soon. This is | |
| 65 # only for tc-malloc, which is not supported on windows. The only | |
| 66 # reason os it is to make the initial refactoring easier and | |
| 67 # a zero-diff ninja w.r.t. the current situation. | |
| 68 'conditions': [ | |
| 69 ['disable_debugallocation==0', { | |
| 70 'defines': [ 'TCMALLOC_FOR_DEBUGALLOCATION' ], | |
| 71 }], | |
| 72 ], | |
| 73 }, | |
| 74 }, | |
| 75 'direct_dependent_settings': { | |
| 76 'configurations': { | |
| 77 'Common_Base': { | |
| 78 'msvs_settings': { | |
| 79 'VCLinkerTool': { | |
| 80 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'], | |
| 81 'AdditionalDependencies': [ | |
| 82 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib' | |
| 83 ], | |
| 84 }, | |
| 85 }, | |
| 36 }, | 86 }, |
| 37 }, | 87 }, |
| 38 }, | |
| 39 }, | |
| 40 'conditions': [ | |
| 41 ['OS=="win"', { | |
| 42 'defines': [ | 88 'defines': [ |
| 43 'PERFTOOLS_DLL_DECL=', | 89 'PERFTOOLS_DLL_DECL=', |
| 44 ], | 90 ], |
| 45 }], | |
| 46 ], | |
| 47 }, | |
| 48 'dependencies': [ | |
| 49 '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_anno tations', | |
| 50 ], | |
| 51 'msvs_settings': { | |
| 52 # TODO(sgk): merge this with build/common.gypi settings | |
| 53 'VCLibrarianTool': { | |
| 54 'AdditionalOptions': ['/ignore:4006,4221'], | |
| 55 }, | |
| 56 'VCLinkerTool': { | |
| 57 'AdditionalOptions': ['/ignore:4006'], | |
| 58 }, | |
| 59 }, | |
| 60 'configurations': { | |
| 61 'Debug_Base': { | |
| 62 'msvs_settings': { | |
| 63 'VCCLCompilerTool': { | |
| 64 'RuntimeLibrary': '0', | |
| 65 }, | |
| 66 }, | 91 }, |
| 67 'variables': { | 92 }], # OS=="win" |
| 68 # Provide a way to force disable debugallocation in Debug builds, | 93 # TODO(primiano): remove the per-os conditionals once common.gypi is |
| 69 # e.g. for profiling (it's more rare to profile Debug builds, | 94 # fixed (i.e. mac stops saying use_allocator=tcmalloc, which is not true ). |
| 70 # but people sometimes need to do that). | 95 # One should be able to set use_allocator=tcmalloc on Mac and as a |
| 71 'disable_debugallocation%': 0, | 96 # result this should build it (maybe failing), not silently ignore that. |
| 72 }, | |
| 73 'conditions': [ | |
| 74 ['disable_debugallocation==0', { | |
| 75 'defines': [ | |
| 76 # Use debugallocation for Debug builds to catch problems early | |
| 77 # and cleanly, http://crbug.com/30715 . | |
| 78 'TCMALLOC_FOR_DEBUGALLOCATION', | |
| 79 ], | |
| 80 }], | |
| 81 ], | |
| 82 }, | |
| 83 }, | |
| 84 'conditions': [ | |
| 85 ['use_allocator=="tcmalloc"', { | 97 ['use_allocator=="tcmalloc"', { |
| 86 # Disable the heap checker in tcmalloc. | 98 # Disable the heap checker in tcmalloc. |
| 87 'defines': [ | 99 'defines': [ |
| 88 'NO_HEAP_CHECK', | 100 'NO_HEAP_CHECK', |
| 89 ], | 101 ], |
| 102 'dependencies': [ | |
| 103 '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_ annotations', | |
| 104 ], | |
| 105 # The order of this include_dirs matters, as tc-malloc has its own | |
| 106 # base/ mini-fork. Do not factor these out of this conditions section. | |
| 90 'include_dirs': [ | 107 'include_dirs': [ |
| 91 '.', | 108 '.', |
| 92 '<(tcmalloc_dir)/src/base', | 109 '<(tcmalloc_dir)/src/base', |
| 93 '<(tcmalloc_dir)/src', | 110 '<(tcmalloc_dir)/src', |
| 94 '../..', | 111 '../..', |
| 95 ], | 112 ], |
| 96 'sources': [ | 113 'sources': [ |
| 97 # Generated for our configuration from tcmalloc's build | 114 # Generated for our configuration from tcmalloc's build |
| 98 # and checked in. | 115 # and checked in. |
| 99 '<(tcmalloc_dir)/src/config.h', | 116 '<(tcmalloc_dir)/src/config.h', |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h', | 297 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h', |
| 281 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h', | 298 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h', |
| 282 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h', | 299 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h', |
| 283 '<(tcmalloc_dir)/src/stacktrace_with_context.cc', | 300 '<(tcmalloc_dir)/src/stacktrace_with_context.cc', |
| 284 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h', | 301 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h', |
| 285 '<(tcmalloc_dir)/src/tcmalloc_guard.h', | 302 '<(tcmalloc_dir)/src/tcmalloc_guard.h', |
| 286 | 303 |
| 287 # Included by debugallocation_shim.cc. | 304 # Included by debugallocation_shim.cc. |
| 288 '<(tcmalloc_dir)/src/debugallocation.cc', | 305 '<(tcmalloc_dir)/src/debugallocation.cc', |
| 289 '<(tcmalloc_dir)/src/tcmalloc.cc', | 306 '<(tcmalloc_dir)/src/tcmalloc.cc', |
| 290 ] | |
| 291 },{ | |
| 292 'include_dirs': [ | |
| 293 '.', | |
| 294 '../..', | |
| 295 ], | 307 ], |
| 296 }], | 308 'conditions': [ |
| 297 ['OS=="win" and component!="shared_library"', { | 309 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', { |
| 298 'dependencies': [ | 310 'sources!': [ |
| 299 'libcmt', | 311 '<(tcmalloc_dir)/src/system-alloc.h', |
| 312 ], | |
| 313 # We enable all warnings by default, but upstream disables a few. | |
| 314 # Keep "-Wno-*" flags in sync with upstream by comparing against: | |
| 315 # http://code.google.com/p/google-perftools/source/browse/trunk/Ma kefile.am | |
| 316 'cflags': [ | |
| 317 '-Wno-sign-compare', | |
| 318 '-Wno-unused-result', | |
| 319 ], | |
| 320 'cflags!': [ | |
| 321 '-fvisibility=hidden', | |
| 322 ], | |
| 323 'link_settings': { | |
| 324 'ldflags': [ | |
| 325 # Don't let linker rip this symbol out, otherwise the heap&cpu | |
| 326 # profilers will not initialize properly on startup. | |
| 327 '-Wl,-uIsHeapProfilerRunning,-uProfilerStart', | |
| 328 # Do the same for heap leak checker. | |
| 329 '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_M MapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi', | |
| 330 '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_M MapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl', | |
| 331 '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakC hecker14UnIgnoreObjectEPKv', | |
| 332 ], | |
| 333 }, | |
| 334 }], | |
| 335 ['profiling!=1', { | |
| 336 'sources!': [ | |
| 337 # cpuprofiler | |
| 338 '<(tcmalloc_dir)/src/base/thread_lister.c', | |
| 339 '<(tcmalloc_dir)/src/base/thread_lister.h', | |
| 340 '<(tcmalloc_dir)/src/profile-handler.cc', | |
| 341 '<(tcmalloc_dir)/src/profile-handler.h', | |
| 342 '<(tcmalloc_dir)/src/profiledata.cc', | |
| 343 '<(tcmalloc_dir)/src/profiledata.h', | |
| 344 '<(tcmalloc_dir)/src/profiler.cc', | |
| 345 ], | |
| 346 }], | |
| 300 ], | 347 ], |
| 301 'sources': [ | 348 'configurations': { |
| 302 'allocator_shim_win.cc', | 349 'Debug_Base': { |
| 303 ], | 350 'conditions': [ |
| 304 }], | 351 ['disable_debugallocation==0', { |
| 305 ['profiling!=1', { | 352 'defines': [ |
| 306 'sources!': [ | 353 # Use debugallocation for Debug builds to catch problems |
| 307 # cpuprofiler | 354 # early and cleanly, http://crbug.com/30715 . |
| 308 '<(tcmalloc_dir)/src/base/thread_lister.c', | 355 'TCMALLOC_FOR_DEBUGALLOCATION', |
| 309 '<(tcmalloc_dir)/src/base/thread_lister.h', | 356 ], |
| 310 '<(tcmalloc_dir)/src/profile-handler.cc', | 357 }], |
| 311 '<(tcmalloc_dir)/src/profile-handler.h', | 358 ], |
| 312 '<(tcmalloc_dir)/src/profiledata.cc', | 359 }, |
| 313 '<(tcmalloc_dir)/src/profiledata.h', | 360 }, |
| 314 '<(tcmalloc_dir)/src/profiler.cc', | 361 }], # use_allocator=="tcmalloc |
| 315 ], | 362 # For CrOS builds with vtable verification. According to the author of |
| 316 }], | 363 # crrev.com/10854031 this is used in conjuction with some other CrOS |
| 317 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', { | 364 # build flag, to enable verification of any allocator that uses virtual |
| 318 'sources!': [ | 365 # function calls. |
| 319 '<(tcmalloc_dir)/src/system-alloc.h', | 366 ['use_vtable_verify==1', { |
| 320 ], | |
| 321 # We enable all warnings by default, but upstream disables a few. | |
| 322 # Keep "-Wno-*" flags in sync with upstream by comparing against: | |
| 323 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefi le.am | |
| 324 'cflags': [ | |
| 325 '-Wno-sign-compare', | |
| 326 '-Wno-unused-result', | |
| 327 ], | |
| 328 'cflags!': [ | |
| 329 '-fvisibility=hidden', | |
| 330 ], | |
| 331 'link_settings': { | |
| 332 'ldflags': [ | |
| 333 # Don't let linker rip this symbol out, otherwise the heap&cpu | |
| 334 # profilers will not initialize properly on startup. | |
| 335 '-Wl,-uIsHeapProfilerRunning,-uProfilerStart', | |
| 336 # Do the same for heap leak checker. | |
| 337 '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapP KvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi', | |
| 338 '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapP KvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl', | |
| 339 '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakCheck er14UnIgnoreObjectEPKv', | |
| 340 ]}, | |
| 341 }], | |
| 342 [ 'use_vtable_verify==1', { | |
| 343 'cflags': [ | 367 'cflags': [ |
| 344 '-fvtable-verify=preinit', | 368 '-fvtable-verify=preinit', |
| 345 ], | 369 ], |
| 346 }], | 370 }], |
| 347 ['order_profiling != 0', { | 371 ['order_profiling != 0', { |
| 348 'target_conditions' : [ | 372 'target_conditions' : [ |
| 349 ['_toolset=="target"', { | 373 ['_toolset=="target"', { |
| 350 'cflags!': [ '-finstrument-functions' ], | 374 'cflags!': [ '-finstrument-functions' ], |
| 351 }], | 375 }], |
| 352 ], | 376 ], |
| 353 }], | 377 }], |
| 354 ], | 378 ], # conditions of 'allocator' target. |
| 355 }, | 379 }, # 'allocator' target. |
| 356 { | 380 { |
| 357 # This library is linked in to src/base.gypi:base and allocator_unittests | 381 # This library is linked in to src/base.gypi:base and allocator_unittests |
| 358 # It can't depend on either and nothing else should depend on it - all | 382 # It can't depend on either and nothing else should depend on it - all |
| 359 # other code should use the interfaced provided by base. | 383 # other code should use the interfaced provided by base. |
| 360 'target_name': 'allocator_extension_thunks', | 384 'target_name': 'allocator_extension_thunks', |
| 361 'type': 'static_library', | 385 'type': 'static_library', |
| 362 'sources': [ | 386 'sources': [ |
| 363 'allocator_extension_thunks.cc', | 387 'allocator_extension_thunks.cc', |
| 364 'allocator_extension_thunks.h', | 388 'allocator_extension_thunks.h', |
| 365 ], | 389 ], |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 ], | 473 ], |
| 450 'dependencies': [ | 474 'dependencies': [ |
| 451 '../../testing/gtest.gyp:gtest', | 475 '../../testing/gtest.gyp:gtest', |
| 452 'allocator', | 476 'allocator', |
| 453 ], | 477 ], |
| 454 }, | 478 }, |
| 455 ], | 479 ], |
| 456 }], | 480 }], |
| 457 ], | 481 ], |
| 458 } | 482 } |
| OLD | NEW |