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>
This commit is contained in:
parent
59ed482af7
commit
76073c1104
18
gn/BUILD.gn
18
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 != "") {
|
||||
|
Loading…
Reference in New Issue
Block a user