1# Copyright (c) 2023 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/ohos.gni")
14
15# NOSORT
16import("../../../camera.gni")
17
18# NOSORT
19import("//build/config/components/hdi/hdi.gni")
20import("$hdf_fwk_path/tools/hc-gen/hc_gen.gni")
21import("../camera_usb.gni")
22hc_gen_c("generate_source") {
23  sources = [
24    "./pipeline_core/config.hcs",
25    "./pipeline_core/params.hcs",
26  ]
27}
28
29action("copy_source") {
30  script = "/usr/bin/env"
31  outputs = [ "$target_out_dir/tmp.c" ]  # no use, just for gn complains
32  args = [
33    "cp",
34    "-f",
35  ]
36  args += rebase_path(get_target_outputs(":generate_source"))
37  args += [ rebase_path(
38          "$camera_path_usb/pipeline_core/pipeline_impl/src/strategy/config/") ]
39  deps = [ ":generate_source" ]
40}
41
42ohos_prebuilt_etc("config.c") {
43  deps = [ ":copy_source" ]
44  source = "$camera_path_usb/pipeline_core/pipeline_impl/src/strategy/config/config.c"
45  exec_script(
46      "/usr/bin/env",
47      [
48        "touch",
49        rebase_path(
50            "$camera_path_usb/pipeline_core/pipeline_impl/src/strategy/config/config.c"),
51      ])
52  subsystem_name = "hdf"
53  part_name = "drivers_peripheral_camera"
54}
55
56ohos_prebuilt_etc("params.c") {
57  deps = [ ":copy_source" ]
58  source = "$camera_path_usb/pipeline_core/pipeline_impl/src/strategy/config/params.c"
59  exec_script(
60      "/usr/bin/env",
61      [
62        "touch",
63        rebase_path(
64            "$camera_path_usb/pipeline_core/pipeline_impl/src/strategy/config/params.c"),
65      ])
66  subsystem_name = "hdf"
67  part_name = "drivers_peripheral_camera"
68}
69
70hc_gen("build_ipp_algo_config") {
71  sources = [ rebase_path("./pipeline_core/ipp_algo_config.hcs") ]
72}
73
74ohos_prebuilt_etc("ipp_algo_config.hcb") {
75  deps = [ ":build_ipp_algo_config" ]
76  hcs_outputs = get_target_outputs(":build_ipp_algo_config")
77  source = hcs_outputs[0]
78  relative_install_dir = "hdfconfig"
79  install_images = [ chipset_base_dir ]
80  subsystem_name = "hdf"
81  part_name = "drivers_peripheral_camera"
82}
83
84config("example_config") {
85  visibility = [ ":*" ]
86
87  cflags = [
88    "-Wno-error",
89    "-Wno-unused-function",
90    "-Wno-unused-parameter",
91  ]
92}
93
94group("chipset_build") {
95  public_deps = [
96    ":config.c",
97    ":ipp_algo_config.hcb",
98    ":params.c",
99    "$camera_path_usb/adapter/platform/v4l2/src/driver_adapter:usb_camera_v4l2_adapter",
100  ]
101}
102