# 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/config/ohos/config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/ohos.gni")

group("common_cross_packages") {
  deps = []
  if (!is_host_product) {
    deps += [
      "musl:musl_install",
      "libcpp:libcpp_install",
      "asan:asan.options",
      "asan:libclang_rt.asan.so",
      "asan:libclang_rt.memgraph.so",
    ]

    if (target_cpu == "arm64") {
      deps += [
        "asan:libclang_rt.hwasan.so",
        "asan:libclang_rt.tsan.so",
        "asan:tsan.options",
      ]
    }

    if (is_asan) {
      deps += [ "asan:asan.cfg" ]
    } else if (is_tsan) {
      deps += [
        "asan:asan.cfg",
        "asan:libclang_rt.tsan.so",
      ]
    } else {
      # ubsan.cfg defines the log_path, different with asan.cfg
      deps += [
        "ubsan:libclang_rt.ubsan_minimal.so",
        "ubsan:libclang_rt.ubsan_standalone.so",
        "ubsan:ubsan.cfg",
      ]
    }
  }
}

group("common_host_packages") {
  deps = [ "//build/rust:default" ]
}

group("common_packages") {
  deps = []
  if (is_host_product) {
    deps += [ ":common_host_packages" ]
  } else {
    deps += [ ":common_cross_packages" ]
  }
}