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"] exclude = ["/examples"]
[features] [features]
default = ["xm", "midi"] default = ["agb"]
agb = ["dep:agb"]
xm = ["dep:agb_xm"] xm = ["dep:agb_xm"]
midi = ["dep:agb_midi"] midi = ["dep:agb_midi"]
[dependencies] [dependencies]
agb_midi = { version = "0.20.5", path = "../agb-midi", optional = true } agb_midi = { version = "0.20.5", path = "../agb-midi", optional = true }
agb_xm = { version = "0.20.5", path = "../agb-xm", 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 } agb_tracker_interop = { version = "0.20.5", path = "../agb-tracker-interop", default-features = false }
[profile.dev] [profile.dev]

View file

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

View file

@ -12,6 +12,7 @@ proc-macro = true
[dependencies] [dependencies]
agb_xm_core = { version = "0.20.5", path = "../agb-xm-core" } 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-macro-error = "1"
proc-macro2 = "1" proc-macro2 = "1"