diff options
author | Herb Derby <herb@google.com> | 2016-12-08 19:00:40 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-09 01:21:28 +0000 |
commit | 76073c11040204d51dceb49cbd0b05be8e7fd0a2 (patch) | |
tree | 97c2ab23b203daa83e169c76a2e8b0fcb9d7f233 /gn/BUILD.gn | |
parent | 59ed482af72beec6812b28d833d8bdf80ba32df7 (diff) |
Add the ability to use different mallocs.
gn gen --args='malloc="tcmalloc"'
gn gen --args='malloc="jemalloc"'
or if the library is in a non-standard directory
gn gen --args='malloc="tcmalloc" extra_ldflags="-L<path-to-library>"'
Change-Id: Icacd837d11392a1971f298ccddd69a5a6781f6cf
Reviewed-on: https://skia-review.googlesource.com/5629
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'gn/BUILD.gn')
-rw-r--r-- | gn/BUILD.gn | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn index 7af10384a4..c71ec3f3bd 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -27,6 +27,7 @@ declare_args() { extra_ldflags = [] cc_wrapper = "" + malloc = "" } if (host_os == "win") { @@ -58,6 +59,7 @@ config("default") { cflags_cc = [] defines = [] ldflags = [] + libs = [] if (is_win) { cflags += [ @@ -133,6 +135,16 @@ config("default") { ldflags += [ "-m32" ] } + if (malloc != "" && !is_win) { + cflags += [ + "-fno-builtin-malloc", + "-fno-builtin-calloc", + "-fno-builtin-realloc", + "-fno-builtin-free", + ] + libs += [ malloc ] + } + if (is_android) { asmflags += [ "--target=$ndk_target", @@ -166,7 +178,7 @@ config("default") { ldflags += [ "-B$ndk/platforms/$ndk_platform/usr/lib64" ] } - libs = [ + libs += [ # Order matters here! Keep these three in exactly this order. "c++_static", "c++abi", @@ -192,7 +204,7 @@ config("default") { target_cpu, "-stdlib=libc++", ] - libs = [ "objc" ] + libs += [ "objc" ] # We used to link all our iOS tools together, so none actually defines main(). # Instead they each define their own entry point, which our iOS mega-app called. @@ -207,7 +219,7 @@ config("default") { } if (is_linux) { - libs = [ "pthread" ] + libs += [ "pthread" ] } if (sanitize != "") { |