Make agb optional for the tracker

This commit is contained in:
Gwilym Inzani 2024-06-05 10:20:58 +01:00
parent 3305ca0ff2
commit d0925f6787
3 changed files with 12 additions and 5 deletions

View file

@ -9,14 +9,18 @@ repository = "https://github.com/agbrs/agb"
exclude = ["/examples"]
[features]
default = ["xm", "midi"]
default = ["agb"]
agb = ["dep:agb"]
xm = ["dep:agb_xm"]
midi = ["dep:agb_midi"]
[dependencies]
agb_midi = { version = "0.20.5", path = "../agb-midi", optional = true }
agb_xm = { version = "0.20.5", path = "../agb-xm", optional = true }
agb = { version = "0.20.5", path = "../../agb" }
agb = { version = "0.20.5", path = "../../agb", optional = true }
agb_fixnum = { version = "0.20.5", path = "../../agb-fixnum" }
agb_tracker_interop = { version = "0.20.5", path = "../agb-tracker-interop", default-features = false }
[profile.dev]

View file

@ -72,7 +72,7 @@ use alloc::vec::Vec;
pub use mixer::{Mixer, SoundChannel};
use agb::fixnum::Num;
use agb_fixnum::Num;
/// Import an XM file. Only available if you have the `xm` feature enabled (enabled by default).
#[cfg(feature = "xm")]
@ -87,7 +87,7 @@ pub use agb_midi::include_midi;
#[doc(hidden)]
pub mod __private {
pub use agb::fixnum::Num;
pub use agb_fixnum::Num;
pub use agb_tracker_interop;
}
@ -520,12 +520,13 @@ impl<M: Mixer> Default for TrackerChannel<M> {
}
}
#[cfg(test)]
#[cfg(all(test, feature = "agb"))]
#[agb::entry]
fn main(gba: agb::Gba) -> ! {
loop {}
}
#[cfg(feature = "agb")]
impl SoundChannel for agb::sound::mixer::SoundChannel {
fn new(data: &'static [u8]) -> Self {
Self::new(data)
@ -564,6 +565,7 @@ impl SoundChannel for agb::sound::mixer::SoundChannel {
}
}
#[cfg(feature = "agb")]
impl<'gba> Mixer for agb::sound::mixer::Mixer<'gba> {
type ChannelId = agb::sound::mixer::ChannelId;
type SoundChannel = agb::sound::mixer::SoundChannel;

View file

@ -12,6 +12,7 @@ proc-macro = true
[dependencies]
agb_xm_core = { version = "0.20.5", path = "../agb-xm-core" }
agb_tracker_interop = { version = "0.20.2", path = "../agb-tracker-interop", features = ["quote"] }
proc-macro-error = "1"
proc-macro2 = "1"