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} 19 20nnrt_sources = [ 21 "native/device_manager.cpp", 22 "native/device_registrar.cpp", 23 "native/hdi_device.cpp", 24 "native/hdi_prepared_model.cpp", 25 "native/memory_manager.cpp", 26 "native/transform.cpp", 27 "native/nn_tensor.cpp", 28 "native/validation.cpp", 29 "native/inner_model.cpp", 30 "native/compilation.cpp", 31 "native/execution_plan.cpp", 32 "native/executor.cpp", 33 "native/neural_network_runtime.cpp", 34 "native/ops_builder.cpp", 35 "native/ops_registry.cpp", 36] 37 38ops_sources = [ 39 "native/ops/add_builder.cpp", 40 "native/ops/argmax_builder.cpp", 41 "native/ops/avgpool_builder.cpp", 42 "native/ops/pooling_builder.cpp", 43 "native/ops/batch_to_space_nd_builder.cpp", 44 "native/ops/bias_add_builder.cpp", 45 "native/ops/cast_builder.cpp", 46 "native/ops/concat_builder.cpp", 47 "native/ops/conv2d_builder.cpp", 48 "native/ops/conv2d_transpose_builder.cpp", 49 "native/ops/depthwise_conv2d_native_builder.cpp", 50 "native/ops/div_builder.cpp", 51 "native/ops/eltwise_builder.cpp", 52 "native/ops/expandims_builder.cpp", 53 "native/ops/fullconnection_builder.cpp", 54 "native/ops/maxpool_builder.cpp", 55 "native/ops/slice_builder.cpp", 56 "native/ops/softmax_builder.cpp", 57 "native/ops/space_to_batch_nd_builder.cpp", 58 "native/ops/split_builder.cpp", 59 "native/ops/sqrt_builder.cpp", 60 "native/ops/squared_difference_builder.cpp", 61 "native/ops/squeeze_builder.cpp", 62 "native/ops/stack_builder.cpp", 63 "native/ops/strided_slice_builder.cpp", 64 "native/ops/sub_builder.cpp", 65 "native/ops/tanh_builder.cpp", 66 "native/ops/tile_builder.cpp", 67 "native/ops/top_k_builder.cpp", 68 "native/ops/transpose_builder.cpp", 69 "native/ops/unsqueeze_builder.cpp", 70 "native/ops/batchnorm_builder.cpp", 71 "native/ops/fill_builder.cpp", 72 "native/ops/matmul_builder.cpp", 73 "native/ops/gather_builder.cpp", 74 "native/ops/gelu_builder.cpp", 75 "native/ops/hswish_builder.cpp", 76 "native/ops/layernorm_builder.cpp", 77 "native/ops/maximum_builder.cpp", 78 "native/ops/lessequal_builder.cpp", 79 "native/ops/mul_builder.cpp", 80 "native/ops/onehot_builder.cpp", 81 "native/ops/pad_builder.cpp", 82 "native/ops/pow_builder.cpp", 83 "native/ops/prelu_builder.cpp", 84 "native/ops/quant_dtype_cast_builder.cpp", 85 "native/ops/reduceall_builder.cpp", 86 "native/ops/reducemean_builder.cpp", 87 "native/ops/reduceprod_builder.cpp", 88 "native/ops/relu_builder.cpp", 89 "native/ops/relu6_builder.cpp", 90 "native/ops/reshape_builder.cpp", 91 "native/ops/resize_bilinear_builder.cpp", 92 "native/ops/rsqrt_builder.cpp", 93 "native/ops/scale_builder.cpp", 94 "native/ops/shape_builder.cpp", 95 "native/ops/sigmoid_builder.cpp", 96] 97 98ohos_shared_library("libneural_network_runtime") { 99 sources = nnrt_sources 100 sources += ops_sources 101 include_dirs = [ 102 "//commonlibrary/c_utils/base/include", 103 "//drivers/hdf_core/adapter/uhdf/posix/include", 104 "//drivers/hdf_core/adapter/uhdf2/include/hdi", 105 "//drivers/hdf_core/adapter/uhdf2/ipc/include", 106 "//drivers/hdf_core/framework/include/core", 107 "//drivers/hdf_core/framework/include/utils", 108 "//drivers/hdf_core/framework/core/common/include/host", 109 "//foundation/ai/neural_network_runtime", 110 "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", 111 "//third_party/googletest/googletest/include/gtest", 112 "//third_party/mindspore/mindspore/lite/mindir/include" 113 ] 114 115 install_images = [ 116 "system", 117 "updater" 118 ] 119 120 public_configs = [ ":nnrt_config" ] 121 122 external_deps = [ 123 "hilog_native:libhilog", 124 "hitrace_native:libhitracechain", 125 "c_utils:utils", 126 "hdf_core:libhdf_utils", 127 "drivers_interface_nnrt:libnnrt_proxy_1.0", 128 "mindspore:mindir" 129 ] 130 131 subsystem_name = "ai" 132 part_name = "neural_network_runtime" 133} 134