xref: /aosp_15_r20/external/pigweed/pw_elf/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 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_docgen/docs.gni")
18import("$dir_pw_unit_test/test.gni")
19
20config("public_include_path") {
21  include_dirs = [ "public" ]
22  visibility = [ ":*" ]
23}
24
25pw_source_set("reader") {
26  public_configs = [ ":public_include_path" ]
27  sources = [ "reader.cc" ]
28  public = [
29    "public/pw_elf/internal/elf.h",
30    "public/pw_elf/internal/reader_impl.h",
31    "public/pw_elf/internal/stream_utils.h",
32    "public/pw_elf/reader.h",
33  ]
34  public_deps = [
35    dir_pw_assert,
36    dir_pw_bytes,
37    dir_pw_log,
38    dir_pw_result,
39    dir_pw_status,
40    dir_pw_stream,
41  ]
42}
43
44pw_test("reader_test") {
45  enable_if = current_os == "linux"
46  sources = [ "reader_test.cc" ]
47  defines =
48      [ "TEST_ELF_FILE_PATH=\"" +
49        rebase_path("$dir_pw_tokenizer/py/elf_reader_test_binary.elf") + "\"" ]
50  inputs = [
51    # TODO(jrreinhart): Move this file to this module.
52    "$dir_pw_tokenizer/py/elf_reader_test_binary.elf",
53  ]
54  deps = [
55    ":reader",
56    "$dir_pw_bytes",
57    "$dir_pw_stream",
58    "$dir_pw_stream:std_file_stream",
59  ]
60}
61
62pw_test_group("tests") {
63  tests = [ ":reader_test" ]
64}
65
66pw_doc_group("docs") {
67  inputs = [ "examples/reader.cc" ]
68  sources = [ "docs.rst" ]
69}
70