I have a package praxis that doesnt use SDL, but in one small place, one parent project needs praxis to have SDL.
Can I put SDL into the praxis package, and have some kind of comptime check that adds a function if SDL exists?
i.e. something like:
if (builtin.haspackage("SDL")) {
const sdl = @import("SDL");
pub fn load_game_asset_via_sdl(...) {
// Load using SDL cross platform read/write helpers
}
}
pub fn load_game_asset_local(...) {
// Load with normal std file read/write
}
But I am also wondering if this even makes sense, because perhaps you could say this special function would simply not be compiled if its never used by the parent package. Does that make sense?