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 }, | 19 }, |
| 20 'targets': [ | 20 'targets': [ |
| 21 # Only executables and not libraries should depend on the | 21 # Only executables and not libraries should depend on the |
| 22 # allocator target; only the application (the final executable) | 22 # allocator target; only the application (the final executable) |
| 23 # knows what allocator makes sense. | 23 # knows what allocator makes sense. |
| 24 { | 24 { |
| 25 'target_name': 'allocator', | 25 'target_name': 'allocator', |
| 26 'type': 'static_library', | 26 'type': 'static_library', |
|
Nico
2015/12/02 21:32:21
Maybe this should be type none by default and only
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
OK, if you agree let's do this. I'm putting a TODO
| |
| 27 'direct_dependent_settings': { | 27 'conditions': [ |
| 28 'configurations': { | 28 #################################################################### |
| 29 'Common_Base': { | 29 # WINDOWS SHIM LAYER |
| 30 'msvs_settings': { | 30 #################################################################### |
|
Nico
2015/12/02 21:32:21
##################################################
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
Ok, ok, agree. this was mostly driven my yesterday
| |
| 31 'VCLinkerTool': { | 31 ['OS=="win" and win_use_allocator_shim==1', { |
| 32 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'], | 32 'msvs_settings': { |
| 33 'AdditionalDependencies': [ | 33 # TODO(sgk): merge this with build/common.gypi settings |
| 34 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib' | 34 'VCLibrarianTool': { |
| 35 ], | 35 'AdditionalOptions': ['/ignore:4006,4221'], |
| 36 }, | |
| 37 'VCLinkerTool': { | |
| 38 'AdditionalOptions': ['/ignore:4006'], | |
| 39 }, | |
| 40 }, | |
| 41 'dependencies': [ | |
| 42 'libcmt', | |
| 43 ], | |
| 44 'include_dirs': [ | |
| 45 '../..', | |
| 46 ], | |
| 47 'sources': [ | |
| 48 'allocator_shim_win.cc', | |
| 49 ], | |
| 50 'configurations': { | |
| 51 'Debug_Base': { | |
| 52 'msvs_settings': { | |
| 53 'VCCLCompilerTool': { | |
| 54 'RuntimeLibrary': '0', | |
| 55 }, | |
| 36 }, | 56 }, |
| 37 }, | 57 }, |
| 38 }, | 58 }, |
| 39 }, | 59 'direct_dependent_settings': { |
| 40 'conditions': [ | 60 'configurations': { |
| 41 ['OS=="win"', { | 61 'Common_Base': { |
| 62 'msvs_settings': { | |
| 63 'VCLinkerTool': { | |
| 64 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'], | |
| 65 'AdditionalDependencies': [ | |
| 66 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib' | |
| 67 ], | |
| 68 }, | |
| 69 }, | |
| 70 }, | |
| 71 }, | |
| 42 'defines': [ | 72 'defines': [ |
| 43 'PERFTOOLS_DLL_DECL=', | 73 'PERFTOOLS_DLL_DECL=', |
| 44 ], | 74 ], |
| 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 }, | 75 }, |
| 67 'variables': { | 76 }], # OS=="win" |
| 68 # Provide a way to force disable debugallocation in Debug builds, | 77 #################################################################### |
| 69 # e.g. for profiling (it's more rare to profile Debug builds, | 78 # TCMALLOC |
| 70 # but people sometimes need to do that). | 79 #################################################################### |
| 71 'disable_debugallocation%': 0, | 80 # TODO(primiano): remove the per-os conditionals one common.gypi is |
|
Nico
2015/12/02 21:32:21
s/one/once
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
Done.
| |
| 72 }, | 81 # fixed (i.e. mac stops saying use_allocator=tcmalloc). One should be |
| 73 'conditions': [ | 82 # able to say use_allocator=tcmalloc on Mac and as a result this should |
| 74 ['disable_debugallocation==0', { | 83 # at least try to build it, not silently ignore that. |
| 75 'defines': [ | 84 ['use_allocator=="tcmalloc" and os_posix==1 and OS!="mac" and OS!="ios"' , { |
| 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"', { | |
| 86 # Disable the heap checker in tcmalloc. | 85 # Disable the heap checker in tcmalloc. |
| 87 'defines': [ | 86 'defines': [ |
| 88 'NO_HEAP_CHECK', | 87 'NO_HEAP_CHECK', |
| 89 ], | 88 ], |
| 89 'dependencies': [ | |
| 90 '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_ annotations', | |
| 91 ], | |
| 92 # The order of this include_dirs matters, as tc-malloc has its own | |
| 93 # base/ mini-fork. Do not factor these out in the allocator target. | |
|
Nico
2015/12/02 21:32:21
I'm not sure what the second sentence means. We ar
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
Reworded. What I mean here is that it would be tem
| |
| 90 'include_dirs': [ | 94 'include_dirs': [ |
| 91 '.', | 95 '.', |
| 92 '<(tcmalloc_dir)/src/base', | 96 '<(tcmalloc_dir)/src/base', |
| 93 '<(tcmalloc_dir)/src', | 97 '<(tcmalloc_dir)/src', |
| 94 '../..', | 98 '../..', |
| 95 ], | 99 ], |
| 96 'sources': [ | 100 'sources': [ |
| 97 # Generated for our configuration from tcmalloc's build | 101 # Generated for our configuration from tcmalloc's build |
| 98 # and checked in. | 102 # and checked in. |
| 99 '<(tcmalloc_dir)/src/config.h', | 103 '<(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', | 284 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h', |
| 281 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h', | 285 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h', |
| 282 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h', | 286 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h', |
| 283 '<(tcmalloc_dir)/src/stacktrace_with_context.cc', | 287 '<(tcmalloc_dir)/src/stacktrace_with_context.cc', |
| 284 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h', | 288 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h', |
| 285 '<(tcmalloc_dir)/src/tcmalloc_guard.h', | 289 '<(tcmalloc_dir)/src/tcmalloc_guard.h', |
| 286 | 290 |
| 287 # Included by debugallocation_shim.cc. | 291 # Included by debugallocation_shim.cc. |
| 288 '<(tcmalloc_dir)/src/debugallocation.cc', | 292 '<(tcmalloc_dir)/src/debugallocation.cc', |
| 289 '<(tcmalloc_dir)/src/tcmalloc.cc', | 293 '<(tcmalloc_dir)/src/tcmalloc.cc', |
| 290 ] | |
| 291 },{ | |
| 292 'include_dirs': [ | |
| 293 '.', | |
| 294 '../..', | |
| 295 ], | 294 ], |
| 296 }], | 295 'conditions': [ |
| 297 ['OS=="win" and component!="shared_library"', { | 296 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', { |
| 298 'dependencies': [ | 297 'sources!': [ |
| 299 'libcmt', | 298 '<(tcmalloc_dir)/src/system-alloc.h', |
|
Nico
2015/12/02 21:32:21
where did this go?
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
On line 42.
You could argue: "wait but !shared_lib
| |
| 299 ], | |
| 300 # We enable all warnings by default, but upstream disables a few. | |
| 301 # Keep "-Wno-*" flags in sync with upstream by comparing against: | |
| 302 # http://code.google.com/p/google-perftools/source/browse/trunk/Ma kefile.am | |
| 303 'cflags': [ | |
| 304 '-Wno-sign-compare', | |
| 305 '-Wno-unused-result', | |
| 306 ], | |
| 307 'cflags!': [ | |
| 308 '-fvisibility=hidden', | |
| 309 ], | |
| 310 'link_settings': { | |
| 311 'ldflags': [ | |
| 312 # Don't let linker rip this symbol out, otherwise the heap&cpu | |
| 313 # profilers will not initialize properly on startup. | |
| 314 '-Wl,-uIsHeapProfilerRunning,-uProfilerStart', | |
| 315 # Do the same for heap leak checker. | |
| 316 '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_M MapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi', | |
| 317 '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_M MapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl', | |
| 318 '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakC hecker14UnIgnoreObjectEPKv', | |
| 319 ], | |
| 320 }, | |
| 321 }], | |
| 322 ['profiling!=1', { | |
| 323 'sources!': [ | |
| 324 # cpuprofiler | |
| 325 '<(tcmalloc_dir)/src/base/thread_lister.c', | |
| 326 '<(tcmalloc_dir)/src/base/thread_lister.h', | |
| 327 '<(tcmalloc_dir)/src/profile-handler.cc', | |
| 328 '<(tcmalloc_dir)/src/profile-handler.h', | |
| 329 '<(tcmalloc_dir)/src/profiledata.cc', | |
| 330 '<(tcmalloc_dir)/src/profiledata.h', | |
| 331 '<(tcmalloc_dir)/src/profiler.cc', | |
| 332 ], | |
| 333 }], | |
| 300 ], | 334 ], |
| 301 'sources': [ | 335 'configurations': { |
| 302 'allocator_shim_win.cc', | 336 'Debug_Base': { |
| 303 ], | 337 'variables': { |
| 304 }], | 338 # Provide a way to force disable debugallocation in Debug builds |
| 305 ['profiling!=1', { | 339 # e.g. for profiling (it's more rare to profile Debug builds, |
| 306 'sources!': [ | 340 # but people sometimes need to do that). |
| 307 # cpuprofiler | 341 'disable_debugallocation%': 0, |
|
Nico
2015/12/02 21:32:21
moving this into a configuration subtly changes be
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
I can move it to the variables on top, but I think
| |
| 308 '<(tcmalloc_dir)/src/base/thread_lister.c', | 342 }, |
| 309 '<(tcmalloc_dir)/src/base/thread_lister.h', | 343 'conditions': [ |
| 310 '<(tcmalloc_dir)/src/profile-handler.cc', | 344 ['disable_debugallocation==0', { |
| 311 '<(tcmalloc_dir)/src/profile-handler.h', | 345 'defines': [ |
| 312 '<(tcmalloc_dir)/src/profiledata.cc', | 346 # Use debugallocation for Debug builds to catch problems |
| 313 '<(tcmalloc_dir)/src/profiledata.h', | 347 # early and cleanly, http://crbug.com/30715 . |
| 314 '<(tcmalloc_dir)/src/profiler.cc', | 348 'TCMALLOC_FOR_DEBUGALLOCATION', |
| 315 ], | 349 ], |
| 316 }], | 350 }], |
| 317 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', { | 351 ], |
| 318 'sources!': [ | 352 }, |
| 319 '<(tcmalloc_dir)/src/system-alloc.h', | 353 }, |
| 320 ], | 354 }], # use_allocator=="tcmalloc |
| 321 # We enable all warnings by default, but upstream disables a few. | 355 # For CrOS builds with vtable verification. According to the author of |
| 322 # Keep "-Wno-*" flags in sync with upstream by comparing against: | 356 # crrev.com/10854031 this is used in conjuction with some other CrOS |
| 323 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefi le.am | 357 # build flag, to enable verification of any allocator that uses virtual |
| 324 'cflags': [ | 358 # function calls. |
| 325 '-Wno-sign-compare', | 359 ['use_vtable_verify==1', { |
| 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': [ | 360 'cflags': [ |
| 344 '-fvtable-verify=preinit', | 361 '-fvtable-verify=preinit', |
| 345 ], | 362 ], |
| 346 }], | 363 }], |
| 347 ['order_profiling != 0', { | 364 ['order_profiling != 0', { |
| 348 'target_conditions' : [ | 365 'target_conditions' : [ |
| 349 ['_toolset=="target"', { | 366 ['_toolset=="target"', { |
| 350 'cflags!': [ '-finstrument-functions' ], | 367 'cflags!': [ '-finstrument-functions' ], |
| 351 }], | 368 }], |
| 352 ], | 369 ], |
| 353 }], | 370 }], |
| 354 ], | 371 ], # condditions of 'allocator' target. |
|
Nico
2015/12/02 21:32:21
s/condditions/conditions
Primiano Tucci (use gerrit)
2015/12/03 10:00:55
Done.
| |
| 355 }, | 372 }, # 'allocator' target. |
| 356 { | 373 { |
| 357 # This library is linked in to src/base.gypi:base and allocator_unittests | 374 # 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 | 375 # It can't depend on either and nothing else should depend on it - all |
| 359 # other code should use the interfaced provided by base. | 376 # other code should use the interfaced provided by base. |
| 360 'target_name': 'allocator_extension_thunks', | 377 'target_name': 'allocator_extension_thunks', |
| 361 'type': 'static_library', | 378 'type': 'static_library', |
| 362 'sources': [ | 379 'sources': [ |
| 363 'allocator_extension_thunks.cc', | 380 'allocator_extension_thunks.cc', |
| 364 'allocator_extension_thunks.h', | 381 'allocator_extension_thunks.h', |
| 365 ], | 382 ], |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 ], | 466 ], |
| 450 'dependencies': [ | 467 'dependencies': [ |
| 451 '../../testing/gtest.gyp:gtest', | 468 '../../testing/gtest.gyp:gtest', |
| 452 'allocator', | 469 'allocator', |
| 453 ], | 470 ], |
| 454 }, | 471 }, |
| 455 ], | 472 ], |
| 456 }], | 473 }], |
| 457 ], | 474 ], |
| 458 } | 475 } |
| OLD | NEW |