PandaVersion.cmake 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # This file defines the current version number for Panda. It is read
  2. # by the top CMakeLists.txt, which puts it in the global namespace for
  3. # all CMake scripts for Panda.
  4. option(PANDA_OFFICIAL_VERSION
  5. "This variable will be defined to false in the Git repository, but
  6. scripts that generate source tarballs and/or binary releases for
  7. distribution, by checking out Panda from an official Git tag,
  8. should explictly set this to true. When false, it indicates that
  9. the current version of Panda was checked out from Git, so it may
  10. not be a complete representation of the indicated version."
  11. OFF)
  12. set(PANDA_DISTRIBUTOR homebuilt CACHE STRING
  13. "This string is reported verbatim by PandaSystem::get_distributor().
  14. It should be set by whoever provides a particular distribution of
  15. Panda. If you build your own Panda, leave this unchanged.")
  16. set(PANDA_DIST_USE_LICENSES "BSD-3;BSD-2;MIT" CACHE STRING
  17. "This is a list of allowed licenses for 3rd-party packages to build
  18. support for when performing a Distribution build of Panda3d.
  19. Note: This only is checked for packages that CMake has declared with a
  20. particular license. Some packages don't have a listed license because
  21. they are almost always required/used, or because they are only used in
  22. plugins that can be easily removed (eg. directx, ffmpeg, fmod, ...).")
  23. mark_as_advanced(PANDA_VERSION PANDA_OFFICIAL_VERSION PANDA_DIST_USE_LICENSES)
  24. # The version gets a "c" at the end if it's not an official one.
  25. if(PANDA_OFFICIAL_VERSION)
  26. set(VERSION_SUFFIX "")
  27. else()
  28. set(VERSION_SUFFIX "c")
  29. endif()
  30. set(PANDA_VERSION_STR "${PROJECT_VERSION}${VERSION_SUFFIX}")
  31. # This symbol is used to enforce ABI incompatibility between
  32. # major versions of Panda3D.
  33. set(PANDA_VERSION_SYMBOL panda_version_${PROJECT_VERSION_MAJOR}_${PROJECT_VERSION_MINOR})
  34. # The Panda version as a number, with three digits reserved
  35. # for each component.
  36. math(EXPR PANDA_NUMERIC_VERSION "${PROJECT_VERSION_MAJOR}*1000000 + ${PROJECT_VERSION_MINOR}*1000 + ${PROJECT_VERSION_PATCH}")
  37. # If SOURCE_DATE_EPOCH is set, it affects PandaSystem::get_build_date()
  38. if(DEFINED ENV{SOURCE_DATE_EPOCH})
  39. string(TIMESTAMP _build_date "%b %d %Y %H:%M:%S" UTC)
  40. # CMake doesn't support %e, replace leading zero in day with space
  41. string(REGEX REPLACE "^([a-zA-Z]+) 0" "\\1 " PANDA_BUILD_DATE_STR "${_build_date}")
  42. unset(_build_date)
  43. endif()
  44. # The Panda Git SHA1 refspec, for PandaSystem::get_git_commit()
  45. find_package(Git QUIET)
  46. if(GIT_EXECUTABLE)
  47. execute_process(
  48. COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
  49. WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
  50. OUTPUT_VARIABLE PANDA_GIT_COMMIT_STR
  51. ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  52. endif()