| # 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/unification/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 = [ |
| # buffer_internal.h is not here on purpose. |
| "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", |
| ] |
| |
| trace_engine_header_deps = [ |
| # <trace-engine/handler.h> has #include <lib/async/dispatcher.h>. |
| "//zircon/public/lib/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_header_deps |
| |
| sources = [ |
| "context.cc", |
| "context_api.cc", |
| "context_impl.h", |
| "engine.cc", |
| "hash_table.h", |
| "nonce.cc", |
| ] |
| deps = [ |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| } |
| |
| # The default version for the normal case. |
| trace_engine_library("trace-engine") { |
| sdk = "shared" |
| sdk_publishable = true |
| shared = true |
| static = false |
| |
| # TODO(fxbug.dev/58162): 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(fxbug.dev/58162): delete the below and fix compiler warnings |
| extra_configs = [ "//build/config:Wno-conversion" ] |
| } |
| |
| # And again, but this time for drivers. |
| # This gets linked into libdriver.so. |
| trace_engine_library("trace-engine-driver") { |
| sdk = "static" |
| defines = [ "DDK_TRACING" ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| extra_configs = [ "//build/config:Wno-conversion" ] |
| } |
| |
| # Header-only source package for use by trace-provider:handler, |
| # which is engine-agnostic. |
| zx_library("trace-engine-headers-for-handler") { |
| sdk = "source" |
| sdk_headers = trace_engine_headers |
| public_deps = trace_engine_header_deps |
| sources = [] |
| } |
| |
| # 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" |
| host = true |
| sdk_headers = [ |
| "lib/trace-engine/fields.h", |
| "lib/trace-engine/types.h", |
| ] |
| sources = [] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ "test:tests" ] |
| } |