• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15
16config("nnrt_config") {
17  cflags_cc = [ "-fexceptions" ]
18  include_dirs = [
19    "..",
20    "../interfaces/innerkits/c",
21  ]
22}
23
24nnrt_sources = [
25  "native/compilation.cpp",
26  "native/device_discover_v1_0.cpp",
27  "native/device_discover_v2_0.cpp",
28  "native/device_manager.cpp",
29  "native/device_registrar.cpp",
30  "native/execution_plan.cpp",
31  "native/executor.cpp",
32  "native/hdi_device_v1_0.cpp",
33  "native/hdi_device_v2_0.cpp",
34  "native/hdi_prepared_model_v1_0.cpp",
35  "native/hdi_prepared_model_v2_0.cpp",
36  "native/inner_model.cpp",
37  "native/memory_manager.cpp",
38  "native/neural_network_runtime.cpp",
39  "native/nn_tensor.cpp",
40  "native/ops_builder.cpp",
41  "native/ops_registry.cpp",
42  "native/transform.cpp",
43  "native/validation.cpp",
44]
45
46ops_sources = [
47  "native/ops/add_builder.cpp",
48  "native/ops/argmax_builder.cpp",
49  "native/ops/avgpool_builder.cpp",
50  "native/ops/batch_to_space_nd_builder.cpp",
51  "native/ops/batchnorm_builder.cpp",
52  "native/ops/bias_add_builder.cpp",
53  "native/ops/cast_builder.cpp",
54  "native/ops/concat_builder.cpp",
55  "native/ops/conv2d_builder.cpp",
56  "native/ops/conv2d_transpose_builder.cpp",
57  "native/ops/depthwise_conv2d_native_builder.cpp",
58  "native/ops/div_builder.cpp",
59  "native/ops/eltwise_builder.cpp",
60  "native/ops/expandims_builder.cpp",
61  "native/ops/fill_builder.cpp",
62  "native/ops/fullconnection_builder.cpp",
63  "native/ops/gather_builder.cpp",
64  "native/ops/gelu_builder.cpp",
65  "native/ops/hswish_builder.cpp",
66  "native/ops/layernorm_builder.cpp",
67  "native/ops/lessequal_builder.cpp",
68  "native/ops/matmul_builder.cpp",
69  "native/ops/maximum_builder.cpp",
70  "native/ops/maxpool_builder.cpp",
71  "native/ops/mul_builder.cpp",
72  "native/ops/onehot_builder.cpp",
73  "native/ops/pad_builder.cpp",
74  "native/ops/pooling_builder.cpp",
75  "native/ops/pow_builder.cpp",
76  "native/ops/prelu_builder.cpp",
77  "native/ops/quant_dtype_cast_builder.cpp",
78  "native/ops/reduceall_builder.cpp",
79  "native/ops/reducemean_builder.cpp",
80  "native/ops/reduceprod_builder.cpp",
81  "native/ops/relu6_builder.cpp",
82  "native/ops/relu_builder.cpp",
83  "native/ops/reshape_builder.cpp",
84  "native/ops/resize_bilinear_builder.cpp",
85  "native/ops/rsqrt_builder.cpp",
86  "native/ops/scale_builder.cpp",
87  "native/ops/shape_builder.cpp",
88  "native/ops/sigmoid_builder.cpp",
89  "native/ops/slice_builder.cpp",
90  "native/ops/softmax_builder.cpp",
91  "native/ops/space_to_batch_nd_builder.cpp",
92  "native/ops/split_builder.cpp",
93  "native/ops/sqrt_builder.cpp",
94  "native/ops/squared_difference_builder.cpp",
95  "native/ops/squeeze_builder.cpp",
96  "native/ops/stack_builder.cpp",
97  "native/ops/strided_slice_builder.cpp",
98  "native/ops/sub_builder.cpp",
99  "native/ops/tanh_builder.cpp",
100  "native/ops/tile_builder.cpp",
101  "native/ops/top_k_builder.cpp",
102  "native/ops/transpose_builder.cpp",
103  "native/ops/unsqueeze_builder.cpp",
104]
105
106ohos_shared_library("libneural_network_runtime") {
107  sources = nnrt_sources
108  sources += ops_sources
109  include_dirs = [
110    "..",
111    "//third_party/mindspore/mindspore-src/source/mindspore/lite/mindir/include",
112  ]
113
114  install_images = [
115    "system",
116    "updater",
117  ]
118
119  public_configs = [ ":nnrt_config" ]
120  all_dependent_configs = [ ":nnrt_config" ]
121
122  external_deps = [
123    "c_utils:utils",
124    "drivers_interface_nnrt:libnnrt_proxy_1.0",
125    "drivers_interface_nnrt:libnnrt_proxy_2.0",
126    "hdf_core:libhdf_utils",
127    "hilog:libhilog",
128    "hitrace:libhitracechain",
129    "mindspore:mindir",
130  ]
131
132  subsystem_name = "ai"
133  innerapi_tags = [ "platformsdk_indirect" ]
134  part_name = "neural_network_runtime"
135}
136