| # Copyright 2016 The Chromium 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("//build/config/features.gni") |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") # For generate_jni(). |
| } |
| |
| component("generic_sensor") { |
| output_name = "generic_sensor" |
| sources = [ |
| "generic_sensor_consts.h", |
| "linux/sensor_data_linux.cc", |
| "linux/sensor_data_linux.h", |
| "platform_sensor.cc", |
| "platform_sensor.h", |
| "platform_sensor_ambient_light_mac.cc", |
| "platform_sensor_ambient_light_mac.h", |
| "platform_sensor_android.cc", |
| "platform_sensor_android.h", |
| "platform_sensor_linux.cc", |
| "platform_sensor_linux.h", |
| "platform_sensor_provider.cc", |
| "platform_sensor_provider.h", |
| "platform_sensor_provider_android.cc", |
| "platform_sensor_provider_android.h", |
| "platform_sensor_provider_base.cc", |
| "platform_sensor_provider_base.h", |
| "platform_sensor_provider_mac.cc", |
| "platform_sensor_provider_mac.h", |
| "platform_sensor_provider_win.cc", |
| "platform_sensor_provider_win.h", |
| "platform_sensor_reader_linux.cc", |
| "platform_sensor_reader_linux.h", |
| "platform_sensor_reader_win.cc", |
| "platform_sensor_reader_win.h", |
| "platform_sensor_win.cc", |
| "platform_sensor_win.h", |
| "sensor_impl.cc", |
| "sensor_impl.h", |
| "sensor_provider_impl.cc", |
| "sensor_provider_impl.h", |
| ] |
| |
| defines = [ "DEVICE_GENERIC_SENSOR_IMPLEMENTATION" ] |
| |
| deps = [ |
| "//base", |
| "//device/base/synchronization", |
| ] |
| |
| public_deps = [ |
| "//device/generic_sensor/public/cpp", |
| ] |
| |
| if (is_android) { |
| sources += [ |
| "android/sensors_jni_registrar.cc", |
| "android/sensors_jni_registrar.h", |
| ] |
| |
| deps += [ ":jni_headers" ] |
| } |
| |
| if (is_mac) { |
| deps += [ "//device/sensors/public/cpp" ] |
| libs = [ "IOKit.framework" ] |
| } |
| |
| if (use_udev) { |
| deps += [ |
| "//device/base", |
| "//device/udev_linux", |
| ] |
| |
| sources += [ |
| "linux/sensor_device_manager.cc", |
| "linux/sensor_device_manager.h", |
| "platform_sensor_provider_linux.cc", |
| "platform_sensor_provider_linux.h", |
| ] |
| } |
| |
| if (is_win) { |
| libs = [ |
| "portabledeviceguids.lib", |
| "sensorsapi.lib", |
| ] |
| } |
| } |
| |
| if (is_android) { |
| device_sensors_jni_sources = [ |
| "android/java/src/org/chromium/device/sensors/PlatformSensor.java", |
| "android/java/src/org/chromium/device/sensors/PlatformSensorProvider.java", |
| ] |
| |
| generate_jni("jni_headers") { |
| sources = device_sensors_jni_sources |
| jni_package = "device" |
| } |
| |
| android_library("java") { |
| java_files = device_sensors_jni_sources |
| |
| deps = [ |
| "//base:base_java", |
| "//device/generic_sensor/public/interfaces:interfaces_java", |
| ] |
| } |
| } |
| |
| static_library("testing") { |
| testonly = true |
| sources = [ |
| "fake_platform_sensor.cc", |
| "fake_platform_sensor.h", |
| "fake_platform_sensor_provider.cc", |
| "fake_platform_sensor_provider.h", |
| ] |
| |
| public_deps = [ |
| ":generic_sensor", |
| "//base", |
| "//testing/gmock", |
| ] |
| } |