| # Copyright 2018 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/package.gni") |
| |
| gperftools_src_root = "//third_party/gperftools/src/" |
| |
| if (!is_debug) { |
| cflags_cc = [ "-DNO_FRAME_POINTER" ] |
| } |
| |
| config("headers_config") { |
| include_dirs = [ |
| "fuchsia", |
| gperftools_src_root, |
| "include", |
| ] |
| } |
| |
| source_set("profiler_headers") { |
| public_configs = [ ":headers_config" ] |
| } |
| |
| source_set("profiler_lib") { |
| public_configs = [ ":headers_config" ] |
| |
| gperftools_sources = [ |
| "base/basictypes.h", |
| "base/commandlineflags.h", |
| "base/googleinit.h", |
| "base/logging.cc", |
| "base/logging.h", |
| "base/simple_mutex.h", |
| "base/spinlock.cc", |
| "base/spinlock_internal.cc", |
| "base/sysinfo.cc", |
| "base/sysinfo.h", |
| "emergency_malloc_for_stacktrace.cc", |
| "getpc.h", |
| "gperftools/profiler.h", |
| "gperftools/stacktrace.h", |
| "profile-handler.cc", |
| "profile-handler.h", |
| "profiledata.cc", |
| "profiler.cc", |
| "stacktrace.cc", |
| "stacktrace_libunwind-inl.h", |
| ] |
| |
| additional_sources = [ |
| "fuchsia/profiler_log_listener.cc", |
| "fuchsia/profiler_log_listener.h", |
| "fuchsia/thread_interrupter.cc", |
| "fuchsia/thread_interrupter.h", |
| ] |
| |
| sources = rebase_path(gperftools_sources, ".", gperftools_src_root) + |
| additional_sources |
| |
| deps = [ |
| ":profiler_headers", |
| "//sdk/fidl/fuchsia.logger", |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/fsl", |
| "//src/lib/fxl", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/syslog", |
| ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| public_configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| static_library("profiler_static") { |
| public_deps = [ ":profiler_lib" ] |
| } |
| |
| shared_library("profiler") { |
| public_deps = [ ":profiler_lib" ] |
| } |