build_info.h 1005 B

1234567891011121314151617181920212223242526
  1. // build_info.h -- firmware build provenance, surfaced in the WebUSB panel so you can confirm EXACTLY which
  2. // build is flashed on a board (semantic version when available, otherwise git hash, plus dirty flag).
  3. //
  4. // The values come from one of two sources, in priority order:
  5. // 1) -D defines on the compile line, e.g. build.extra_flags += -DOPK_BUILD_VERSION=\"0.9.1\"
  6. // -DOPK_GIT_HASH=\"abc12345\" -DOPK_GIT_DIRTY=1
  7. // 2) a generated git_version.h (written by gen_version.sh before compiling), picked up via __has_include.
  8. // If neither is present (a bare checkout compiled by hand) the values fall back to empty-version/"unknown"/
  9. // not-dirty, so the build always succeeds.
  10. #pragma once
  11. #if !defined(OPK_GIT_HASH) && defined(__has_include)
  12. #if __has_include("git_version.h")
  13. #include "git_version.h"
  14. #endif
  15. #endif
  16. #ifndef OPK_BUILD_VERSION
  17. #define OPK_BUILD_VERSION ""
  18. #endif
  19. #ifndef OPK_GIT_HASH
  20. #define OPK_GIT_HASH "unknown"
  21. #endif
  22. #ifndef OPK_GIT_DIRTY
  23. #define OPK_GIT_DIRTY 0
  24. #endif