Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 1 | # Copyright 2020 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
Armando Montanez | fb3d3fb | 2020-06-09 18:12:12 -0700 | [diff] [blame] | 15 | import("//build_overrides/pigweed.gni") |
| 16 | |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 17 | import("$dir_pw_build/facade.gni") |
| 18 | import("$dir_pw_docgen/docs.gni") |
| 19 | import("$dir_pw_unit_test/test.gni") |
Armando Montanez | 8104e8f | 2021-03-06 15:09:52 -0800 | [diff] [blame^] | 20 | import("backend.gni") |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 21 | |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 22 | config("default_config") { |
| 23 | include_dirs = [ "public" ] |
| 24 | } |
| 25 | |
| 26 | pw_facade("pw_trace") { |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 27 | backend = pw_trace_BACKEND |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 28 | public_configs = [ ":default_config" ] |
| 29 | public = [ |
| 30 | "public/pw_trace/internal/trace_internal.h", |
| 31 | "public/pw_trace/trace.h", |
| 32 | ] |
| 33 | deps = [ dir_pw_preprocessor ] |
| 34 | } |
| 35 | |
| 36 | pw_test_group("tests") { |
| 37 | tests = [ ":trace_facade_test" ] |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 38 | if (pw_trace_BACKEND != "") { |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 39 | tests += [ ":trace_backend_compile_test" ] |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | pw_test("trace_facade_test") { |
| 44 | configs = [ ":default_config" ] |
| 45 | sources = [ "trace_facade_test.cc" ] |
| 46 | public = [ |
| 47 | "public/pw_trace/internal/trace_internal.h", |
| 48 | "public/pw_trace/trace.h", |
| 49 | "pw_trace_test/fake_backend.h", |
| 50 | "pw_trace_test/public_overrides/pw_trace_backend/trace_backend.h", |
| 51 | ] |
| 52 | include_dirs = [ |
| 53 | "pw_trace_test", |
| 54 | "pw_trace_test/public_overrides", |
| 55 | ] |
| 56 | } |
| 57 | |
| 58 | pw_test("trace_backend_compile_test") { |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 59 | enable_if = pw_trace_BACKEND != "" |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 60 | |
| 61 | deps = [ |
| 62 | ":pw_trace", |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 63 | pw_trace_BACKEND, |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 64 | ] |
| 65 | |
| 66 | sources = [ |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 67 | "trace_backend_compile_test.cc", |
Armando Montanez | ccc3ee1 | 2020-06-11 16:36:11 -0700 | [diff] [blame] | 68 | "trace_backend_compile_test_c.c", |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 69 | ] |
| 70 | } |
| 71 | |
| 72 | pw_doc_group("docs") { |
| 73 | sources = [ "docs.rst" ] |
| 74 | } |
Robert Oliver | 70b9264 | 2020-07-13 15:04:10 -0400 | [diff] [blame] | 75 | |
| 76 | config("trace_sample_app_config") { |
| 77 | include_dirs = [ "example/public" ] |
| 78 | } |
| 79 | |
| 80 | # The trace sample app produces a variety of different trace events to help |
| 81 | # understand tracing. |
| 82 | pw_source_set("trace_sample_app") { |
| 83 | deps = [ ":pw_trace" ] |
| 84 | public_deps = [ "$dir_pw_ring_buffer" ] |
| 85 | sources = [ "example/sample_app.cc" ] |
| 86 | public_configs = [ ":trace_sample_app_config" ] |
| 87 | public = [ "example/public/pw_trace/example/sample_app.h" ] |
| 88 | } |
| 89 | |
| 90 | # Builds the trace sample app with whichever backend is connected |
| 91 | pw_executable("trace_example_basic") { |
| 92 | deps = [ |
| 93 | ":trace_sample_app", |
| 94 | "$dir_pw_log", |
| 95 | ] |
| 96 | sources = [ "example/basic.cc" ] |
| 97 | } |