# Copyright (c) 2021 - 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("../../camera.gni")

if (defined(ohos_lite)) {
  import("//build/ohos.gni")
  import("../../../../hdf_core/adapter/uhdf/uhdf.gni")

  config("ohos_camera_demo_config") {
    visibility = [ ":*" ]

    cflags_cc = [
      "-Wno-error",
      "-std=c++17",
    ]
  }

  ohos_executable("ohos_camera_demo") {
    output_extension = "bin"
    sources = [
      "$camera_path/../../test/common/callback/src/camera_device_callback.cpp",
      "$camera_path/../../test/common/callback/src/camera_host_callback.cpp",
      "$camera_path/../../test/common/callback/src/stream_operator_callback.cpp",
      "./demo_main.cpp",
      "./ohos_camera_demo.cpp",
      "./stream_customer.cpp",
    ]
    include_dirs = [
      "./include",
      "$camera_path/../../interfaces/include",
      "$camera_path/../../interfaces/hdi_passthrough",
      "$camera_path/../../test/common/callback/include",
      "$camera_path/include",
      "$camera_path/../v4l2",
      "$camera_path/../v4l2/include",
      "$camera_path/../v4l2/include/camera_host",
      "$camera_path/../v4l2/include/camera_device",
      "$camera_path/../v4l2/include/stream_operator",
      "$camera_path/../v4l2/src/stream_operator/stream_tunnel/lite",
      "$camera_path/../v4l2/include/offline_stream_operator",
      "$camera_path/device_manager/include/",
      "$camera_path/device_manager/include/mpi",
      "$camera_path/utils/event",
      "$camerc_path/../../display/interfaces/include",
      "$camerc_path/../../base",

      #producer
      "$camera_path/pipeline_core/utils",
      "$camera_path/pipeline_core/include",
      "$camera_path/pipeline_core/host_stream/include",
      "$camera_path/pipeline_core/nodes/include",
      "$camera_path/pipeline_core/nodes/src/node_base",
      "$camera_path/pipeline_core/nodes/src/dummy_node",
      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
      "$camera_path/pipeline_core/pipeline_impl/include",
      "$camera_path/pipeline_core/pipeline_impl/src",
      "$camera_path/pipeline_core/pipeline_impl/src/builder",
      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
      "$camera_path/pipeline_core/pipeline_impl/src/parser",
      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
      "$camera_path/pipeline_core/ipp/include",
      "$board_camera_path/demo/include",
    ]

    deps = [ "$camera_path/../v4l2:camera_host_service_1.0" ]
    external_deps = [
      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
      "drivers_interface_camera:metadata",
      "graphic_surface:surface",
      "hdf_core:libhdf_utils",
      "hilog_lite:hilog_shared",
    ]
    public_configs = [ ":ohos_camera_demo_config" ]
    install_enable = false
    subsystem_name = "hdf"
    part_name = "drivers_peripheral_camera"
  }
} else {
  import("//build/ohos.gni")
  import("../../../../hdf_core/adapter/uhdf2/uhdf.gni")

  config("ohos_camera_demo_config") {
    visibility = [ ":*" ]
    cflags_cc = [
      "-Wno-error",
      "-std=c++17",
    ]
  }

  ohos_executable("ohos_camera_demo") {
    install_enable = false
    sources = [
      "./demo_main.cpp",
      "./ohos_camera_demo.cpp",
      "./stream_customer.cpp",
    ]

    include_dirs = [
      "./include",
      "$camera_path/../../interfaces/include",
      "$camera_path/../../interfaces/hdi_ipc",
      "$camera_path/../../interfaces/hdi_ipc/utils/include",
      "$camera_path/../../test/common/callback/include",
      "$camera_path/include",
      "$camera_path/device_manager/include/",
      "$camera_path/device_manager/include/mpi",
      "$camera_path/utils/event",
      "$board_camera_path/demo/include",

      #producer
      "$camera_path/pipeline_core/utils",
      "$camera_path/pipeline_core/include",
      "$camera_path/pipeline_core/host_stream/include",
      "$camera_path/pipeline_core/nodes/include",
      "$camera_path/pipeline_core/nodes/src/node_base",
      "$camera_path/pipeline_core/nodes/src/dummy_node",
      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config",
      "$camera_path/pipeline_core/pipeline_impl/include",
      "$camera_path/pipeline_core/pipeline_impl/src",
      "$camera_path/pipeline_core/pipeline_impl/src/builder",
      "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
      "$camera_path/pipeline_core/pipeline_impl/src/parser",
      "$camera_path/pipeline_core/pipeline_impl/src/strategy",
      "$camera_path/pipeline_core/ipp/include",
    ]

    deps = [ "$camera_path/../../hdi_service/v1_0:camera_host_service_1.0" ]

    if (is_standard_system) {
      external_deps = [
        "c_utils:utils",
        "hdf_core:libhdf_host",
        "hdf_core:libhdf_ipc_adapter",
        "hdf_core:libhdf_utils",
        "hdf_core:libhdi",
        "hilog:libhilog",
        "samgr:samgr_proxy",
      ]
    } else {
      external_deps = [ "hilog:libhilog" ]
    }

    external_deps += [
      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
      "drivers_interface_camera:libcamera_proxy_1.0",
      "drivers_interface_camera:metadata",
      "graphic_surface:surface",
      "ipc:ipc_single",
      "samgr:samgr_proxy",
    ]

    public_configs = [ ":ohos_camera_demo_config" ]
    install_enable = false
    install_images = [ chipset_base_dir ]
    subsystem_name = "hdf"
    part_name = "drivers_peripheral_camera"
  }
}