Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Set bgfx PROJECT_VERSION from bgfx versioning scheme. #80

Merged
merged 1 commit into from
May 11, 2020

Conversation

handsomematt
Copy link
Contributor

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).

cmake/version.cmake Outdated Show resolved Hide resolved
bgfx versioning scheme (1.API.GIT_REV) as defined here: https://github.com/bkaradzic/bgfx/blob/master/src/bgfx.cpp#L3439-L3444

it's important to set a version from install targets to work properly
@widberg widberg merged commit 5af95aa into widberg:master May 11, 2020
ERROR_QUIET)

# read version(100) from bgfx.idl
file(READ "${CMAKE_SOURCE_DIR}/bgfx/scripts/bgfx.idl" BGFX_IDL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks when using as a fetch content (add external project) for a out of source build

Make Error at cmake-build-debug/_deps/bgfx-src/cmake/version.cmake:26 (file):
  file failed to open for reading (No such file or directory):

    ~/openblack/bgfx/scripts/bgfx.idl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants