# 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/chip.gni")

import("ble.gni")

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

  # Extra header to include in BleConfig.h for platform.
  ble_platform_config_include = ""
}

config("ble_config") {
  configs = [ "${chip_root}/src:includes" ]

  defines = []
  if (ble_project_config_include != "") {
    defines += [ "BLE_PROJECT_CONFIG_INCLUDE=${ble_project_config_include}" ]
  }
  if (ble_platform_config_include != "") {
    defines += [ "BLE_PLATFORM_CONFIG_INCLUDE=${ble_platform_config_include}" ]
  }

  if (config_network_layer_ble) {
    defines += [ "CONFIG_NETWORK_LAYER_BLE=1" ]
  } else {
    defines += [ "CONFIG_NETWORK_LAYER_BLE=0" ]
  }
}

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

  public_configs = [ ":ble_config" ]

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

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

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

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