Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 116ae62b authored by Sonny Sasaka's avatar Sonny Sasaka
Browse files

Update GN files for building on Linux/Chrome OS

* Add missing GN files
* Move test targets under use.test
* Move non-standard codec targets under use.bt_nonstandard_codecs
* Add missing source files

Bug: 177961465
Tag: #refactor
Test: atest --host bluetooth_test_common

Change-Id: Ib7ba2705b2fd53d4c4d87916e99f35e7fce6c98e
parent 20b4bb12
Loading
Loading
Loading
Loading
+56 −32
Original line number Diff line number Diff line
@@ -24,6 +24,12 @@ group("all") {
  deps = [
    ":bluetooth",
  ]

  if (use.test) {
    deps += [
      ":bluetooth_tests"
    ]
  }
}

# This pulls in main/BUILD.gn and all of its dependencies.
@@ -34,20 +40,34 @@ group("bluetooth") {
  ]
}

if (use.test) {
  group("bluetooth_tests") {
  testonly = true
    deps = [
      "//bt/common:bluetooth_test_common",
      "//bt/service:bluetoothtbd_test",
      "//bt/profile/avrcp:net_test_avrcp",
      "//bt/btcore:net_test_btcore",
      "//bt/types:net_test_types",
      "//bt/stack:net_test_btm_iso",
      #"//bt/packet:net_test_btpackets",
    ]
  }
}

if (defined(use.android) && use.android) {
  group("android_bluetooth_tests") {
    deps = [
      "//bt/test/suite:net_test_bluetooth",
    "//bt/btcore:net_test_btcore",
      "//bt/hci:net_test_hci",
      "//bt/osi:net_test_osi",
      "//bt/device:net_test_device",
    ]
  }
}

config("target_defaults") {
  include_dirs = [
    "//bt",
    "//bt/linux_include",
    "//bt/types",
    "//bt/include",
@@ -143,26 +163,30 @@ pkg_config("pkg_tinyxml2") {
  pkg_deps = [ "tinyxml2" ]
}

# Uncomment if building nonstandard codecs
# config("external_aac") {
#   configs = [ ":pkg_aac" ]
# }
#
# pkg_config("pkg_aac") {
#   pkg_deps = [ "fdk-aac" ]
# }
#
# config("external_libldac") {
#   configs = [
#     ":pkg_libldacBT_enc",
#     ":pkg_libldacBT_abr",
#   ]
# }
#
# pkg_config("pkg_libldacBT_enc") {
#   pkg_deps = [ "ldacBT-enc", ]
# }
#
# pkg_config("pkg_libldacBT_abr") {
#   pkg_deps = [ "ldacBT-abr", ]
# }
# To use non-standard codecs (i.e. ldac, aac, aptx), set this use flag when
# building. These codecs may have licensing issues that need to be resolved
# first.
if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) {
  config("external_aac") {
    configs = [ ":pkg_aac" ]
  }

  pkg_config("pkg_aac") {
    pkg_deps = [ "fdk-aac" ]
  }

  config("external_libldac") {
    configs = [
      ":pkg_libldacBT_enc",
      ":pkg_libldacBT_abr",
    ]
  }

  pkg_config("pkg_libldacBT_enc") {
    pkg_deps = [ "ldacBT-enc", ]
  }

  pkg_config("pkg_libldacBT_abr") {
    pkg_deps = [ "ldacBT-abr", ]
  }
}
+26 −25
Original line number Diff line number Diff line
@@ -121,8 +121,8 @@ static_library("bta") {
  ]
}

if (use.test) {
  executable("net_test_bta") {
  testonly = true
    sources = [
      "gatt/database_builder.cc",
      "test/gatt/database_builder_test.cc",
@@ -150,3 +150,4 @@ executable("net_test_bta") {
      "//bt:target_defaults",
    ]
  }
}
+26 −25
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ static_library("btcore") {
  ]
}

if (use.test) {
  executable("net_test_btcore") {
  testonly = true
    sources = [
      "test/device_class_test.cc",
      "test/property_test.cc",
@@ -62,8 +62,9 @@ executable("net_test_btcore") {
    ]

    libs = [
    "-lpthread",
    "-lrt",
    "-ldl",
      "pthread",
      "rt",
      "dl",
    ]
  }
}
+9 −5
Original line number Diff line number Diff line
@@ -18,20 +18,22 @@ static_library("btif") {
  sources = [
    "//bt/audio_a2dp_hw/src/audio_a2dp_hw_utils.cc",
    "//bt/audio_hearing_aid_hw/src/audio_hearing_aid_hw_utils.cc",
    "avrcp/avrcp_service.cc",
    "src/btif_a2dp.cc",
    "src/btif_a2dp_audio_interface_linux.cc",
    "src/btif_a2dp_control.cc",
    "src/btif_a2dp_sink.cc",
    # "src/btif_a2dp_source.cc",
    "src/btif_av.cc",
    "avrcp/avrcp_service.cc",

    #TODO(jpawlowski): heavily depends on Android,
    #   "src/btif_avrcp_audio_track.cc",
    "src/btif_avrcp_audio_track_linux.cc",
    "src/btif_ble_advertiser.cc",
    "src/btif_ble_scanner.cc",
    # "src/btif_config.cc",
    "src/btif_bqr.cc",
    "src/btif_config.cc",
    "src/btif_config_cache.cc",
    "src/btif_config_transcode.cc",
    "src/btif_core.cc",
    "src/btif_debug.cc",
@@ -43,11 +45,13 @@ static_library("btif") {
    "src/btif_gatt_server.cc",
    "src/btif_gatt_test.cc",
    "src/btif_gatt_util.cc",
    "src/btif_hd.cc",
    "src/btif_hearing_aid.cc",
    "src/btif_hf.cc",
    "src/btif_hf_client.cc",
    "src/btif_hh.cc",
    "src/btif_hd.cc",
    "src/btif_keystore.cc",
    "src/btif_le_audio.cc",
    "src/btif_pan.cc",
    "src/btif_profile_queue.cc",
    "src/btif_rc.cc",
@@ -68,11 +72,11 @@ static_library("btif") {

  # BTIF callouts
  sources += [
    "co/bta_dm_co.cc",
    "co/bta_av_co.cc",
    "co/bta_dm_co.cc",
    "co/bta_gatts_co.cc",
    "co/bta_hh_co.cc",
    "co/bta_pan_co.cc",
    "co/bta_gatts_co.cc",
  ]

  include_dirs = [
+28 −23
Original line number Diff line number Diff line
@@ -16,8 +16,12 @@

static_library("common") {
  sources = [
    "address_obfuscator.cc",
    "once_timer.cc",
    "message_loop_thread.cc",
    "metric_id_allocator.cc",
    "metrics_linux.cc",
    "repeating_timer.cc",
    "time_util.cc",
  ]

@@ -38,8 +42,8 @@ static_library("common") {
  ]
}

executable("bt_test_common") {
  testonly = true
if (use.test) {
  executable("bluetooth_test_common") {
    sources = [
      "leaky_bonded_queue_unittest.cc",
      "state_machine_unittest.cc",
@@ -62,7 +66,8 @@ executable("bt_test_common") {
    ]

    libs = [
    "-lpthread",
    "-lrt",
      "pthread",
      "rt",
    ]
  }
}
Loading