# Copyright (c) 2020 Project CHIP Authors
#
# 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_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${chip_root}/build/chip/buildconfig_header.gni")
import("${chip_root}/build/chip/tests.gni")
import("${chip_root}/src/platform/device.gni")
import("ble.gni")

declare_args() {
  # Extra header to include in BleConfig.h for project.
  chip_ble_project_config_include = ""
}

buildconfig_header("ble_buildconfig") {
  header = "BleBuildConfig.h"
  header_dir = "ble"

  defines = [
    "CONFIG_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}",
    "CHIP_ENABLE_CHIPOBLE_TEST=false",
  ]

  if (chip_ble_project_config_include != "") {
    defines +=
        [ "BLE_PROJECT_CONFIG_INCLUDE=${chip_ble_project_config_include}" ]
  }
  if (chip_ble_platform_config_include != "") {
    defines +=
        [ "BLE_PLATFORM_CONFIG_INCLUDE=${chip_ble_platform_config_include}" ]
  }

  visibility = [ ":ble_config_header" ]
}

source_set("ble_config_header") {
  sources = [ "BleConfig.h" ]

  public_configs = [ "${chip_root}/src:includes" ]

  public_deps = [ "${chip_root}/src/system:system_config_header" ]

  deps = [
    ":ble_buildconfig",
    "${chip_root}/src/platform:platform_buildconfig",
  ]
}

if (chip_config_network_layer_ble) {
  static_library("ble") {
    output_name = "libBleLayer"

    sources = [
      "BLEEndPoint.cpp",
      "BLEEndPoint.h",
      "Ble.h",
      "BleApplicationDelegate.h",
      "BleConnectionDelegate.h",
      "BleError.cpp",
      "BleError.h",
      "BleLayer.cpp",
      "BleLayer.h",
      "BlePlatformDelegate.h",
      "BleUUID.cpp",
      "BleUUID.h",
      "BtpEngine.cpp",
      "BtpEngine.h",
      "CHIPBleServiceData.h",
    ]

    cflags = [ "-Wconversion" ]

    public_deps = [
      ":ble_config_header",
      "${chip_root}/src/inet",
      "${chip_root}/src/lib/support",
    ]
  }
} else {
  group("ble") {
  }
}
