Daemon icon indicating copy to clipboard operation
Daemon copied to clipboard

Library version info idea

Open slipher opened this issue 2 years ago • 4 comments

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?

slipher avatar Dec 04 '23 10:12 slipher

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!

illwieckz avatar Dec 04 '23 15:12 illwieckz

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 avatar Dec 04 '23 19:12 DolceTriade

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

DolceTriade avatar Dec 04 '23 19:12 DolceTriade

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.

slipher avatar Dec 04 '23 19:12 slipher