mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
237 lines
5.6 KiB
Plaintext
237 lines
5.6 KiB
Plaintext
# Copyright 2015 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/android/config.gni")
|
|
import("//build/config/features.gni")
|
|
import("//build/config/ui.gni")
|
|
import("//media/media_options.gni")
|
|
import("//mojo/public/tools/bindings/mojom.gni")
|
|
import("//testing/libfuzzer/fuzzer_test.gni")
|
|
import("//testing/test.gni")
|
|
|
|
if (is_android) {
|
|
# For generate_jni().
|
|
import("//build/config/android/rules.gni")
|
|
}
|
|
|
|
# Common configuration for targets in the media/midi directory.
|
|
config("midi_config") {
|
|
if (use_alsa && use_udev) {
|
|
defines = [
|
|
"USE_ALSA",
|
|
"USE_UDEV",
|
|
]
|
|
}
|
|
|
|
visibility = [ ":*" ]
|
|
}
|
|
|
|
# USB MIDI specific source files that are used in Android port, and unit tests.
|
|
# These can't easily be a source set because "midi" is a component and the
|
|
# component export flags must always be the same.
|
|
usb_midi_sources = [
|
|
"midi_manager_usb.cc",
|
|
"midi_manager_usb.h",
|
|
"usb_midi_descriptor_parser.cc",
|
|
"usb_midi_descriptor_parser.h",
|
|
"usb_midi_device.h",
|
|
"usb_midi_export.h",
|
|
"usb_midi_input_stream.cc",
|
|
"usb_midi_input_stream.h",
|
|
"usb_midi_jack.h",
|
|
"usb_midi_output_stream.cc",
|
|
"usb_midi_output_stream.h",
|
|
]
|
|
|
|
# Android specific Java source files that are used to generate jni header files.
|
|
if (is_android) {
|
|
android_library("midi_java") {
|
|
deps = [
|
|
"//base:base_java",
|
|
]
|
|
|
|
java_files = [
|
|
"java/src/org/chromium/midi/MidiDeviceAndroid.java",
|
|
"java/src/org/chromium/midi/MidiInputPortAndroid.java",
|
|
"java/src/org/chromium/midi/MidiManagerAndroid.java",
|
|
"java/src/org/chromium/midi/MidiOutputPortAndroid.java",
|
|
"java/src/org/chromium/midi/UsbMidiDeviceAndroid.java",
|
|
"java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java",
|
|
]
|
|
}
|
|
|
|
generate_jni("midi_jni_headers") {
|
|
sources = [
|
|
"java/src/org/chromium/midi/MidiDeviceAndroid.java",
|
|
"java/src/org/chromium/midi/MidiInputPortAndroid.java",
|
|
"java/src/org/chromium/midi/MidiManagerAndroid.java",
|
|
"java/src/org/chromium/midi/MidiOutputPortAndroid.java",
|
|
"java/src/org/chromium/midi/UsbMidiDeviceAndroid.java",
|
|
"java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java",
|
|
]
|
|
jni_package = "midi"
|
|
}
|
|
}
|
|
|
|
component("midi") {
|
|
sources = [
|
|
"message_util.cc",
|
|
"message_util.h",
|
|
"midi_export.h",
|
|
"midi_manager.cc",
|
|
"midi_manager.h",
|
|
"midi_manager_mac.cc",
|
|
"midi_manager_mac.h",
|
|
"midi_message_queue.cc",
|
|
"midi_message_queue.h",
|
|
"midi_port_info.cc",
|
|
"midi_port_info.h",
|
|
"midi_service.cc",
|
|
"midi_service.h",
|
|
"midi_switches.cc",
|
|
"midi_switches.h",
|
|
"task_service.cc",
|
|
"task_service.h",
|
|
]
|
|
|
|
configs += [ ":midi_config" ]
|
|
|
|
defines = [ "MIDI_IMPLEMENTATION" ]
|
|
deps = [
|
|
":mojo",
|
|
"//base",
|
|
]
|
|
libs = []
|
|
|
|
if (is_android) {
|
|
# TODO(yhirano): Consider having "android" subdirectory.
|
|
sources += [
|
|
"midi_device_android.cc",
|
|
"midi_device_android.h",
|
|
"midi_input_port_android.cc",
|
|
"midi_input_port_android.h",
|
|
"midi_manager_android.cc",
|
|
"midi_manager_android.h",
|
|
"midi_output_port_android.cc",
|
|
"midi_output_port_android.h",
|
|
"usb_midi_device_android.cc",
|
|
"usb_midi_device_android.h",
|
|
"usb_midi_device_factory_android.cc",
|
|
"usb_midi_device_factory_android.h",
|
|
] + usb_midi_sources
|
|
|
|
# Since the USB sources are part of the component.
|
|
defines += [ "EXPORT_USB_MIDI" ]
|
|
|
|
deps += [
|
|
":midi_jni_headers",
|
|
"//base:i18n",
|
|
]
|
|
}
|
|
|
|
if (is_mac) {
|
|
libs += [
|
|
"CoreAudio.framework",
|
|
"CoreFoundation.framework",
|
|
"CoreMIDI.framework",
|
|
]
|
|
}
|
|
|
|
if (is_win) {
|
|
deps += [ "//device/usb" ]
|
|
sources += [
|
|
"midi_manager_win.cc",
|
|
"midi_manager_win.h",
|
|
"midi_manager_winrt.cc",
|
|
"midi_manager_winrt.h",
|
|
]
|
|
|
|
# This library is included in base in static builds.
|
|
if (is_component_build) {
|
|
libs += [ "cfgmgr32.lib" ]
|
|
}
|
|
}
|
|
|
|
if (use_alsa && use_udev) {
|
|
deps += [
|
|
"//crypto",
|
|
"//crypto:platform",
|
|
]
|
|
libs += [ "asound" ]
|
|
sources += [
|
|
"midi_manager_alsa.cc",
|
|
"midi_manager_alsa.h",
|
|
]
|
|
}
|
|
|
|
if (use_udev) {
|
|
deps += [ "//device/udev_linux" ]
|
|
}
|
|
}
|
|
|
|
mojom("mojo") {
|
|
sources = [
|
|
"midi_service.mojom",
|
|
]
|
|
}
|
|
|
|
test("midi_unittests") {
|
|
sources = [
|
|
"message_util_unittest.cc",
|
|
"midi_manager_unittest.cc",
|
|
"midi_manager_usb_unittest.cc",
|
|
"midi_message_queue_unittest.cc",
|
|
"task_service_unittest.cc",
|
|
"usb_midi_descriptor_parser_unittest.cc",
|
|
"usb_midi_input_stream_unittest.cc",
|
|
"usb_midi_output_stream_unittest.cc",
|
|
]
|
|
|
|
configs += [ ":midi_config" ]
|
|
deps = [
|
|
":midi",
|
|
"//base/test/:run_all_unittests",
|
|
"//base/test/:test_support",
|
|
"//testing/gtest",
|
|
]
|
|
|
|
if (is_android) {
|
|
deps += [ ":midi_java" ]
|
|
} else {
|
|
sources += usb_midi_sources
|
|
}
|
|
|
|
if (is_mac) {
|
|
sources += [ "midi_manager_mac_unittest.cc" ]
|
|
libs = [ "CoreMIDI.framework" ]
|
|
}
|
|
|
|
if (use_alsa && use_udev) {
|
|
sources += [ "midi_manager_alsa_unittest.cc" ]
|
|
}
|
|
|
|
# This target should not require the Chrome executable to run.
|
|
assert_no_deps = [ "//chrome" ]
|
|
}
|
|
|
|
fuzzer_test("midi_webmidi_data_validator_fuzzer") {
|
|
sources = [
|
|
"midi_webmidi_data_validator_fuzzer.cc",
|
|
]
|
|
seed_corpus = "fuzz/corpus"
|
|
deps = [
|
|
":midi",
|
|
]
|
|
}
|
|
|
|
fuzzer_test("midi_message_queue_fuzzer") {
|
|
sources = [
|
|
"midi_message_queue_fuzzer.cc",
|
|
]
|
|
seed_corpus = "fuzz/corpus"
|
|
deps = [
|
|
":midi",
|
|
]
|
|
}
|