OLD | NEW |
| (Empty) |
1 # Copyright 2016 The Chromium 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 | |
5 import("//build/config/features.gni") | |
6 | |
7 if (is_android) { | |
8 import("//build/config/android/rules.gni") # For generate_jni(). | |
9 } | |
10 | |
11 component("generic_sensor") { | |
12 output_name = "generic_sensor" | |
13 sources = [ | |
14 "generic_sensor_consts.h", | |
15 "generic_sensor_export.h", | |
16 "linux/sensor_data_linux.cc", | |
17 "linux/sensor_data_linux.h", | |
18 "platform_sensor.cc", | |
19 "platform_sensor.h", | |
20 "platform_sensor_accelerometer_mac.cc", | |
21 "platform_sensor_accelerometer_mac.h", | |
22 "platform_sensor_ambient_light_mac.cc", | |
23 "platform_sensor_ambient_light_mac.h", | |
24 "platform_sensor_android.cc", | |
25 "platform_sensor_android.h", | |
26 "platform_sensor_linux.cc", | |
27 "platform_sensor_linux.h", | |
28 "platform_sensor_provider.cc", | |
29 "platform_sensor_provider.h", | |
30 "platform_sensor_provider_android.cc", | |
31 "platform_sensor_provider_android.h", | |
32 "platform_sensor_provider_base.cc", | |
33 "platform_sensor_provider_base.h", | |
34 "platform_sensor_provider_mac.cc", | |
35 "platform_sensor_provider_mac.h", | |
36 "platform_sensor_provider_win.cc", | |
37 "platform_sensor_provider_win.h", | |
38 "platform_sensor_reader_linux.cc", | |
39 "platform_sensor_reader_linux.h", | |
40 "platform_sensor_reader_win.cc", | |
41 "platform_sensor_reader_win.h", | |
42 "platform_sensor_win.cc", | |
43 "platform_sensor_win.h", | |
44 "sensor_impl.cc", | |
45 "sensor_impl.h", | |
46 "sensor_provider_impl.cc", | |
47 "sensor_provider_impl.h", | |
48 ] | |
49 | |
50 defines = [ "DEVICE_GENERIC_SENSOR_IMPLEMENTATION" ] | |
51 | |
52 deps = [ | |
53 "//base", | |
54 "//device/base/synchronization", | |
55 ] | |
56 | |
57 public_deps = [ | |
58 "//device/generic_sensor/public/cpp", | |
59 ] | |
60 | |
61 if (is_android) { | |
62 sources += [ | |
63 "android/sensors_jni_registrar.cc", | |
64 "android/sensors_jni_registrar.h", | |
65 ] | |
66 | |
67 deps += [ ":jni_headers" ] | |
68 } | |
69 | |
70 if (is_mac) { | |
71 deps += [ | |
72 "//device/sensors/public/cpp:full", | |
73 "//third_party/sudden_motion_sensor", | |
74 ] | |
75 libs = [ | |
76 "CoreFoundation.framework", | |
77 "IOKit.framework", | |
78 ] | |
79 } | |
80 | |
81 if (use_udev) { | |
82 deps += [ | |
83 "//device/base", | |
84 "//device/udev_linux", | |
85 ] | |
86 | |
87 sources += [ | |
88 "linux/sensor_device_manager.cc", | |
89 "linux/sensor_device_manager.h", | |
90 "platform_sensor_provider_linux.cc", | |
91 "platform_sensor_provider_linux.h", | |
92 ] | |
93 } | |
94 | |
95 if (is_win) { | |
96 libs = [ | |
97 "portabledeviceguids.lib", | |
98 "sensorsapi.lib", | |
99 ] | |
100 } | |
101 } | |
102 | |
103 if (is_android) { | |
104 device_sensors_jni_sources = [ | |
105 "android/java/src/org/chromium/device/sensors/PlatformSensor.java", | |
106 "android/java/src/org/chromium/device/sensors/PlatformSensorProvider.java", | |
107 ] | |
108 | |
109 generate_jni("jni_headers") { | |
110 sources = device_sensors_jni_sources | |
111 jni_package = "device" | |
112 } | |
113 | |
114 android_library("java") { | |
115 java_files = device_sensors_jni_sources | |
116 | |
117 deps = [ | |
118 "//base:base_java", | |
119 "//device/generic_sensor/public/interfaces:interfaces_java", | |
120 ] | |
121 } | |
122 } | |
123 | |
124 static_library("testing") { | |
125 testonly = true | |
126 sources = [ | |
127 "fake_platform_sensor.cc", | |
128 "fake_platform_sensor.h", | |
129 "fake_platform_sensor_provider.cc", | |
130 "fake_platform_sensor_provider.h", | |
131 ] | |
132 | |
133 public_deps = [ | |
134 ":generic_sensor", | |
135 "//base", | |
136 "//testing/gmock", | |
137 ] | |
138 } | |
OLD | NEW |