| # 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. |
| |
| # TODO(MA-488): Add ddk support. |
| |
| # This special config allows "common" to locate the library's headers. |
| # Not relying on the "headers" target generated by the library below |
| # allows this file to be reused in the Fuchsia GN build. |
| config("library_headers_config") { |
| visibility = [ ":common" ] |
| |
| include_dirs = [ |
| "include", |
| "../trace/include", |
| "../trace-engine/include", |
| ] |
| } |
| |
| # Common pieces. |
| source_set("common") { |
| visibility = [ ":*" ] |
| sources = [ |
| "event_vthread.cc", |
| ] |
| deps = [ |
| "$zx/system/ulib/zircon", |
| ] |
| public_configs = [ ":library_headers_config" ] |
| } |
| |
| # The default version for the normal case. |
| zx_library("trace-vthread") { |
| sdk = "static" |
| sdk_headers = [ |
| "trace-vthread/internal/event_vthread.h", |
| "trace-vthread/event_vthread.h", |
| ] |
| sources = [] |
| public_deps = [ |
| # <trace-vthread/internal/event_vthread.h> has #include <trace/event_args.h>. |
| "$zx/system/ulib/trace:headers", |
| |
| # <trace-vthread/internal/event_vthread.h> has #include <trace-engine/instrumentation.h>. |
| "$zx/system/ulib/trace-engine:headers", |
| ] |
| deps = [ |
| ":common", |
| "$zx/system/ulib/trace", |
| ] |
| } |
| |
| # A special version for programs and shared libraries that can't use |
| # libtrace-engine.so. |
| # N.B. Please verify that you really need this before using it. |
| # Generally you DON'T want to use this. |
| zx_library("trace-vthread-with-static-engine") { |
| sdk = "static" |
| sdk_headers = [ |
| "trace-vthread/internal/event_vthread.h", |
| "trace-vthread/event_vthread.h", |
| ] |
| sources = [] |
| public_deps = [ |
| # <trace-vthread/internal/event_vthread.h> has #include <trace/event_args.h>. |
| "$zx/system/ulib/trace:trace-with-static-engine.headers", |
| |
| # <trace-vthread/internal/event_vthread.h> has #include <trace-engine/instrumentation.h>. |
| "$zx/system/ulib/trace-engine:trace-engine-static.headers", |
| ] |
| deps = [ |
| ":common", |
| "$zx/system/ulib/trace:trace-with-static-engine", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":trace-vthread-test", |
| ":trace-vthread-with-static-engine-test", |
| ] |
| } |
| |
| # Common pieces of the unittest. |
| source_set("test-common") { |
| testonly = true |
| visibility = [ ":*" ] |
| sources = [ |
| "event_vthread_tests.cc", |
| ] |
| deps = [ |
| "$zx/system/ulib/async", |
| "$zx/system/ulib/async:async-cpp", |
| "$zx/system/ulib/async:async-default", |
| "$zx/system/ulib/async-loop", |
| "$zx/system/ulib/async-loop:async-loop-cpp", |
| "$zx/system/ulib/async-loop:async-loop-default.static", |
| "$zx/system/ulib/fbl", |
| "$zx/system/ulib/fdio", |
| "$zx/system/ulib/trace", |
| "$zx/system/ulib/trace-provider:trace-handler", |
| "$zx/system/ulib/trace-reader", |
| "$zx/system/ulib/trace-test-utils", |
| "$zx/system/ulib/trace-vthread", |
| "$zx/system/ulib/unittest", |
| "$zx/system/ulib/zircon", |
| "$zx/system/ulib/zx", |
| ] |
| } |
| |
| # The unittest for the default case of dynamically linked trace-engine. |
| zx_test("trace-vthread-test") { |
| deps = [ |
| ":test-common", |
| "$zx/system/ulib/trace-engine", |
| ] |
| } |
| |
| # The unittest with a static trace-engine. |
| zx_test("trace-vthread-with-static-engine-test") { |
| deps = [ |
| ":test-common", |
| "$zx/system/ulib/trace-engine:trace-engine-static", |
| ] |
| } |