diff options
author | brettw <brettw@chromium.org> | 2015-05-05 12:43:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-05 19:44:01 +0000 |
commit | 51d04a1d341fe739beaff1528095f025a66f3fcc (patch) | |
tree | f96b54edeaa51447ef49dcdc057747b346fdbc7a /media | |
parent | 7bd00a274893ee7334dfbc78ca5046f1af876382 (diff) | |
download | chromium_src-51d04a1d341fe739beaff1528095f025a66f3fcc.zip chromium_src-51d04a1d341fe739beaff1528095f025a66f3fcc.tar.gz chromium_src-51d04a1d341fe739beaff1528095f025a66f3fcc.tar.bz2 |
GN Windows component build fixes
The main thing this fixes is the midi component. Previously midi_unittests was never compiled on any Windows component bot and the component build was all messed up. This patch makes the component build work correctly for this component.
Remove installer_util_unittests.rc and its header. These seem to be autogenerated Visual Studio files. They just include the strings resource file, but GN includes the strings resource file itself by nature of the dependencies (GYP doesn't do this).
CQ_EXTRA_TRYBOTS=tryserver.chromium.linux:android_chromium_gn_compile_dbg,android_chromium_gn_compile_rel;tryserver.chromium.win:win8_chromium_gn_rel,win8_chromium_gn_dbg
BUG=470212
Review URL: https://codereview.chromium.org/1121363002
Cr-Commit-Position: refs/heads/master@{#328383}
Diffstat (limited to 'media')
-rw-r--r-- | media/midi/BUILD.gn | 63 | ||||
-rw-r--r-- | media/midi/midi.gyp | 10 | ||||
-rw-r--r-- | media/midi/midi_export.h | 29 | ||||
-rw-r--r-- | media/midi/midi_jni_registrar.h | 4 | ||||
-rw-r--r-- | media/midi/midi_manager.h | 6 | ||||
-rw-r--r-- | media/midi/midi_manager_alsa.h | 3 | ||||
-rw-r--r-- | media/midi/midi_manager_mac.h | 3 | ||||
-rw-r--r-- | media/midi/midi_manager_usb.h | 10 | ||||
-rw-r--r-- | media/midi/midi_message_queue.h | 4 | ||||
-rw-r--r-- | media/midi/midi_message_util.h | 4 | ||||
-rw-r--r-- | media/midi/midi_port_info.h | 4 | ||||
-rw-r--r-- | media/midi/midi_scheduler.h | 4 | ||||
-rw-r--r-- | media/midi/usb_midi_descriptor_parser.h | 4 | ||||
-rw-r--r-- | media/midi/usb_midi_device.h | 6 | ||||
-rw-r--r-- | media/midi/usb_midi_device_android.h | 4 | ||||
-rw-r--r-- | media/midi/usb_midi_device_factory_android.h | 5 | ||||
-rw-r--r-- | media/midi/usb_midi_export.h | 33 | ||||
-rw-r--r-- | media/midi/usb_midi_input_stream.h | 6 | ||||
-rw-r--r-- | media/midi/usb_midi_jack.h | 4 | ||||
-rw-r--r-- | media/midi/usb_midi_output_stream.h | 4 |
20 files changed, 140 insertions, 70 deletions
diff --git a/media/midi/BUILD.gn b/media/midi/BUILD.gn index 0faa867..8a043a5 100644 --- a/media/midi/BUILD.gn +++ b/media/midi/BUILD.gn @@ -26,25 +26,21 @@ config("midi_config") { } # USB MIDI specific source files that are used in Android port, and unit tests. -source_set("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_input_stream.cc", - "usb_midi_input_stream.h", - "usb_midi_jack.h", - "usb_midi_output_stream.cc", - "usb_midi_output_stream.h", - ] - - defines = [ "MEDIA_IMPLEMENTATION" ] - deps = [ - "//base", - ] -} +# 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) { @@ -67,6 +63,7 @@ if (is_android) { component("midi") { sources = [ + "midi_export.h", "midi_manager.cc", "midi_manager.h", "midi_manager_mac.cc", @@ -85,25 +82,29 @@ component("midi") { configs += [ ":midi_config" ] - defines = [ "MEDIA_IMPLEMENTATION" ] - deps = [] + defines = [ "MIDI_IMPLEMENTATION" ] + deps = [ + "//base", + ] libs = [] if (is_android) { sources += [ - "midi_jni_registrar.cc", - "midi_jni_registrar.h", - "midi_manager_android.cc", - "usb_midi_device_android.cc", - "usb_midi_device_android.h", - "usb_midi_device_factory_android.cc", - "usb_midi_device_factory_android.h", - ] + "midi_jni_registrar.cc", + "midi_jni_registrar.h", + "midi_manager_android.cc", + "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 += [ "//base:i18n", ":midi_jni_headers", - ":usb_midi", ] } @@ -155,7 +156,7 @@ test("midi_unittests") { ] if (!is_android) { - deps += [ ":usb_midi" ] + sources += usb_midi_sources } if (is_mac) { diff --git a/media/midi/midi.gyp b/media/midi/midi.gyp index 554f1a9..ec5448d 100644 --- a/media/midi/midi.gyp +++ b/media/midi/midi.gyp @@ -20,6 +20,7 @@ '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', @@ -36,12 +37,13 @@ '../../base/base.gyp:base', ], 'defines': [ - 'MEDIA_IMPLEMENTATION', + 'MIDI_IMPLEMENTATION', ], 'include_dirs': [ '../..', ], 'sources': [ + 'midi_export.h', 'midi_manager.cc', 'midi_manager.h', 'midi_manager_android.cc', @@ -98,6 +100,9 @@ 'midi_jni_registrar.cc', 'midi_jni_registrar.h', ], + 'defines': [ + 'EXPORT_USB_MIDI', + ], }], ['OS=="mac"', { 'link_settings': { @@ -124,9 +129,6 @@ '../../base/base.gyp:run_all_unittests', '../../testing/gtest.gyp:gtest', ], - 'defines': [ - 'MEDIA_IMPLEMENTATION', - ], 'include_dirs': [ '../..', ], diff --git a/media/midi/midi_export.h b/media/midi/midi_export.h new file mode 100644 index 0000000..18dc239 --- /dev/null +++ b/media/midi/midi_export.h @@ -0,0 +1,29 @@ +// 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. + +#ifndef MEDIA_MIDI_MIDI_EXPORT_H_ +#define MEDIA_MIDI_MIDI_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(MIDI_IMPLEMENTATION) +#define MIDI_EXPORT __declspec(dllexport) +#else +#define MIDI_EXPORT __declspec(dllimport) +#endif // defined(MIDI_IMPLEMENTATION) + +#else // defined(WIN32) +#if defined(MIDI_IMPLEMENTATION) +#define MIDI_EXPORT __attribute__((visibility("default"))) +#else +#define MIDI_EXPORT +#endif +#endif + +#else // defined(COMPONENT_BUILD) +#define MIDI_EXPORT +#endif + +#endif // MEDIA_MIDI_MIDI_EXPORT_H_ diff --git a/media/midi/midi_jni_registrar.h b/media/midi/midi_jni_registrar.h index f981e5c..6acad7d 100644 --- a/media/midi/midi_jni_registrar.h +++ b/media/midi/midi_jni_registrar.h @@ -7,13 +7,13 @@ #include <jni.h> -#include "media/base/media_export.h" +#include "media/midi/midi_export.h" namespace media { namespace midi { // Register all JNI bindings necessary for media/midi. -MEDIA_EXPORT bool RegisterJni(JNIEnv* env); +MIDI_EXPORT bool RegisterJni(JNIEnv* env); } // namespace midi } // namespace media diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h index 2904c11..fb9bf3d 100644 --- a/media/midi/midi_manager.h +++ b/media/midi/midi_manager.h @@ -12,7 +12,7 @@ #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "base/time/time.h" -#include "media/base/media_export.h" +#include "media/midi/midi_export.h" #include "media/midi/midi_port_info.h" #include "media/midi/midi_result.h" @@ -25,7 +25,7 @@ namespace media { // A MidiManagerClient registers with the MidiManager to receive MIDI data. // See MidiManager::RequestAccess() and MidiManager::ReleaseAccess() // for details. -class MEDIA_EXPORT MidiManagerClient { +class MIDI_EXPORT MidiManagerClient { public: virtual ~MidiManagerClient() {} @@ -63,7 +63,7 @@ class MEDIA_EXPORT MidiManagerClient { }; // Manages access to all MIDI hardware. -class MEDIA_EXPORT MidiManager { +class MIDI_EXPORT MidiManager { public: static const size_t kMaxPendingClientCount = 128; diff --git a/media/midi/midi_manager_alsa.h b/media/midi/midi_manager_alsa.h index 200c4c0..125a620 100644 --- a/media/midi/midi_manager_alsa.h +++ b/media/midi/midi_manager_alsa.h @@ -18,11 +18,12 @@ #include "base/threading/thread.h" #include "base/values.h" #include "device/udev_linux/scoped_udev.h" +#include "media/midi/midi_export.h" #include "media/midi/midi_manager.h" namespace media { -class MEDIA_EXPORT MidiManagerAlsa final : public MidiManager { +class MIDI_EXPORT MidiManagerAlsa final : public MidiManager { public: MidiManagerAlsa(); ~MidiManagerAlsa() override; diff --git a/media/midi/midi_manager_mac.h b/media/midi/midi_manager_mac.h index 85899d5..71c84e1 100644 --- a/media/midi/midi_manager_mac.h +++ b/media/midi/midi_manager_mac.h @@ -14,12 +14,13 @@ #include "base/callback.h" #include "base/compiler_specific.h" #include "base/threading/thread.h" +#include "media/midi/midi_export.h" #include "media/midi/midi_manager.h" #include "media/midi/midi_port_info.h" namespace media { -class MEDIA_EXPORT MidiManagerMac final : public MidiManager { +class MIDI_EXPORT MidiManagerMac final : public MidiManager { public: MidiManagerMac(); ~MidiManagerMac() override; diff --git a/media/midi/midi_manager_usb.h b/media/midi/midi_manager_usb.h index 417aac5..0c43310 100644 --- a/media/midi/midi_manager_usb.h +++ b/media/midi/midi_manager_usb.h @@ -11,12 +11,13 @@ #include "base/basictypes.h" #include "base/bind.h" #include "base/callback.h" +#include "base/compiler_specific.h" #include "base/containers/hash_tables.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" -#include "media/base/media_export.h" #include "media/midi/midi_manager.h" #include "media/midi/usb_midi_device.h" +#include "media/midi/usb_midi_export.h" #include "media/midi/usb_midi_input_stream.h" #include "media/midi/usb_midi_jack.h" #include "media/midi/usb_midi_output_stream.h" @@ -26,9 +27,10 @@ namespace media { class MidiScheduler; // MidiManager for USB-MIDI. -class MEDIA_EXPORT MidiManagerUsb : public MidiManager, - public UsbMidiDeviceDelegate, - public UsbMidiInputStream::Delegate { +class USB_MIDI_EXPORT MidiManagerUsb + : public MidiManager, + public UsbMidiDeviceDelegate, + NON_EXPORTED_BASE(public UsbMidiInputStream::Delegate) { public: explicit MidiManagerUsb(scoped_ptr<UsbMidiDevice::Factory> device_factory); ~MidiManagerUsb() override; diff --git a/media/midi/midi_message_queue.h b/media/midi/midi_message_queue.h index f565f18..f7e8fcf 100644 --- a/media/midi/midi_message_queue.h +++ b/media/midi/midi_message_queue.h @@ -9,7 +9,7 @@ #include <vector> #include "base/basictypes.h" -#include "media/base/media_export.h" +#include "media/midi/midi_export.h" namespace media { @@ -38,7 +38,7 @@ namespace media { // dispatch(next_message); // } // } -class MEDIA_EXPORT MidiMessageQueue { +class MIDI_EXPORT MidiMessageQueue { public: // Initializes the queue. Set true to |allow_running_status| to enable // "MIDI running status" reconstruction. diff --git a/media/midi/midi_message_util.h b/media/midi/midi_message_util.h index faaff17..c3e239e 100644 --- a/media/midi/midi_message_util.h +++ b/media/midi/midi_message_util.h @@ -9,7 +9,7 @@ #include <vector> #include "base/basictypes.h" -#include "media/base/media_export.h" +#include "media/midi/midi_export.h" namespace media { @@ -18,7 +18,7 @@ namespace media { // - not a valid status byte, namely data byte. // - the MIDI System Exclusive message. // - the End of System Exclusive message. -MEDIA_EXPORT size_t GetMidiMessageLength(uint8 status_byte); +MIDI_EXPORT size_t GetMidiMessageLength(uint8 status_byte); const uint8 kSysExByte = 0xf0; const uint8 kEndOfSysExByte = 0xf7; diff --git a/media/midi/midi_port_info.h b/media/midi/midi_port_info.h index 1b3eda7..c735a3b 100644 --- a/media/midi/midi_port_info.h +++ b/media/midi/midi_port_info.h @@ -9,7 +9,7 @@ #include <vector> #include "base/basictypes.h" -#include "media/base/media_export.h" +#include "media/midi/midi_export.h" namespace media { @@ -20,7 +20,7 @@ enum MidiPortState { MIDI_PORT_STATE_LAST = MIDI_PORT_OPENED, }; -struct MEDIA_EXPORT MidiPortInfo final { +struct MIDI_EXPORT MidiPortInfo final { MidiPortInfo(); MidiPortInfo(const std::string& in_id, const std::string& in_manufacturer, diff --git a/media/midi/midi_scheduler.h b/media/midi/midi_scheduler.h index 452328b..e14d3b6 100644 --- a/media/midi/midi_scheduler.h +++ b/media/midi/midi_scheduler.h @@ -7,7 +7,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" -#include "media/base/media_export.h" +#include "media/midi/midi_export.h" namespace media { @@ -15,7 +15,7 @@ class MidiManager; class MidiManagerClient; // TODO(crbug.com/467442): Make tasks cancelable per client. -class MEDIA_EXPORT MidiScheduler final { +class MIDI_EXPORT MidiScheduler final { public: explicit MidiScheduler(MidiManager* manager); ~MidiScheduler(); diff --git a/media/midi/usb_midi_descriptor_parser.h b/media/midi/usb_midi_descriptor_parser.h index cc07be3..b95d925 100644 --- a/media/midi/usb_midi_descriptor_parser.h +++ b/media/midi/usb_midi_descriptor_parser.h @@ -9,7 +9,7 @@ #include <vector> #include "base/basictypes.h" -#include "media/base/media_export.h" +#include "media/midi/usb_midi_export.h" #include "media/midi/usb_midi_jack.h" namespace media { @@ -20,7 +20,7 @@ class UsbMidiDevice; // generates input / output lists of MIDIPortInfo. // This is not a generic USB descriptor parser: this parser is designed // for collecting USB-MIDI jacks information from the descriptor. -class MEDIA_EXPORT UsbMidiDescriptorParser { +class USB_MIDI_EXPORT UsbMidiDescriptorParser { public: struct DeviceInfo { DeviceInfo() diff --git a/media/midi/usb_midi_device.h b/media/midi/usb_midi_device.h index 8128c62..4b283e1 100644 --- a/media/midi/usb_midi_device.h +++ b/media/midi/usb_midi_device.h @@ -11,7 +11,7 @@ #include "base/callback.h" #include "base/memory/scoped_vector.h" #include "base/time/time.h" -#include "media/base/media_export.h" +#include "media/midi/usb_midi_export.h" namespace media { @@ -20,7 +20,7 @@ class UsbMidiDevice; // Delegate class for UsbMidiDevice. // Each method is called when an corresponding event arrives at the device. -class MEDIA_EXPORT UsbMidiDeviceDelegate { +class USB_MIDI_EXPORT UsbMidiDeviceDelegate { public: virtual ~UsbMidiDeviceDelegate() {} @@ -40,7 +40,7 @@ class MEDIA_EXPORT UsbMidiDeviceDelegate { // UsbMidiDevice represents a USB-MIDI device. // This is an interface class and each platform-dependent implementation class // will be a derived class. -class MEDIA_EXPORT UsbMidiDevice { +class USB_MIDI_EXPORT UsbMidiDevice { public: typedef ScopedVector<UsbMidiDevice> Devices; diff --git a/media/midi/usb_midi_device_android.h b/media/midi/usb_midi_device_android.h index 7032cf7..cce84c2 100644 --- a/media/midi/usb_midi_device_android.h +++ b/media/midi/usb_midi_device_android.h @@ -12,12 +12,12 @@ #include "base/android/scoped_java_ref.h" #include "base/basictypes.h" #include "base/callback.h" -#include "media/base/media_export.h" #include "media/midi/usb_midi_device.h" +#include "media/midi/usb_midi_export.h" namespace media { -class MEDIA_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice { +class USB_MIDI_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice { public: typedef base::android::ScopedJavaLocalRef<jobject> ObjectRef; diff --git a/media/midi/usb_midi_device_factory_android.h b/media/midi/usb_midi_device_factory_android.h index 7beb9fd..32b85de 100644 --- a/media/midi/usb_midi_device_factory_android.h +++ b/media/midi/usb_midi_device_factory_android.h @@ -13,13 +13,14 @@ #include "base/callback.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" -#include "media/base/media_export.h" #include "media/midi/usb_midi_device.h" +#include "media/midi/usb_midi_export.h" namespace media { // This class enumerates UsbMidiDevices. -class MEDIA_EXPORT UsbMidiDeviceFactoryAndroid : public UsbMidiDevice::Factory { +class USB_MIDI_EXPORT UsbMidiDeviceFactoryAndroid + : public UsbMidiDevice::Factory { public: UsbMidiDeviceFactoryAndroid(); ~UsbMidiDeviceFactoryAndroid() override; diff --git a/media/midi/usb_midi_export.h b/media/midi/usb_midi_export.h new file mode 100644 index 0000000..0335d63 --- /dev/null +++ b/media/midi/usb_midi_export.h @@ -0,0 +1,33 @@ +// 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. + +#ifndef MEDIA_MIDI_USB_MIDI_EXPORT_H_ +#define MEDIA_MIDI_USB_MIDI_EXPORT_H_ + +// These files can be included as part of the midi component using the +// MIDI_IMPLEMENTATION define (where we want to export in the component build), +// or in the unit tests (where we never want to export/import, even in +// component mode). The EXPORT_USB_MIDI define controls this. +#if defined(COMPONENT_BUILD) && defined(EXPORT_USB_MIDI) +#if defined(WIN32) + +#if defined(MIDI_IMPLEMENTATION) +#define USB_MIDI_EXPORT __declspec(dllexport) +#else +#define USB_MIDI_EXPORT __declspec(dllimport) +#endif // defined(MIDI_IMPLEMENTATION) + +#else // defined(WIN32) +#if defined(MIDI_IMPLEMENTATION) +#define USB_MIDI_EXPORT __attribute__((visibility("default"))) +#else +#define USB_MIDI_EXPORT +#endif +#endif + +#else // defined(COMPONENT_BUILD) +#define USB_MIDI_EXPORT +#endif + +#endif // MEDIA_MIDI_USB_MIDI_EXPORT_H_ diff --git a/media/midi/usb_midi_input_stream.h b/media/midi/usb_midi_input_stream.h index bd12706..589cbb0 100644 --- a/media/midi/usb_midi_input_stream.h +++ b/media/midi/usb_midi_input_stream.h @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/containers/hash_tables.h" #include "base/time/time.h" -#include "media/base/media_export.h" +#include "media/midi/usb_midi_export.h" #include "media/midi/usb_midi_jack.h" namespace media { @@ -21,9 +21,9 @@ class UsbMidiDevice; // UsbMidiInputStream converts USB-MIDI data to MIDI data. // See "USB Device Class Definition for MIDI Devices" Release 1.0, // Section 4 "USB-MIDI Event Packets" for details. -class MEDIA_EXPORT UsbMidiInputStream { +class USB_MIDI_EXPORT UsbMidiInputStream { public: - class MEDIA_EXPORT Delegate { + class USB_MIDI_EXPORT Delegate { public: virtual ~Delegate() {} // This function is called when some data arrives to a USB-MIDI jack. diff --git a/media/midi/usb_midi_jack.h b/media/midi/usb_midi_jack.h index 271cad8..be56af9 100644 --- a/media/midi/usb_midi_jack.h +++ b/media/midi/usb_midi_jack.h @@ -6,14 +6,14 @@ #define MEDIA_MIDI_USB_MIDI_JACK_H_ #include "base/basictypes.h" -#include "media/base/media_export.h" +#include "media/midi/usb_midi_export.h" namespace media { class UsbMidiDevice; // UsbMidiJack represents an EMBEDDED MIDI jack. -struct MEDIA_EXPORT UsbMidiJack { +struct USB_MIDI_EXPORT UsbMidiJack { // The direction of the endpoint associated with an EMBEDDED MIDI jack. // Note that an IN MIDI jack associated with an OUT endpoint has // ***DIRECTION_OUT*** direction. diff --git a/media/midi/usb_midi_output_stream.h b/media/midi/usb_midi_output_stream.h index 1d98d58..ec36fc6 100644 --- a/media/midi/usb_midi_output_stream.h +++ b/media/midi/usb_midi_output_stream.h @@ -8,7 +8,7 @@ #include <vector> #include "base/basictypes.h" -#include "media/base/media_export.h" +#include "media/midi/usb_midi_export.h" #include "media/midi/usb_midi_jack.h" namespace media { @@ -16,7 +16,7 @@ namespace media { // UsbMidiOutputStream converts MIDI data to USB-MIDI data. // See "USB Device Class Definition for MIDI Devices" Release 1.0, // Section 4 "USB-MIDI Event Packets" for details. -class MEDIA_EXPORT UsbMidiOutputStream { +class USB_MIDI_EXPORT UsbMidiOutputStream { public: explicit UsbMidiOutputStream(const UsbMidiJack& jack); |