# Copyright (C) 2021 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("//build/ohos.gni")
import("//foundation/multimedia/image_framework/ide/image_decode_config.gni")
config("log_mock_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "include",
    "include/log",
  ]
}

ohos_static_library("log_mock_static") {
  if (!is_arkui_x) {
    branch_protector_ret = "pac_ret"
    sanitize = {
      cfi = true
      cfi_cross_dso = true
      cfi_vcall_icall_only = true
      debug = false
    }
  }
  configs = [ ":log_mock_config" ]
  sources = [
    "//foundation/multimedia/image_framework/mock/native/src/HiLog.cpp",
    "//foundation/multimedia/image_framework/mock/native/src/hitrace_meter.cpp",
  ]
  if (use_clang_ios || use_clang_android) {
    sources -= [ "$image_subsystem/mock/native/src/HiLog.cpp" ]
    deps = [ "$graphic_subsystem/rosen/modules/platform:hilog" ]
  }
  subsystem_name = "multimedia"
  part_name = "image_framework"
}

config("utils_mock_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "include",
    "//foundation/multimedia/image_framework/interfaces/innerkits/include",
  ]
}

ohos_static_library("utils_mock_static") {
  if (!is_arkui_x) {
    sanitize = {
      cfi = true
      cfi_cross_dso = true
      cfi_vcall_icall_only = true
      debug = false
    }
  }

  if (use_mingw_win) {
    defines = image_decode_windows_defines
  } else if (use_clang_mac) {
    defines = image_decode_mac_defines
  } else if (use_clang_ios) {
    defines = image_decode_ios_defines
  } else if (use_clang_android) {
    defines = image_decode_android_defines
  }
  configs = [ ":utils_mock_config" ]
  sources = [
    "//foundation/multimedia/image_framework/mock/native/src/directory_ex.cpp",
    "//foundation/multimedia/image_framework/mock/native/src/message_parcel.cpp",
    "//foundation/multimedia/image_framework/mock/native/src/parcel.cpp",
    "//foundation/multimedia/image_framework/mock/native/src/refbase.cpp",
    "//foundation/multimedia/image_framework/mock/native/src/rwlock.cpp",
  ]
  deps = [ ":log_mock_static" ]
  subsystem_name = "multimedia"
  part_name = "image_framework"
}