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") |
Wyatt Hepler | d49f8fe | 2020-10-15 10:13:47 -0700 | [diff] [blame] | 20 | |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 21 | declare_args() { |
| 22 | # Backend for the pw_trace module. |
| 23 | pw_trace_BACKEND = "" |
| 24 | } |
| 25 | |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 26 | config("default_config") { |
| 27 | include_dirs = [ "public" ] |
| 28 | } |
| 29 | |
| 30 | pw_facade("pw_trace") { |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 31 | backend = pw_trace_BACKEND |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 32 | public_configs = [ ":default_config" ] |
| 33 | public = [ |
| 34 | "public/pw_trace/internal/trace_internal.h", |
| 35 | "public/pw_trace/trace.h", |
| 36 | ] |
| 37 | deps = [ dir_pw_preprocessor ] |
| 38 | } |
| 39 | |
| 40 | pw_test_group("tests") { |
| 41 | tests = [ ":trace_facade_test" ] |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 42 | if (pw_trace_BACKEND != "") { |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 43 | tests += [ ":trace_backend_compile_test" ] |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | pw_test("trace_facade_test") { |
| 48 | configs = [ ":default_config" ] |
| 49 | sources = [ "trace_facade_test.cc" ] |
| 50 | public = [ |
| 51 | "public/pw_trace/internal/trace_internal.h", |
| 52 | "public/pw_trace/trace.h", |
| 53 | "pw_trace_test/fake_backend.h", |
| 54 | "pw_trace_test/public_overrides/pw_trace_backend/trace_backend.h", |
| 55 | ] |
| 56 | include_dirs = [ |
| 57 | "pw_trace_test", |
| 58 | "pw_trace_test/public_overrides", |
| 59 | ] |
| 60 | } |
| 61 | |
| 62 | pw_test("trace_backend_compile_test") { |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 63 | enable_if = pw_trace_BACKEND != "" |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 64 | |
| 65 | deps = [ |
| 66 | ":pw_trace", |
Alexei Frolov | 4c0428a | 2020-06-10 10:46:04 -0700 | [diff] [blame] | 67 | pw_trace_BACKEND, |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 68 | ] |
| 69 | |
| 70 | sources = [ |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 71 | "trace_backend_compile_test.cc", |
Armando Montanez | ccc3ee1 | 2020-06-11 16:36:11 -0700 | [diff] [blame] | 72 | "trace_backend_compile_test_c.c", |
Robert Oliver | d1323f4 | 2020-04-27 12:05:16 -0400 | [diff] [blame] | 73 | ] |
| 74 | } |
| 75 | |
| 76 | pw_doc_group("docs") { |
| 77 | sources = [ "docs.rst" ] |
| 78 | } |
Robert Oliver | 70b9264 | 2020-07-13 15:04:10 -0400 | [diff] [blame] | 79 | |
| 80 | config("trace_sample_app_config") { |
| 81 | include_dirs = [ "example/public" ] |
| 82 | } |
| 83 | |
| 84 | # The trace sample app produces a variety of different trace events to help |
| 85 | # understand tracing. |
| 86 | pw_source_set("trace_sample_app") { |
| 87 | deps = [ ":pw_trace" ] |
| 88 | public_deps = [ "$dir_pw_ring_buffer" ] |
| 89 | sources = [ "example/sample_app.cc" ] |
| 90 | public_configs = [ ":trace_sample_app_config" ] |
| 91 | public = [ "example/public/pw_trace/example/sample_app.h" ] |
| 92 | } |
| 93 | |
| 94 | # Builds the trace sample app with whichever backend is connected |
| 95 | pw_executable("trace_example_basic") { |
| 96 | deps = [ |
| 97 | ":trace_sample_app", |
| 98 | "$dir_pw_log", |
| 99 | ] |
| 100 | sources = [ "example/basic.cc" ] |
| 101 | } |