Zzhuofan0129feat: sync
67d533ef创建于 2025年8月11日历史提交
# Copyright (c) 2022 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("//base/security/device_security_level/common/dslm.gni")
import("//build/ohos.gni")

config("device_security_level_sdk_config") {
  include_dirs = [ "include" ]
}

group("fwk_group") {
  if (os_level == "standard") {
    deps = [ ":dslm_sdk" ]
  } else if (os_level == "small") {
    deps = [ ":dslm_sdk_small" ]
  } else if (os_level == "mini") {
    deps = [ ":dslm_sdk_mini" ]
  }
}

if (defined(ohos_lite)) {
  if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
    ohos_shared_library("dslm_sdk_small") {
      sources = [
        "src/lite/device_security_info.c",
        "src/lite/small/device_security_level_proxy.c",
      ]

      include_dirs = [
        "src/lite/include",
        "src/lite/small",
        "../../services/include",
        "../../common/include",
      ]

      configs = [
        "../../common:common_configs",
        "../../common:common_lite_configs",
      ]

      public_configs = [ ":device_security_level_sdk_config" ]

      deps = [
        "$dslm_hilog_path/featured:hilog_shared",
        "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single",
        "$dslm_samgr_path/samgr_lite/samgr:samgr",
        "../../baselib/utils:utils_static",
      ]

      part_name = "device_security_level"
      subsystem_name = "security"
    }
    group("dslm_sdk") {
    }
  } else if (ohos_kernel_type == "liteos_m") {
    ohos_static_library("dslm_sdk_mini") {
      sources = [
        "src/lite/device_security_info.c",
        "src/lite/mini/device_security_level_inner.c",
      ]

      include_dirs = [
        "src/lite/include",
        "src/lite/mini",
        "../../common/include",
        "../../interfaces/inner_api/src/lite",
        "../../services/include",
        "../../services/sa/lite/mini",
      ]

      configs = [
        "../../common:common_configs",
        "../../common:common_lite_configs",
      ]

      public_configs = [ ":device_security_level_sdk_config" ]

      deps = [
        "$dslm_hilog_path/featured:hilog_static",
        "$dslm_samgr_path/samgr_lite/samgr:samgr",
        "../../baselib/utils:utils_static",
      ]

      part_name = "device_security_level"
      subsystem_name = "security"
    }
    group("dslm_sdk") {
    }
  }
} else {
  ohos_shared_library("dslm_sdk") {
    sanitize = {
      integer_overflow = true
      ubsan = true
      boundary_sanitize = true
      cfi = true
      cfi_cross_dso = true
      blocklist = "../../cfi_blocklist.txt"
    }
    branch_protector_ret = "pac_ret"

    sources = [
      "src/standard/device_security_info.cpp",
      "src/standard/device_security_level_callback_helper.cpp",
      "src/standard/device_security_level_callback_stub.cpp",
      "src/standard/device_security_level_loader.cpp",
      "src/standard/device_security_level_proxy.cpp",
    ]

    include_dirs = [
      "../../services/include",
      "../../common/include",
    ]

    configs = [ "../../common:common_configs" ]

    public_configs = [ ":device_security_level_sdk_config" ]

    external_deps = [
      "c_utils:utils",
      "hilog:libhilog",
      "ipc:ipc_core",
      "samgr:samgr_proxy",
    ]

    part_name = "device_security_level"
    subsystem_name = "security"
  }
}