blob: e4ce15403301028eb8819a407b9106a40c376a74 [file] [log] [blame]
Rajat Jain8e567e22020-11-03 14:59:28 -08001# Copyright 2020 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//common-mk/pkg_config.gni")
6
7group("all") {
8 deps = [ ":pciguard" ]
Rajat Jain5bf732b2021-01-22 14:57:59 -08009 if (use.test) {
10 deps += [ ":pciguard_testrunner" ]
11 }
Rajat Jain8e567e22020-11-03 14:59:28 -080012}
13
14pkg_config("target_defaults") {
15 pkg_deps = [
16 "libbrillo",
17 "libchrome",
18 "libsession_manager-client",
19 "libudev",
20 ]
21}
22
23executable("pciguard") {
Rajat Jain5bf732b2021-01-22 14:57:59 -080024 sources = [
25 "daemon.cc",
26 "main.cc",
27 ]
Tatsuhisa Yamaguchif6fbc6e2021-03-10 17:16:54 +000028 configs += [ ":target_defaults" ]
29 deps = [ ":pciguard_common" ]
Rajat Jain5bf732b2021-01-22 14:57:59 -080030}
31
32static_library("pciguard_common") {
Rajat Jain8e567e22020-11-03 14:59:28 -080033 sources = [
34 "authorizer.cc",
Rajat Jain8e567e22020-11-03 14:59:28 -080035 "event_handler.cc",
Rajat Jain8e567e22020-11-03 14:59:28 -080036 "session_monitor.cc",
Rajat Jain5bf732b2021-01-22 14:57:59 -080037 "sysfs_utils.cc",
Rajat Jainebe88992021-03-05 10:52:55 -080038 "udev_monitor.cc",
Rajat Jain8e567e22020-11-03 14:59:28 -080039 ]
Tatsuhisa Yamaguchif6fbc6e2021-03-10 17:16:54 +000040 all_dependent_configs = [ ":target_defaults" ]
Rajat Jain8e567e22020-11-03 14:59:28 -080041 libs = [ "pthread" ]
42}
Rajat Jain5bf732b2021-01-22 14:57:59 -080043
44if (use.test) {
45 pkg_config("test_defaults") {
46 pkg_deps = [
47 "libbrillo-test",
48 "libchrome-test",
49 "libudev",
50 ]
51 }
52
53 executable("pciguard_testrunner") {
Tatsuhisa Yamaguchif6fbc6e2021-03-10 17:16:54 +000054 sources = [
55 "event_handler_test.cc",
56 "sysfs_utils_test.cc",
57 ]
Rajat Jain5bf732b2021-01-22 14:57:59 -080058 configs += [
59 ":test_defaults",
60 "//common-mk:test",
61 ]
62 deps = [
63 ":pciguard_common",
64 "//common-mk/testrunner:testrunner",
65 ]
Rajat Jain5bf732b2021-01-22 14:57:59 -080066 }
67}