DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
305 stars 60 forks source link

Library version info idea #985

Open slipher opened 11 months ago

slipher commented 11 months ago

I have a branch that adds a printdepversions that prints (if knowable) the header and binary versions for each of our external library dependencies. I don't think it's a good idea to merge it as-is though: it may be fragile to ensure that the #include always matches the file where the library is actually used, lest you get different results while having more than one version installed. Also including that many headers in one file is likely to result in macro conflicts and stuff.

So I have a new idea: store the version info in ROM cvars, e.g. version.sdl.header for the SDL header version and version.sdl.binary for the binary version. Then the cvar for a given library can be populated from the file where it is primarily used (even in gamelogic). Also this is more flexible w.r.t. stuff like alGetString(AL_VERSION) which actually requires a valid context to work, so it is not always available. To list all the versions you can do /listcvars version. or there can be a convenience command. What do you think?

illwieckz commented 11 months ago

I believe the cvar way is a good idea because I assume we can populate the result with defines in the file that already includes the said library.

We may then add a special function to print all those cvar content, to be called at least one (a bit like what gfxinfo does, even if the way the data would be gathered would be different).

And about the general idea about printing that, I not only agree with it but I ask for it!

DolceTriade commented 11 months ago

I see in your branch you seem to be relying on defines. Does that still work at runtime or if the user replaces the linked so with another one, it would report the build time version?

DolceTriade commented 11 months ago

That said, I think it's a good idea for debugging purposes.

slipher commented 11 months ago

I see in your branch you seem to be relying on defines. Does that still work at runtime or if the user replaces the linked so with another one, it would report the build time version?

I show both the header's version and the built library's version when available. For example Print("nettle: header %d.%d, binary %d.%d", NETTLE_VERSION_MAJOR, NETTLE_VERSION_MINOR, nettle_version_major(), nettle_version_minor());. Some libraries only provide one or the other.