diff --git a/tracker/agb-tracker/Cargo.toml b/tracker/agb-tracker/Cargo.toml index d1d9d7d5..7da1029d 100644 --- a/tracker/agb-tracker/Cargo.toml +++ b/tracker/agb-tracker/Cargo.toml @@ -6,7 +6,11 @@ license = "MPL-2.0" description = "Library for playing tracker music. Designed for use with the agb library for the Game Boy Advance." repository = "https://github.com/agbrs/agb" +[features] +default = ["xm"] +xm = ["dep:agb_xm"] + [dependencies] -agb_xm = { version = "0.15.0", path = "../agb-xm" } +agb_xm = { version = "0.15.0", path = "../agb-xm", optional = true } agb = { version = "0.15.0", path = "../../agb" } agb_tracker_interop = { version = "0.15.0", path = "../agb-tracker-interop", default-features = false } \ No newline at end of file diff --git a/tracker/agb-xm-core/Cargo.toml b/tracker/agb-xm-core/Cargo.toml new file mode 100644 index 00000000..7439041b --- /dev/null +++ b/tracker/agb-xm-core/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "agb_xm_core" +version = "0.15.0" +authors = ["Gwilym Kuiper "] +edition = "2021" +license = "MPL-2.0" +description = "Library for converting XM tracker files for use with agb-tracker on the Game Boy Advance. You shouldn't use this package directly" +repository = "https://github.com/agbrs/agb" + +[dependencies] +proc-macro-error = "1" +proc-macro2 = "1" +quote = "1" + +agb_tracker_interop = { version = "0.15.0", path = "../agb-tracker-interop" } \ No newline at end of file diff --git a/tracker/agb-xm-core/src/lib.rs b/tracker/agb-xm-core/src/lib.rs new file mode 100644 index 00000000..fb0d6823 --- /dev/null +++ b/tracker/agb-xm-core/src/lib.rs @@ -0,0 +1,14 @@ +use proc_macro2::TokenStream; +use proc_macro_error::abort; + +use quote::quote; + +pub fn agb_xm_core(args: TokenStream) -> TokenStream { + if args.is_empty() { + abort!(args, "must pass a filename"); + } + + quote! { + fn hello_world() {} + } +} diff --git a/tracker/agb-xm/Cargo.toml b/tracker/agb-xm/Cargo.toml index cddb48f5..db3783f3 100644 --- a/tracker/agb-xm/Cargo.toml +++ b/tracker/agb-xm/Cargo.toml @@ -4,10 +4,13 @@ version = "0.15.0" authors = ["Gwilym Kuiper "] edition = "2021" license = "MPL-2.0" -description = "Library for converting XM tracker files for use with agb-tracker on the Game Boy Advance" +description = "Library for converting XM tracker files for use with agb-tracker on the Game Boy Advance. You shouldn't use this package directly" repository = "https://github.com/agbrs/agb" [lib] proc-macro = true [dependencies] +agb_xm_core = { version = "0.15.0", path = "../agb-xm-core" } +proc-macro-error = "1" +proc-macro2 = "1" diff --git a/tracker/agb-xm/src/lib.rs b/tracker/agb-xm/src/lib.rs index 2ecdc793..0ccc3918 100644 --- a/tracker/agb-xm/src/lib.rs +++ b/tracker/agb-xm/src/lib.rs @@ -1,14 +1,8 @@ -fn add(left: usize, right: usize) -> usize { - left + right -} +use proc_macro::TokenStream; +use proc_macro_error::proc_macro_error; -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } +#[proc_macro_error] +#[proc_macro] +pub fn import_xm(args: TokenStream) -> TokenStream { + agb_xm_core::agb_xm_core(args.into()).into() }