To learn rust, and because games are supposed to be fun, I'm currently working on yet another rogue like, following tutorial there and there.
I started it with tcod-rs, using https://github.com/tomassedovic/tcod-rs which provides rust bindings for libtcod.
But I soon figured out that it was depending on installing sdl2 on computers, and it annoyed me.
So I got rid of tcod-rs, replaced it with piston, and implemented my own version of the field of view calculation. Yes, I know, there are plenty of field of vision calculators out there, but where is the fun in that
I'm in the learning phase, not the being efficient phase!
I still keep tcod-rs as a dev-dependency here for benching and test purposes: I wanted to compare my algorithm to tcod-rs to make sure it performs okay.
Now, if I build the executable on a device without sdl2, it works fine, but if I run the benchmark or the tests, it will fail with a nice
exit code: 1\n--- stderr\nPackage sdl2 was not found in the pkg-config which is expected, as can be seen in this github action result.
So now, I'm wondering if there is a way to detect at compile time if sdl2 is installed or not, and if not avoid these tests altogether, and process with the rest?