xref: /aosp_15_r20/external/openscreen/build/config/data_headers_template.gni (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1# Copyright 2020 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# This template takes an input list of files, and copies their contents
6# into C++ header files as constexpr char[] raw strings with variable names
7# taken directly from the original file name.
8
9# The root directory must be defined outside of the template for use while
10# embedded.
11openscreen_root = rebase_path("../../", "//")
12
13template("data_headers") {
14  action_foreach(target_name) {
15    forward_variables_from(invoker,
16                           [
17                             "namespace",
18                             "sources",
19                             "testonly",
20                           ])
21    script = "//${openscreen_root}/tools/convert_to_data_file.py"
22    outputs = [ "{{source_gen_dir}}/{{source_name_part}}_data.h" ]
23    args = [
24      namespace,
25      "{{source}}",
26      "{{source_gen_dir}}/{{source_name_part}}_data.h",
27    ]
28  }
29}
30