widberg / bgfx.cmake

https://github.com/bkaradzic/bgfx.cmake. Independently maintained CMake build scripts for bgfx. Released under public domain.
https://github.com/bkaradzic/bgfx.cmake
Creative Commons Zero v1.0 Universal
286 stars 252 forks source link

Set bgfx PROJECT_VERSION from bgfx versioning scheme. #80

Closed handsomematt closed 4 years ago

handsomematt commented 4 years ago

bgfx has a versioning scheme as defined here: https://github.com/bkaradzic/bgfx/blob/master/src/bgfx.cpp#L3439-L3444

# bgfx versioning scheme:
# bgfx 1.104.7082
#      ^ ^^^ ^^^^
#      | |   +--- Commit number  (https://github.com/bkaradzic/bgfx / git rev-list --count HEAD)
#      | +------- API version    (from https://github.com/bkaradzic/bgfx/blob/master/scripts/bgfx.idl#L4)
#      +--------- Major revision (always 1)

We can generate this all ourself from Git / reading files as done in cmake/version.cmake.

It's important to set a version so package install targets work properly, plus it's quite vital to track the API_VERSION since it seems to change for breaking changes - I intend to lock to specific API_VERSIONs on my own project to avoid drastic breaking changes all the time.

Another thing that can be done but isn't currently is auto generating version.h so bgfx internally knows it's version number. (Seems like this autogenerated file is committed sporadically so it's inaccurate as is).