1# Copyright (c) 2021 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.
13import("//build/lite/config/component/lite_component.gni")
14
15copy("kws_model") {
16  sources = [
17    "model/keyword_spotting.wk",
18    "model/kws_mean.txt",
19    "model/kws_std.txt",
20  ]
21  outputs = [ "$root_out_dir/data/{{source_file_part}}" ]
22}
23
24lite_library("asr_keyword_spotting") {
25  target_type = "shared_library"
26  sources = [ "source/kws_plugin.cpp" ]
27  cflags = [ "-fPIC" ]
28  cflags_cc = cflags
29  include_dirs = [
30    "include",
31    "//foundation/ai/ai_engine/interfaces",
32    "//foundation/ai/ai_engine/interfaces/kits",
33    "//foundation/ai/ai_engine/interfaces/kits/asr",
34    "//foundation/ai/ai_engine/services/common",
35    "//foundation/ai/ai_engine/services/common/utils/encdec/include",
36    "//foundation/ai/ai_engine/services/common/platform/os_wrapper/engine_hal/interfaces",
37    "//foundation/ai/ai_engine/services/common/platform/os_wrapper",
38    "//foundation/ai/ai_engine/services/common/protocol/struct_definition",
39    "//foundation/ai/ai_engine/services/common/protocol/retcode_inner",
40    "//foundation/ai/ai_engine/services/common/protocol/plugin_config",
41    "//foundation/ai/ai_engine/services/common/utils/log",
42    "//foundation/ai/ai_engine/services/common/platform/os_wrapper/feature/interfaces",
43    "//foundation/ai/ai_engine/services/common/platform/os_wrapper/utils",
44    "//foundation/ai/ai_engine/services/server",
45  ]
46  ldflags = [ "-lstdc++" ]
47  ldflags += [ "-lnnie" ]
48  ldflags += [ "-lmpi" ]
49  ldflags += [ "-lnnie_adapter" ]
50  defines = [ "USE_NNIE" ]
51  deps = [
52    "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
53    "//device/soc/hisilicon/common/hal/ai:engine_nnie_sdk",
54    "//foundation/ai/ai_engine/services/common/platform/os_wrapper/feature:norm_processor_dep",
55    "//foundation/ai/ai_engine/services/common/platform/os_wrapper/feature:slide_window_processor_dep",
56    "//foundation/ai/ai_engine/services/common/platform/os_wrapper/utils:plugin_helper",
57    "//foundation/ai/ai_engine/services/common/protocol/data_channel:data_channel",
58    "//foundation/ai/ai_engine/services/common/utils/encdec:encdec",
59    "//third_party/bounds_checking_function:libsec_shared",
60  ]
61}
62