| # Copyright 2019 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/cpp/library_headers.gni") |
| import("//build/zircon/zx_library.gni") |
| |
| # Three copies of libtrace-engine are built: |
| # 1) Shared library for use by userspace tracing. |
| # 2) Static library for use by userspace tracing. |
| # 3) Static library to be linked into libdriver.so for use by driver tracing. |
| # |
| # N.B. Please DO NOT use (2) unless you KNOW you need to. Generally you do not. |
| # If in doubt, ask. (2) is for very special circumstances where |
| # libtrace-engine.so is not available. |
| |
| trace_engine_headers = [ |
| # keep-sorted: begin |
| "lib/trace-engine/context.h", |
| "lib/trace-engine/fields.h", |
| "lib/trace-engine/handler.h", |
| "lib/trace-engine/instrumentation.h", |
| "lib/trace-engine/types.h", |
| |
| # keep-sorted: end |
| ] |
| |
| trace_engine_header_deps = [ |
| # <trace-engine/handler.h> has #include <lib/async/dispatcher.h>. |
| "//zircon/system/ulib/async", |
| ] |
| |
| template("trace_engine_library") { |
| zx_library(target_name) { |
| forward_variables_from(invoker, "*") |
| |
| if (defined(extra_configs)) { |
| configs += extra_configs |
| } |
| |
| sdk_headers = trace_engine_headers |
| |
| public_deps = [ ":trace-engine-headersonly" ] |
| public_deps += trace_engine_header_deps |
| |
| sources = [ |
| "context.cc", |
| "context_api.cc", |
| "context_impl.h", |
| "engine.cc", |
| "hash_table.h", |
| "include/lib/trace-engine/buffer_internal.h", |
| "nonce.cc", |
| ] |
| deps = [ |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| } |
| |
| config("trace_engine_include") { |
| include_dirs = [ "include" ] |
| } |
| |
| # Header-only source package for use by trace-provider:handler, |
| # which is engine-agnostic. |
| sdk_source_set("trace-engine-headersonly") { |
| sdk_name = "trace-engine-headersonly" |
| category = "partner" |
| |
| sources = [ "include/lib/trace-engine/buffer_internal.h" ] |
| |
| public = [] |
| foreach(header, trace_engine_headers) { |
| public += [ "include/" + header ] |
| } |
| |
| public_deps = trace_engine_header_deps |
| public_configs = [ ":trace_engine_include" ] |
| } |
| |
| # The default version for the normal case. |
| trace_engine_library("trace-engine") { |
| sdk = "shared" |
| sdk_publishable = "partner" |
| |
| # TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings |
| extra_configs = [ "//build/config:Wno-conversion" ] |
| } |
| |
| # A special version for programs and shared libraries that can't use |
| # libtrace-engine.so, e.g., because it is unavailable. |
| # N.B. Please verify that you really need this before using it. |
| # Generally you DO NOT want to use this. |
| trace_engine_library("trace-engine-static") { |
| sdk = "static" |
| defines = [ "STATIC_LIBRARY" ] |
| |
| # TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings |
| extra_configs = [ "//build/config:Wno-conversion" ] |
| } |
| |
| # Header-only source package for use by exported trace-reader package. |
| # This code also runs on the host. |
| zx_library("trace-engine-headers-for-reader") { |
| sdk = "source" |
| sdk_headers = [ |
| "lib/trace-engine/fields.h", |
| "lib/trace-engine/types.h", |
| "lib/trace-engine/buffer_internal.h", |
| "lib/trace-engine/context.h", |
| ] |
| sources = [] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ "test:tests" ] |
| } |