mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1747196 - Build the Web MIDI midir backend only on known supported platforms rather than excluding unsupported ones r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D134491
This commit is contained in:
parent
5f4fff5ef8
commit
efba31192f
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2020,7 +2020,6 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"mapped_hyph",
|
"mapped_hyph",
|
||||||
"mdns_service",
|
"mdns_service",
|
||||||
"midir",
|
|
||||||
"midir_impl",
|
"midir_impl",
|
||||||
"mozurl",
|
"mozurl",
|
||||||
"mp4parse_capi",
|
"mp4parse_capi",
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
#include "MIDIPlatformService.h"
|
#include "MIDIPlatformService.h"
|
||||||
#include "MIDIMessageQueue.h"
|
#include "MIDIMessageQueue.h"
|
||||||
#include "TestMIDIPlatformService.h"
|
#include "TestMIDIPlatformService.h"
|
||||||
#ifndef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WEBMIDI_MIDIR_IMPL
|
||||||
# include "midirMIDIPlatformService.h"
|
# include "midirMIDIPlatformService.h"
|
||||||
#endif // MOZ_WIDGET_ANDROID
|
#endif // MOZ_WEBMIDI_MIDIR_IMPL
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
#include "mozilla/StaticPrefs_midi.h"
|
#include "mozilla/StaticPrefs_midi.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
@ -185,11 +185,11 @@ MIDIPlatformService* MIDIPlatformService::Get() {
|
|||||||
if (StaticPrefs::midi_testing()) {
|
if (StaticPrefs::midi_testing()) {
|
||||||
gMIDIPlatformService = new TestMIDIPlatformService();
|
gMIDIPlatformService = new TestMIDIPlatformService();
|
||||||
}
|
}
|
||||||
#ifndef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WEBMIDI_MIDIR_IMPL
|
||||||
else {
|
else {
|
||||||
gMIDIPlatformService = new midirMIDIPlatformService();
|
gMIDIPlatformService = new midirMIDIPlatformService();
|
||||||
}
|
}
|
||||||
#endif // MOZ_WIDGET_ANDROID
|
#endif // MOZ_WEBMIDI_MIDIR_IMPL
|
||||||
gMIDIPlatformService->Init();
|
gMIDIPlatformService->Init();
|
||||||
}
|
}
|
||||||
return gMIDIPlatformService;
|
return gMIDIPlatformService;
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
if CONFIG["OS_TARGET"] != "Android":
|
|
||||||
DIRS += ["midir_impl"]
|
|
||||||
|
|
||||||
IPDL_SOURCES += [
|
IPDL_SOURCES += [
|
||||||
"MIDITypes.ipdlh",
|
"MIDITypes.ipdlh",
|
||||||
"PMIDIManager.ipdl",
|
"PMIDIManager.ipdl",
|
||||||
@ -58,16 +55,17 @@ UNIFIED_SOURCES += [
|
|||||||
|
|
||||||
include("/ipc/chromium/chromium-config.mozbuild")
|
include("/ipc/chromium/chromium-config.mozbuild")
|
||||||
|
|
||||||
if CONFIG["OS_TARGET"] == "Linux":
|
if CONFIG["MOZ_WEBMIDI_MIDIR_IMPL"]:
|
||||||
OS_LIBS += ["asound"] # Required by midir
|
DEFINES["MOZ_WEBMIDI_MIDIR_IMPL"] = True
|
||||||
UNIFIED_SOURCES += ["AlsaCompatibility.cpp"]
|
DIRS += ["midir_impl"]
|
||||||
|
|
||||||
|
|
||||||
if CONFIG["OS_TARGET"] != "Android":
|
|
||||||
UNIFIED_SOURCES += [
|
UNIFIED_SOURCES += [
|
||||||
"midirMIDIPlatformService.cpp",
|
"midirMIDIPlatformService.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG["OS_TARGET"] == "Linux":
|
||||||
|
OS_LIBS += ["asound"] # Required by midir
|
||||||
|
UNIFIED_SOURCES += ["AlsaCompatibility.cpp"]
|
||||||
|
|
||||||
FINAL_LIBRARY = "xul"
|
FINAL_LIBRARY = "xul"
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
"/dom/base",
|
"/dom/base",
|
||||||
|
@ -31,6 +31,7 @@ glean_with_gecko = ["gkrust-shared/glean_with_gecko"]
|
|||||||
with_dbus = ["gkrust-shared/with_dbus"]
|
with_dbus = ["gkrust-shared/with_dbus"]
|
||||||
thread_sanitizer = ["gkrust-shared/thread_sanitizer"]
|
thread_sanitizer = ["gkrust-shared/thread_sanitizer"]
|
||||||
oxidized_breakpad = ["gkrust-shared/oxidized_breakpad"]
|
oxidized_breakpad = ["gkrust-shared/oxidized_breakpad"]
|
||||||
|
webmidi_midir_impl = ["gkrust-shared/webmidi_midir_impl"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bench-collections-gtest = { path = "../../../../xpcom/rust/gtest/bench-collections" }
|
bench-collections-gtest = { path = "../../../../xpcom/rust/gtest/bench-collections" }
|
||||||
|
@ -31,6 +31,7 @@ glean_with_gecko = ["gkrust-shared/glean_with_gecko"]
|
|||||||
with_dbus = ["gkrust-shared/with_dbus"]
|
with_dbus = ["gkrust-shared/with_dbus"]
|
||||||
thread_sanitizer = ["gkrust-shared/thread_sanitizer"]
|
thread_sanitizer = ["gkrust-shared/thread_sanitizer"]
|
||||||
oxidized_breakpad = ["gkrust-shared/oxidized_breakpad"]
|
oxidized_breakpad = ["gkrust-shared/oxidized_breakpad"]
|
||||||
|
webmidi_midir_impl = ["gkrust-shared/webmidi_midir_impl"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gkrust-shared = { path = "shared" }
|
gkrust-shared = { path = "shared" }
|
||||||
|
@ -81,3 +81,6 @@ if CONFIG['MOZ_ENABLE_DBUS']:
|
|||||||
|
|
||||||
if CONFIG["MOZ_CRASHREPORTER"] and CONFIG['MOZ_OXIDIZED_BREAKPAD']:
|
if CONFIG["MOZ_CRASHREPORTER"] and CONFIG['MOZ_OXIDIZED_BREAKPAD']:
|
||||||
gkrust_features += ['oxidized_breakpad']
|
gkrust_features += ['oxidized_breakpad']
|
||||||
|
|
||||||
|
if CONFIG["MOZ_WEBMIDI_MIDIR_IMPL"]:
|
||||||
|
gkrust_features += ['webmidi_midir_impl']
|
||||||
|
@ -52,6 +52,7 @@ fluent-langneg = { version = "0.13", features = ["cldr"] }
|
|||||||
fluent-langneg-ffi = { path = "../../../../intl/locale/rust/fluent-langneg-ffi" }
|
fluent-langneg-ffi = { path = "../../../../intl/locale/rust/fluent-langneg-ffi" }
|
||||||
rust_minidump_writer_linux = { path = "../../../crashreporter/rust_minidump_writer_linux", optional = true }
|
rust_minidump_writer_linux = { path = "../../../crashreporter/rust_minidump_writer_linux", optional = true }
|
||||||
gecko-profiler = { path = "../../../../tools/profiler/rust-api"}
|
gecko-profiler = { path = "../../../../tools/profiler/rust-api"}
|
||||||
|
midir_impl = { path = "../../../../dom/midi/midir_impl", optional = true }
|
||||||
|
|
||||||
# Note: `modern_sqlite` means rusqlite's bindings file be for a sqlite with
|
# Note: `modern_sqlite` means rusqlite's bindings file be for a sqlite with
|
||||||
# version less than or equal to what we link to. This isn't a problem because we
|
# version less than or equal to what we link to. This isn't a problem because we
|
||||||
@ -72,8 +73,6 @@ qcms = { path = "../../../../gfx/qcms", features = ["c_bindings", "neon"], defau
|
|||||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||||
viaduct = { git = "https://github.com/mozilla/application-services", rev = "c51b63595a27a6ef45161012323e0261475c10c9"}
|
viaduct = { git = "https://github.com/mozilla/application-services", rev = "c51b63595a27a6ef45161012323e0261475c10c9"}
|
||||||
webext_storage_bridge = { path = "../../../components/extensions/storage/webext_storage_bridge" }
|
webext_storage_bridge = { path = "../../../components/extensions/storage/webext_storage_bridge" }
|
||||||
midir = { git = "https://github.com/mozilla/midir.git", rev = "dc87afbd4361ae5ec192e1fab0a6409dd13d4011" }
|
|
||||||
midir_impl = { path = "../../../../dom/midi/midir_impl" }
|
|
||||||
|
|
||||||
# https://github.com/mozilla/audioipc-2/commits/master
|
# https://github.com/mozilla/audioipc-2/commits/master
|
||||||
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||||
@ -110,6 +109,7 @@ glean_with_gecko = ["fog_control/with_gecko"]
|
|||||||
oxidized_breakpad = ["rust_minidump_writer_linux"]
|
oxidized_breakpad = ["rust_minidump_writer_linux"]
|
||||||
with_dbus = ["audio_thread_priority/with_dbus"]
|
with_dbus = ["audio_thread_priority/with_dbus"]
|
||||||
thread_sanitizer = ["xpcom/thread_sanitizer"]
|
thread_sanitizer = ["xpcom/thread_sanitizer"]
|
||||||
|
webmidi_midir_impl = ["midir_impl"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
@ -79,17 +79,14 @@ extern crate localization_ffi;
|
|||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
extern crate viaduct;
|
extern crate viaduct;
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
|
||||||
extern crate midir;
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
|
||||||
extern crate midir_impl;
|
|
||||||
|
|
||||||
extern crate gecko_logger;
|
extern crate gecko_logger;
|
||||||
|
|
||||||
#[cfg(feature = "oxidized_breakpad")]
|
#[cfg(feature = "oxidized_breakpad")]
|
||||||
extern crate rust_minidump_writer_linux;
|
extern crate rust_minidump_writer_linux;
|
||||||
|
|
||||||
|
#[cfg(feature = "webmidi_midir_impl")]
|
||||||
|
extern crate midir_impl;
|
||||||
|
|
||||||
extern crate log;
|
extern crate log;
|
||||||
use log::info;
|
use log::info;
|
||||||
|
|
||||||
|
@ -169,22 +169,32 @@ imply_option("--enable-profiling", dmd)
|
|||||||
imply_option("--enable-jemalloc", dmd, when=compile_environment)
|
imply_option("--enable-jemalloc", dmd, when=compile_environment)
|
||||||
imply_option("--enable-replace-malloc", dmd, when=compile_environment)
|
imply_option("--enable-replace-malloc", dmd, when=compile_environment)
|
||||||
|
|
||||||
# ALSA cubeb backend
|
# midir-based Web MIDI support
|
||||||
# ==============================================================
|
# ==============================================================
|
||||||
@depends(target)
|
@depends(target)
|
||||||
def alsa_default_check(target):
|
def midir_linux_support(target):
|
||||||
return target.kernel == "Linux" and target.os != "Android"
|
return target.kernel == "Linux" and target.os != "Android"
|
||||||
|
|
||||||
|
|
||||||
|
@depends(target, midir_linux_support)
|
||||||
|
def midir_support(target, midir_linux_support):
|
||||||
|
if target.os in ("WINNT", "OSX") or midir_linux_support:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
set_config("MOZ_WEBMIDI_MIDIR_IMPL", midir_support)
|
||||||
|
|
||||||
|
# ALSA cubeb backend
|
||||||
|
# ==============================================================
|
||||||
option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
|
option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.")
|
||||||
|
|
||||||
|
|
||||||
@depends("--enable-alsa", alsa_default_check)
|
@depends("--enable-alsa", midir_linux_support)
|
||||||
def enable_alsa_or_alsa_default_check(alsa_enabled, alsa_default_check):
|
def enable_alsa_or_midir_linux_support(alsa_enabled, midir_linux_support):
|
||||||
return alsa_enabled or alsa_default_check
|
return alsa_enabled or midir_linux_support
|
||||||
|
|
||||||
|
|
||||||
pkg_check_modules("MOZ_ALSA", "alsa", when=enable_alsa_or_alsa_default_check)
|
pkg_check_modules("MOZ_ALSA", "alsa", when=enable_alsa_or_midir_linux_support)
|
||||||
|
|
||||||
set_config("MOZ_ALSA", True, when="--enable-alsa")
|
set_config("MOZ_ALSA", True, when="--enable-alsa")
|
||||||
set_define("MOZ_ALSA", True, when="--enable-alsa")
|
set_define("MOZ_ALSA", True, when="--enable-alsa")
|
||||||
|
Loading…
Reference in New Issue
Block a user