| # Copyright 2022 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/pkg_config.gni") |
| |
| group("all") { |
| deps = [ |
| ":install_dbus_activation", |
| ":install_dbus_config", |
| ":install_upstart_config", |
| ":rgbkbd", |
| ] |
| |
| if (use.test) { |
| deps += [ ":rgbkbd_test" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| # NOSORT |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libec", |
| |
| # 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", |
| ] |
| } |
| |
| generate_dbus_adaptors("rgbkbd-adaptor") { |
| dbus_service_config = "dbus_bindings/dbus-service-config.json" |
| dbus_adaptors_out_dir = "include/rgbkbd/dbus_adaptors" |
| sources = [ "dbus_bindings/org.chromium.Rgbkbd.xml" ] |
| } |
| |
| static_library("librgbkbd") { |
| sources = [ |
| "internal_rgb_keyboard.cc", |
| "internal_rgb_keyboard.h", |
| "keyboard_backlight_logger.cc", |
| "keyboard_backlight_logger.h", |
| "rgb_keyboard_controller.h", |
| "rgb_keyboard_controller_impl.cc", |
| "rgb_keyboard_controller_impl.h", |
| "rgbkbd_daemon.cc", |
| "rgbkbd_daemon.h", |
| ] |
| configs += [ ":target_defaults" ] |
| deps = [ ":rgbkbd-adaptor" ] |
| } |
| |
| executable("rgbkbd") { |
| sources = [ "main.cc" ] |
| configs += [ ":target_defaults" ] |
| install_path = "sbin" |
| deps = [ ":librgbkbd" ] |
| } |
| |
| # Install upstart configs and scripts. |
| install_config("install_upstart_config") { |
| sources = [ "init/rgbkbd.conf" ] |
| install_path = "/etc/init" |
| } |
| |
| # Install D-Bus configuration file. |
| install_config("install_dbus_config") { |
| sources = [ "dbus/org.chromium.Rgbkbd.conf" ] |
| install_path = "/etc/dbus-1/system.d" |
| } |
| |
| # Install D-Bus service activation configuration. |
| install_config("install_dbus_activation") { |
| sources = [ "dbus/org.chromium.Rgbkbd.service" ] |
| install_path = "/usr/share/dbus-1/system-services" |
| } |
| |
| if (use.test) { |
| executable("rgbkbd_test") { |
| sources = [ |
| "internal_rgb_keyboard_test.cc", |
| "keyboard_backlight_logger_test.cc", |
| "rgb_keyboard_controller_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ] |
| run_test = true |
| deps = [ |
| ":librgbkbd", |
| "//common-mk/testrunner", |
| ] |
| } |
| } |