xref: /aosp_15_r20/external/pigweed/targets/docs/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 The Pigweed Authors
2*61c4878aSAndroid Build Coastguard Worker#
3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of
5*61c4878aSAndroid Build Coastguard Worker# the License at
6*61c4878aSAndroid Build Coastguard Worker#
7*61c4878aSAndroid Build Coastguard Worker#     https://www.apache.org/licenses/LICENSE-2.0
8*61c4878aSAndroid Build Coastguard Worker#
9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under
13*61c4878aSAndroid Build Coastguard Worker# the License.
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Workerimport("//build_overrides/pigweed.gni")
16*61c4878aSAndroid Build Coastguard Worker
17*61c4878aSAndroid Build Coastguard Workerimport("$dir_pigweed/targets/lm3s6965evb_qemu/target_toolchains.gni")
18*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_docgen/docs.gni")
19*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_log_tokenized/backend.gni")
20*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_protobuf_compiler/proto.gni")
21*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_third_party/nanopb/nanopb.gni")
22*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_toolchain/arm_gcc/toolchains.gni")
23*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_toolchain/generate_toolchain.gni")
24*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_toolchain/traits.gni")
25*61c4878aSAndroid Build Coastguard Worker
26*61c4878aSAndroid Build Coastguard Workerif (current_toolchain != default_toolchain) {
27*61c4878aSAndroid Build Coastguard Worker  pw_source_set("tokenized_log_handler") {
28*61c4878aSAndroid Build Coastguard Worker    deps = [
29*61c4878aSAndroid Build Coastguard Worker      "$dir_pw_bytes",
30*61c4878aSAndroid Build Coastguard Worker      "$dir_pw_log_tokenized:handler.facade",
31*61c4878aSAndroid Build Coastguard Worker      "$dir_pw_sys_io",
32*61c4878aSAndroid Build Coastguard Worker    ]
33*61c4878aSAndroid Build Coastguard Worker    sources = [ "tokenized_log_handler.cc" ]
34*61c4878aSAndroid Build Coastguard Worker  }
35*61c4878aSAndroid Build Coastguard Worker}
36*61c4878aSAndroid Build Coastguard Worker
37*61c4878aSAndroid Build Coastguard Worker# Toolchain for generating upstream Pigweed documentation.
38*61c4878aSAndroid Build Coastguard Workergenerate_toolchain("docs") {
39*61c4878aSAndroid Build Coastguard Worker  # Use the lm3s6965evb_qemu toolchain for pw_size_diff targets.
40*61c4878aSAndroid Build Coastguard Worker  _base_toolchain = pw_target_toolchain_lm3s6965evb_qemu.size_optimized_clang
41*61c4878aSAndroid Build Coastguard Worker  forward_variables_from(_base_toolchain,
42*61c4878aSAndroid Build Coastguard Worker                         "*",
43*61c4878aSAndroid Build Coastguard Worker                         [
44*61c4878aSAndroid Build Coastguard Worker                           "defaults",
45*61c4878aSAndroid Build Coastguard Worker                           "name",
46*61c4878aSAndroid Build Coastguard Worker                         ])
47*61c4878aSAndroid Build Coastguard Worker
48*61c4878aSAndroid Build Coastguard Worker  # Docs assume output binary location, and don't support extensions.
49*61c4878aSAndroid Build Coastguard Worker  final_binary_extension = ""
50*61c4878aSAndroid Build Coastguard Worker
51*61c4878aSAndroid Build Coastguard Worker  defaults = {
52*61c4878aSAndroid Build Coastguard Worker    forward_variables_from(_base_toolchain.defaults, "*")
53*61c4878aSAndroid Build Coastguard Worker
54*61c4878aSAndroid Build Coastguard Worker    # This is the docs target.
55*61c4878aSAndroid Build Coastguard Worker    pw_docgen_BUILD_DOCS = true
56*61c4878aSAndroid Build Coastguard Worker
57*61c4878aSAndroid Build Coastguard Worker    # Disable NC tests in case the base toolchain has them enabled.
58*61c4878aSAndroid Build Coastguard Worker    pw_compilation_testing_NEGATIVE_COMPILATION_ENABLED = false
59*61c4878aSAndroid Build Coastguard Worker
60*61c4878aSAndroid Build Coastguard Worker    pw_assert_BACKEND = dir_pw_assert_tokenized
61*61c4878aSAndroid Build Coastguard Worker    pw_log_BACKEND = dir_pw_log_tokenized
62*61c4878aSAndroid Build Coastguard Worker    pw_log_tokenized_HANDLER_BACKEND =
63*61c4878aSAndroid Build Coastguard Worker        get_path_info(":tokenized_log_handler", "abspath")
64*61c4878aSAndroid Build Coastguard Worker
65*61c4878aSAndroid Build Coastguard Worker    pw_toolchain_CXX_STANDARD = pw_toolchain_STANDARD.CXX20
66*61c4878aSAndroid Build Coastguard Worker
67*61c4878aSAndroid Build Coastguard Worker    pw_boot_cortex_m_LINK_CONFIG_DEFINES = []
68*61c4878aSAndroid Build Coastguard Worker    pw_boot_cortex_m_LINK_CONFIG_DEFINES = [
69*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_FLASH_BEGIN=0x00000200",
70*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_FLASH_SIZE=1000K",
71*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_HEAP_SIZE=0",
72*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_MIN_STACK_SIZE=1K",
73*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_RAM_BEGIN=0x20000000",
74*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_RAM_SIZE=1000K",
75*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_VECTOR_TABLE_BEGIN=0x00000000",
76*61c4878aSAndroid Build Coastguard Worker      "PW_BOOT_VECTOR_TABLE_SIZE=512",
77*61c4878aSAndroid Build Coastguard Worker    ]
78*61c4878aSAndroid Build Coastguard Worker
79*61c4878aSAndroid Build Coastguard Worker    pw_chrono_SYSTEM_CLOCK_BACKEND = "//pw_chrono_stl:system_clock"
80*61c4878aSAndroid Build Coastguard Worker    pw_chrono_SYSTEM_TIMER_BACKEND = "//pw_chrono_stl:system_timer"
81*61c4878aSAndroid Build Coastguard Worker    pw_async_TASK_BACKEND = "//pw_async_basic:task"
82*61c4878aSAndroid Build Coastguard Worker    pw_async_FAKE_DISPATCHER_BACKEND = "//pw_async_basic:fake_dispatcher"
83*61c4878aSAndroid Build Coastguard Worker  }
84*61c4878aSAndroid Build Coastguard Worker}
85*61c4878aSAndroid Build Coastguard Worker
86*61c4878aSAndroid Build Coastguard Workerpw_doc_group("target_docs") {
87*61c4878aSAndroid Build Coastguard Worker  sources = [ "target_docs.rst" ]
88*61c4878aSAndroid Build Coastguard Worker}
89