| # 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/generate-dbus-adaptors.gni") |
| import("//common-mk/generate-dbus-proxies.gni") |
| import("//common-mk/pkg_config.gni") |
| |
| group("all") { |
| deps = [ |
| ":crosdns", |
| ":crosdns_proxies", |
| ":libcrosdns_static", |
| ] |
| if (use.test) { |
| deps += [ ":run_tests" ] |
| } |
| if (use.fuzzer) { |
| deps += [ ":hosts_modifier_fuzzer" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| ] |
| } |
| |
| generate_dbus_adaptors("crosdns_adaptors") { |
| dbus_adaptors_out_dir = "include/crosdns/dbus_adaptors" |
| dbus_service_config = "dbus_adaptors/dbus-service-config.json" |
| sources = [ "dbus_adaptors/org.chromium.CrosDns.xml" ] |
| } |
| |
| generate_dbus_proxies("crosdns_proxies") { |
| dbus_service_config = "dbus_adaptors/dbus-service-config.json" |
| proxy_output_file = "include/crosdns/dbus_adaptors/dbus-proxies.h" |
| sources = [ "dbus_adaptors/org.chromium.CrosDns.xml" ] |
| } |
| |
| static_library("libcrosdns_static") { |
| sources = [ |
| "crosdns_daemon.cc", |
| "crosdns_daemon.h", |
| "hosts_modifier.cc", |
| "hosts_modifier.h", |
| ] |
| configs += [ ":target_defaults" ] |
| deps = [ ":crosdns_adaptors" ] |
| } |
| |
| executable("crosdns") { |
| sources = [ |
| "crosdns_daemon.h", |
| "main.cc", |
| ] |
| configs += [ ":target_defaults" ] |
| deps = [ |
| ":crosdns_adaptors", |
| ":libcrosdns_static", |
| ] |
| } |
| |
| if (use.test) { |
| executable("run_tests") { |
| sources = [ "hosts_modifier_test.cc" ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ] |
| deps = [ |
| ":libcrosdns_static", |
| "//common-mk/testrunner:testrunner", |
| ] |
| } |
| } |
| |
| # Fuzzer target. |
| if (use.fuzzer) { |
| pkg_config("hosts_modifier_fuzzer_config") { |
| pkg_deps = [ "libchrome-test" ] |
| } |
| |
| executable("hosts_modifier_fuzzer") { |
| sources = [ "hosts_modifier_fuzzer.cc" ] |
| configs += [ |
| "//common-mk/common_fuzzer", |
| ":hosts_modifier_fuzzer_config", |
| ":target_defaults", |
| ] |
| deps = [ ":libcrosdns_static" ] |
| } |
| } |