diff options
author | dank@chromium.org <dank@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 21:07:47 +0000 |
---|---|---|
committer | dank@chromium.org <dank@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-03 21:07:47 +0000 |
commit | 7e0d664aad3baa2c8af840addc75e1cebae75702 (patch) | |
tree | 24d17986c6796be6b3f5c522df0c58311d96bb82 /build | |
parent | 2947cdcd14aa838dafc8c248e91e594fa4b15520 (diff) | |
download | chromium_src-7e0d664aad3baa2c8af840addc75e1cebae75702.zip chromium_src-7e0d664aad3baa2c8af840addc75e1cebae75702.tar.gz chromium_src-7e0d664aad3baa2c8af840addc75e1cebae75702.tar.bz2 |
Make no-tcmalloc (really, non-base/allocator) builds work again,
(i.e. this is a plain vanilla build used when layers like base/allocator
are getting in the way of debugging)
and make sure they use msvcrt rather than libcmt
(libcmt is used to help shim malloc/free, but it gets
in the way of valgrind doing the same thing).
Sadly, this is now a gyp-time operation rather than a Configuration
option.
Had to remove hardcoded C prototype for _set_new_mode,
as that caused link errors.
Also add variables win_{release,debug}_{Optimization,RuntimeLibrary}
to let the valgrind build override those settings.
Fix calling convention on _set_new_mode to match the
one in <new.h>
BUG=none
TEST=build with ~/.gyp/include.gypi set as described in comment in common.gypi, gclient runhooks, do release build, verify all exe's and dll's linked against msvcrt dll
Review URL: http://codereview.chromium.org/455037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/all.gyp | 8 | ||||
-rw-r--r-- | build/common.gypi | 49 |
2 files changed, 46 insertions, 11 deletions
diff --git a/build/all.gyp b/build/all.gyp index 85849ed..9bdd75f 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -85,8 +85,14 @@ ], }], ['OS=="win"', { + 'conditions': [ + ['win_use_allocator_shim==1', { + 'dependencies': [ + '../base/allocator/allocator.gyp:*', + ], + }], + ], 'dependencies': [ - '../base/allocator/allocator.gyp:*', '../breakpad/breakpad.gyp:*', '../chrome/app/locales/locales.gyp:*', '../courgette/courgette.gyp:*', diff --git a/build/common.gypi b/build/common.gypi index 997cd9e..8183893 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -127,6 +127,14 @@ # JavaScript engines. 'javascript_engine%': 'v8', + # Although base/allocator lets you select a heap library via an + # environment variable, the libcmt shim it uses sometimes gets in + # the way. To disable it entirely, and switch to normal msvcrt, do e.g. + # 'win_use_allocator_shim': 0, + # 'win_release_RuntimeLibrary': 2 + # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build. + 'win_use_allocator_shim%': 1, # 0 = shim allocator via libcmt; 1 = msvcrt + # To do a shared build on linux we need to be able to choose between type # static_library and shared_library. We default to doing a static build # but you can override this with "gyp -Dlibrary=shared_library" or you @@ -280,8 +288,16 @@ }, 'target_defaults': { 'variables': { + # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html 'mac_release_optimization%': '3', # Use -O3 unless overridden 'mac_debug_optimization%': '0', # Use -O0 unless overridden + # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx + 'win_release_Optimization%': '2', # 2 = /Os + 'win_debug_Optimization%': '0', # 0 = /Od + # See http://msdn.microsoft.com/en-us/library/aa652367(VS.71).aspx + 'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static) + 'win_debug_RuntimeLibrary%': '1', # 1 = /MTd (debug static) + 'release_extra_cflags%': '', 'debug_extra_cflags%': '', 'release_valgrind_build%': 0, @@ -325,6 +341,13 @@ ['selinux==1', { 'defines': ['CHROMIUM_SELINUX=1'], }], + ['win_use_allocator_shim==0', { + 'conditions': [ + ['OS=="win"', { + 'defines': ['NO_TCMALLOC'], + }], + ], + }], ['coverage!=0', { 'conditions': [ ['OS=="mac"', { @@ -389,10 +412,10 @@ }, 'msvs_settings': { 'VCCLCompilerTool': { - 'Optimization': '0', + 'Optimization': '<(win_debug_Optimization)', 'PreprocessorDefinitions': ['_DEBUG'], 'BasicRuntimeChecks': '3', - 'RuntimeLibrary': '1', + 'RuntimeLibrary': '<(win_debug_RuntimeLibrary)', }, 'VCLinkerTool': { 'LinkIncremental': '<(msvs_debug_link_incremental)', @@ -420,6 +443,10 @@ 'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ], }, 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '<(win_release_Optimization)', + 'RuntimeLibrary': '<(win_release_RuntimeLibrary)', + }, 'VCLinkerTool': { 'LinkIncremental': '1', }, @@ -428,6 +455,16 @@ ['release_valgrind_build==0', { 'defines': ['NVALGRIND'], }], + ['win_use_allocator_shim==0', { + 'defines': ['NO_TCMALLOC'], + }], + ['win_release_RuntimeLibrary==2', { + # Visual C++ 2008 barfs when building anything with /MD (msvcrt): + # VC\include\typeinfo(139) : warning C4275: non dll-interface + # class 'stdext::exception' used as base for dll-interface + # class 'std::bad_cast' + 'msvs_disabled_warnings': [4275], + }], ['msvs_use_common_release', { 'msvs_props': ['release.vsprops'], }], @@ -459,10 +496,6 @@ }, }, }, - 'Release - no tcmalloc': { - 'inherit_from': ['Release'], - 'defines': ['NO_TCMALLOC'], - }, 'Debug_x64': { 'inherit_from': ['Debug'], 'msvs_configuration_platform': 'x64', @@ -475,10 +508,6 @@ 'inherit_from': ['Purify'], 'msvs_configuration_platform': 'x64', }, - 'Release - no tcmalloc_x64': { - 'inherit_from': ['Release - no tcmalloc'], - 'msvs_configuration_platform': 'x64', - }, }], ], }, |