xref: /aosp_15_r20/external/pigweed/pw_stream_uart_mcuxpresso/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2023 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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/target_types.gni")
18import("$dir_pw_docgen/docs.gni")
19import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni")
20import("$dir_pw_unit_test/test.gni")
21
22config("default_config") {
23  include_dirs = [ "public" ]
24}
25
26if (pw_third_party_mcuxpresso_SDK != "") {
27  pw_source_set("pw_stream_uart_mcuxpresso") {
28    public_configs = [ ":default_config" ]
29    public = [ "public/pw_stream_uart_mcuxpresso/stream.h" ]
30    public_deps = [
31      "$dir_pw_clock_tree",
32      "$dir_pw_stream",
33    ]
34    deps = [ pw_third_party_mcuxpresso_SDK ]
35    sources = [ "stream.cc" ]
36  }
37
38  pw_source_set("pw_stream_uart_interrupt_safe_writer_mcuxpresso") {
39    public_configs = [ ":default_config" ]
40    public = [ "public/pw_stream_uart_mcuxpresso/interrupt_safe_writer.h" ]
41    public_deps = [
42      "$dir_pw_clock_tree",
43      "$dir_pw_status",
44      "$dir_pw_stream",
45    ]
46    deps = [ pw_third_party_mcuxpresso_SDK ]
47    sources = [ "interrupt_safe_writer.cc" ]
48  }
49
50  pw_test("stream_test") {
51    enable_if =
52        pw_third_party_mcuxpresso_SDK ==
53        "//targets/mimxrt595_evk_freertos:sdk" &&
54        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
55         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
56         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
57    sources = [ "stream_test.cc" ]
58    deps = [
59      ":pw_stream_uart_mcuxpresso",
60      "//targets/mimxrt595_evk_freertos:sdk",
61    ]
62  }
63
64  pw_test("stream_example") {
65    enable_if =
66        pw_third_party_mcuxpresso_SDK ==
67        "//targets/mimxrt595_evk_freertos:sdk" &&
68        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
69         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
70         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
71    sources = [ "stream_example.cc" ]
72    deps = [
73      ":pw_stream_uart_mcuxpresso",
74      "//targets/mimxrt595_evk_freertos:sdk",
75    ]
76  }
77
78  pw_test("interrupt_safe_writer_example") {
79    enable_if =
80        pw_third_party_mcuxpresso_SDK ==
81        "//targets/mimxrt595_evk_freertos:sdk" &&
82        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
83         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
84         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
85    public_configs = [ "//pw_build:cpp20" ]
86    sources = [ "interrupt_safe_writer_example.cc" ]
87    deps = [
88      ":pw_stream_uart_interrupt_safe_writer_mcuxpresso",
89      "//targets/mimxrt595_evk_freertos:sdk",
90    ]
91  }
92
93  pw_test_group("tests") {
94    tests = [
95      ":stream_test",
96      ":stream_example",
97      ":interrupt_safe_writer_example",
98    ]
99  }
100} else {
101  pw_test_group("tests") {
102    tests = []
103  }
104}
105
106pw_doc_group("docs") {
107  inputs = [
108    "stream_example.cc",
109    "interrupt_safe_writer_example.cc",
110  ]
111  sources = [ "docs.rst" ]
112}
113