#
#  Copyright (C) 2015 Google
#
#  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.
#

source_set("service") {
  sources = [
    "adapter.cc",
    "common/bluetooth/adapter_state.cc",
    "common/bluetooth/advertise_data.cc",
    "common/bluetooth/advertise_settings.cc",
    "common/bluetooth/characteristic.cc",
    "common/bluetooth/descriptor.cc",
    "common/bluetooth/scan_filter.cc",
    "common/bluetooth/scan_result.cc",
    "common/bluetooth/scan_settings.cc",
    "common/bluetooth/service.cc",
    "common/bluetooth/util/address_helper.cc",
    "common/bluetooth/util/atomic_string.cc",
    "common/bluetooth/uuid.cc",
    "daemon.cc",
    "gatt_client.cc",
    "gatt_server.cc",
    "gatt_server_old.cc",
    "hal/bluetooth_gatt_interface.cc",
    "hal/bluetooth_interface.cc",
    "hal/fake_bluetooth_gatt_interface.cc",
    "hal/fake_bluetooth_interface.cc",
    "ipc/ipc_handler.cc",
    "ipc/ipc_handler_linux.cc",
    "ipc/ipc_manager.cc",
    "ipc/linux_ipc_host.cc",
    "logging_helpers.cc",
    "low_energy_advertiser.cc",
    "low_energy_scanner.cc",
    "low_energy_client.cc",
    "settings.cc",
  ]

  include_dirs = [
    "//",
    "//service/common",
    "//third_party/modp_b64/modp64",
    "//third_party/libhardware/include",
  ]

  deps = [
    "//third_party/libchrome:base"
  ]
}

executable("bluetoothtbd") {
  sources = [
    "main.cc",
  ]

  deps = [
    ":service",
    "//btcore",
    "//third_party/libchrome:base",
    "//third_party/modp_b64",
  ]

  include_dirs = [ "//" ]

  libs = [
    "-ldl",
    "-lpthread",
    "-lrt",
  ]
}

executable("service_unittests") {
  testonly = true
  sources = [
    "test/fake_hal_util.cc",
    "test/settings_unittest.cc",
    "test/uuid_unittest.cc",
  ]

  include_dirs = [ "//" ]

  deps = [
    ":service",
    "//third_party/googletest:gmock_main",
    "//third_party/libchrome:base",
    "//third_party/modp_b64",
  ]
}