# Copyright (c) 2021-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("//build/ohos.gni")
import("//foundation/ability/ability_runtime/ability_runtime.gni")

config("tools_fm_config") {
  include_dirs = [
    "${ability_base_kits_path}/want/include",
    "${ability_runtime_services_path}/common/include",
    "${ability_runtime_path}/tools/aa/include",
    "${ability_runtime_services_path}/common/include",
    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
    "include",
  ]
}

ohos_source_set("tools_fm_source_set") {
  sources = [
    "${ability_runtime_path}/tools/aa/src/shell_command.cpp",
    "src/fms_command.cpp",
    "src/main.cpp",
  ]

  defines = [ "AMS_LOG_TAG = \"FmsTool\"" ]

  public_configs = [ ":tools_fm_config" ]

  cflags = []
  if (target_cpu == "arm") {
    cflags += [ "-DBINDER_IPC_32BIT" ]
  }

  deps = []

  external_deps = [
    "ability_base:want",
    "ability_runtime:app_manager",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "form_fwk:form_manager",
    "hiviewdfx_hilog_native:libhilog",
    "ipc:ipc_core",
    "samgr:samgr_proxy",
  ]

  subsystem_name = "ability"
  part_name = "ability_tools"
}

ohos_executable("fm") {
  deps = [ ":tools_fm_source_set" ]

  install_enable = true

  subsystem_name = "ability"
  part_name = "ability_tools"
}

group("tools_fm") {
  deps = [ ":fm" ]
}
