| # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//common-mk/pkg_config.gni") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":bluetooth-protos", |
| ":btdispatch", |
| ":libcommon", |
| ":libdispatcher", |
| ":libnewblued", |
| ":newblued", |
| ] |
| if (use.test) { |
| deps += [ ":bluetooth_test" ] |
| } |
| if (use.fuzzer) { |
| deps += [ ":bluetooth_parsedataintouuids_fuzzer" ] |
| deps += [ ":bluetooth_parsedataintoservicedata_fuzzer" ] |
| deps += [ ":bluetooth_parseeir_fuzzer" ] |
| deps += [ ":bluetooth_parsereportdescriptor_fuzzer" ] |
| deps += [ ":bluetooth_trimadapterfromobjectpath_fuzzer" ] |
| deps += [ ":bluetooth_trimdevicefromobjectpath_fuzzer" ] |
| deps += [ ":bluetooth_trimservicefromobjectpath_fuzzer" ] |
| deps += [ ":bluetooth_trimcharacteristicfromobjectpath_fuzzer" ] |
| deps += [ ":bluetooth_trimdescriptorfromobjectpath_fuzzer" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| pkg_deps = [ |
| "libcros_config", |
| "dbus-1", |
| "libbrillo", |
| "libchrome-${libbase_ver}", |
| "newblue", |
| |
| # system_api depends on protobuf (or protobuf-lite). It must appear |
| # before protobuf here or the linker flags won't be in the right |
| # order. |
| "system_api", |
| ] |
| if (use.fuzzer) { |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| } |
| |
| proto_library("bluetooth-protos") { |
| proto_in_dir = "proto" |
| proto_out_dir = "include/bluetooth/proto_bindings" |
| sources = [ |
| "${proto_in_dir}/config.proto", |
| ] |
| } |
| |
| static_library("libcommon") { |
| sources = [ |
| "common/dbus_client.cc", |
| "common/dbus_daemon.cc", |
| "common/exported_object_manager_wrapper.cc", |
| "common/property.cc", |
| "common/runtime_flags.cc", |
| "common/util.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| defines = |
| [ "USE_BLUETOOTH_SUSPEND_MANAGEMENT=${use.bluetooth_suspend_management}" ] |
| } |
| |
| static_library("libdispatcher") { |
| sources = [ |
| "dispatcher/bluez_interface_handler.cc", |
| "dispatcher/catch_all_forwarder.cc", |
| "dispatcher/client_manager.cc", |
| "dispatcher/dbus_connection_factory.cc", |
| "dispatcher/dbus_util.cc", |
| "dispatcher/dispatcher.cc", |
| "dispatcher/dispatcher_client.cc", |
| "dispatcher/dispatcher_daemon.cc", |
| "dispatcher/dispatcher_debug_manager.cc", |
| "dispatcher/impersonation_object_manager_interface.cc", |
| "dispatcher/object_manager_interface_multiplexer.cc", |
| "dispatcher/service_watcher.cc", |
| "dispatcher/suspend_manager.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| } |
| |
| static_library("libnewblued") { |
| sources = [ |
| "newblued/adapter_interface_handler.cc", |
| "newblued/advertising_manager_interface_handler.cc", |
| "newblued/agent_manager_interface_handler.cc", |
| "newblued/device_interface_handler.cc", |
| "newblued/gatt.cc", |
| "newblued/gatt_attributes.cc", |
| "newblued/gatt_interface_handler.cc", |
| "newblued/newblue.cc", |
| "newblued/newblue_daemon.cc", |
| "newblued/newblue_debug_manager.cc", |
| "newblued/scan_manager.cc", |
| "newblued/stack_sync_monitor.cc", |
| "newblued/util.cc", |
| "newblued/uuid.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| } |
| |
| executable("btdispatch") { |
| sources = [ |
| "dispatcher/main.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| deps = [ |
| ":libcommon", |
| ":libdispatcher", |
| ] |
| } |
| |
| executable("newblued") { |
| sources = [ |
| "newblued/main.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| |
| if (use.test) { |
| pkg_config("test_config") { |
| pkg_deps = [ "libchrome-test-${libbase_ver}" ] |
| } |
| executable("bluetooth_test") { |
| sources = [ |
| "common/dbus_client_test.cc", |
| "common/exported_object_manager_wrapper_test.cc", |
| "common/property_test.cc", |
| "dispatcher/catch_all_forwarder_test.cc", |
| "dispatcher/dispatcher_client_test.cc", |
| "dispatcher/dispatcher_test.cc", |
| "dispatcher/impersonation_object_manager_interface_test.cc", |
| "dispatcher/object_manager_interface_multiplexer_test.cc", |
| "dispatcher/suspend_manager_test.cc", |
| "dispatcher/test_helper.cc", |
| "newblued/advertising_manager_interface_handler_test.cc", |
| "newblued/agent_manager_interface_handler_test.cc", |
| "newblued/gatt_attributes_test.cc", |
| "newblued/newblue_daemon_test.cc", |
| "newblued/newblue_test.cc", |
| "newblued/property_test.cc", |
| "newblued/stack_sync_monitor_test.cc", |
| "newblued/util_test.cc", |
| "newblued/uuid_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ":test_config", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libdispatcher", |
| ":libnewblued", |
| "//common-mk/testrunner", |
| ] |
| } |
| } |
| |
| # Fuzzer targets |
| if (use.fuzzer) { |
| executable("bluetooth_parsedataintouuids_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/parsedataintouuids_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_parsedataintoservicedata_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/parsedataintoservicedata_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_parseeir_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/parseeir_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_parsereportdescriptor_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/parsereportdescriptor_fuzzer.cc", |
| ] |
| configs += [ |
| ":target_defaults", |
| "//common-mk/common_fuzzer", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_trimadapterfromobjectpath_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/trimadapterfromobjectpath_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_trimdevicefromobjectpath_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/trimdevicefromobjectpath_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_trimservicefromobjectpath_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/trimservicefromobjectpath_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_trimcharacteristicfromobjectpath_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/trimcharacteristicfromobjectpath_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| executable("bluetooth_trimdescriptorfromobjectpath_fuzzer") { |
| sources = [ |
| "newblued/fuzzers/trimdescriptorfromobjectpath_fuzzer.cc", |
| ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcommon", |
| ":libnewblued", |
| ] |
| } |
| } |