OLD | NEW |
| (Empty) |
1 # Copyright 2015 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/android/config.gni") | |
6 import("//build/config/features.gni") | |
7 import("//media/media_options.gni") | |
8 import("//testing/test.gni") | |
9 | |
10 if (is_android) { | |
11 # For generate_jni(). | |
12 import("//build/config/android/rules.gni") | |
13 } | |
14 | |
15 # Common configuration for targets in the media/midi directory. | |
16 config("midi_config") { | |
17 if (use_alsa) { | |
18 defines = [ "USE_ALSA" ] | |
19 } | |
20 | |
21 visibility = [ ":*" ] | |
22 } | |
23 | |
24 # USB MIDI specific source files that are used in Android port, and unit tests. | |
25 source_set("usb_midi") { | |
26 sources = [ | |
27 "midi_manager_usb.cc", | |
28 "midi_manager_usb.h", | |
29 "usb_midi_descriptor_parser.cc", | |
30 "usb_midi_descriptor_parser.h", | |
31 "usb_midi_device.h", | |
32 "usb_midi_input_stream.cc", | |
33 "usb_midi_input_stream.h", | |
34 "usb_midi_jack.h", | |
35 "usb_midi_output_stream.cc", | |
36 "usb_midi_output_stream.h", | |
37 ] | |
38 | |
39 defines = [ "MEDIA_IMPLEMENTATION" ] | |
40 deps = [ | |
41 "//base", | |
42 ] | |
43 } | |
44 | |
45 # Android specific Java source files that are used to generate jni header files. | |
46 if (is_android) { | |
47 android_library("midi_java") { | |
48 deps = [ | |
49 "//base:base_java", | |
50 ] | |
51 | |
52 DEPRECATED_java_in_dir = "java/src" | |
53 } | |
54 | |
55 generate_jni("midi_jni_headers") { | |
56 sources = [ | |
57 "java/src/org/chromium/media/midi/UsbMidiDeviceAndroid.java", | |
58 "java/src/org/chromium/media/midi/UsbMidiDeviceFactoryAndroid.java", | |
59 ] | |
60 jni_package = "media/midi" | |
61 } | |
62 } | |
63 | |
64 component("midi") { | |
65 sources = [ | |
66 "midi_manager.cc", | |
67 "midi_manager.h", | |
68 "midi_manager_mac.cc", | |
69 "midi_manager_mac.h", | |
70 "midi_manager_win.cc", | |
71 "midi_manager_win.h", | |
72 "midi_message_queue.cc", | |
73 "midi_message_queue.h", | |
74 "midi_message_util.cc", | |
75 "midi_message_util.h", | |
76 "midi_port_info.cc", | |
77 "midi_port_info.h", | |
78 "midi_scheduler.cc", | |
79 "midi_scheduler.h", | |
80 ] | |
81 | |
82 configs += [ ":midi_config" ] | |
83 | |
84 defines = [ "MEDIA_IMPLEMENTATION" ] | |
85 deps = [] | |
86 libs = [] | |
87 | |
88 if (is_android) { | |
89 sources += [ | |
90 "midi_jni_registrar.cc", | |
91 "midi_jni_registrar.h", | |
92 "midi_manager_android.cc", | |
93 "usb_midi_device_android.cc", | |
94 "usb_midi_device_android.h", | |
95 "usb_midi_device_factory_android.cc", | |
96 "usb_midi_device_factory_android.h", | |
97 ] | |
98 | |
99 deps += [ | |
100 ":usb_midi", | |
101 ":midi_jni_headers", | |
102 ] | |
103 } | |
104 | |
105 if (is_mac) { | |
106 libs += [ | |
107 "CoreAudio.framework", | |
108 "CoreMIDI.framework", | |
109 ] | |
110 } | |
111 | |
112 if (is_win) { | |
113 deps += [ "//device/usb" ] | |
114 } | |
115 | |
116 if (use_alsa) { | |
117 deps += [ | |
118 "//crypto", | |
119 "//crypto:platform", | |
120 ] | |
121 libs += [ "asound" ] | |
122 sources += [ | |
123 "midi_manager_alsa.cc", | |
124 "midi_manager_alsa.h", | |
125 ] | |
126 } | |
127 | |
128 if (use_udev) { | |
129 deps += [ "//device/udev_linux" ] | |
130 } | |
131 } | |
132 | |
133 test("midi_unittests") { | |
134 sources = [ | |
135 "midi_manager_unittest.cc", | |
136 "midi_manager_usb_unittest.cc", | |
137 "midi_message_queue_unittest.cc", | |
138 "midi_message_util_unittest.cc", | |
139 "usb_midi_descriptor_parser_unittest.cc", | |
140 "usb_midi_input_stream_unittest.cc", | |
141 "usb_midi_output_stream_unittest.cc", | |
142 ] | |
143 | |
144 configs += [ ":midi_config" ] | |
145 deps = [ | |
146 ":midi", | |
147 "//base/test/:run_all_unittests", | |
148 "//base/test/:test_support", | |
149 "//testing/gtest", | |
150 ] | |
151 | |
152 if (!is_android) { | |
153 deps += [ ":usb_midi" ] | |
154 } | |
155 | |
156 if (is_mac) { | |
157 sources += [ "midi_manager_mac_unittest.cc" ] | |
158 } | |
159 | |
160 if (use_alsa) { | |
161 sources += [ "midi_manager_alsa_unittest.cc" ] | |
162 } | |
163 } | |
OLD | NEW |