xref: /aosp_15_r20/external/tensorflow/third_party/hexagon/BUILD (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://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,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15
16package(default_visibility = [
17    "//visibility:public",
18])
19
20licenses([
21    "notice",  # BSD-3-Clause-Clear
22])
23
24exports_files(glob(["hexagon/**/*.so"]))
25
26#Just header file, needed for data types in the interface.
27cc_library(
28    name = "hexagon_nn_header",
29    hdrs = [
30        "@hexagon_nn//:hexagon/hexagon_nn.h",
31    ],
32    tags = [
33        "manual",
34        "nobuilder",
35    ],
36)
37
38cc_library(
39    name = "hexagon_nn_ops",
40    hdrs = [
41        "@hexagon_nn//:hexagon/hexagon_nn_ops.h",
42        "@hexagon_nn//:hexagon/ops.def",
43    ],
44    tags = [
45        "manual",
46        "nobuilder",
47    ],
48)
49
50cc_library(
51    name = "remote",
52    hdrs = [
53        "@hexagon_nn//:hexagon/remote.h",
54        "@hexagon_nn//:hexagon/remote64.h",
55    ],
56    tags = [
57        "manual",
58        "nobuilder",
59    ],
60)
61
62cc_library(
63    name = "rpcmem",
64    srcs = [
65        "@hexagon_nn//:hexagon/rpcmem_stub.c",
66    ],
67    hdrs = [
68        "@hexagon_nn//:hexagon/rpcmem.h",
69    ],
70    deps = [
71        ":AEEStdDef",
72    ],
73)
74
75cc_library(
76    name = "hexagon_soc",
77    hdrs = [
78        "@hexagon_nn//:hexagon/hexnn_soc_defines.h",
79    ],
80    tags = [
81        "manual",
82        "nobuilder",
83    ],
84)
85
86cc_library(
87    name = "AEEStdDef",
88    hdrs = [
89        "@hexagon_nn//:hexagon/AEEStdDef.h",
90    ],
91    tags = [
92        "manual",
93        "nobuilder",
94    ],
95)
96
97cc_library(
98    name = "AEEStdErr",
99    hdrs = [
100        "@hexagon_nn//:hexagon/AEEStdErr.h",
101    ],
102)
103
104# The files are included in another .c files, so we add the src files as textual_hdrs
105# to avoid compiling them and have linking errors for multiple symbols.
106cc_library(
107    name = "hexagon_stub",
108    textual_hdrs = [
109        "@hexagon_nn//:hexagon/hexagon_nn_domains_stub.c",
110        "@hexagon_nn//:hexagon/hexagon_nn_stub.c",
111    ],
112)
113
114# This rule uses the smart/graph wrapper interfaces.
115cc_library(
116    name = "hexagon_nn",
117    srcs = [
118        "@hexagon_nn//:hexagon/hexagon_nn.h",
119        "@hexagon_nn//:hexagon/hexnn_dsp_api.h",
120        "@hexagon_nn//:hexagon/hexnn_dsp_api_impl.c",
121        "@hexagon_nn//:hexagon/hexnn_dsp_domains_api.h",
122        "@hexagon_nn//:hexagon/hexnn_dsp_domains_api_impl.c",
123        "@hexagon_nn//:hexagon/hexnn_dsp_smart_wrapper_api.c",
124        "@hexagon_nn//:hexagon/hexnn_dsp_smart_wrapper_api.h",
125        "@hexagon_nn//:hexagon/hexnn_graph_wrapper.cpp",
126        "@hexagon_nn//:hexagon/hexnn_graph_wrapper.hpp",
127        "@hexagon_nn//:hexagon/hexnn_graph_wrapper_interface.h",
128        "@hexagon_nn//:hexagon/hexnn_soc_defines.h",
129    ],
130    deps = [
131        ":AEEStdErr",
132        ":hexagon_stub",
133        ":remote",
134        ":rpcmem",
135    ],
136    alwayslink = 1,
137)
138