mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
CMake: Set PANDA_BUILD_DATE_STR if SOURCE_DATE_EPOCH is set
Adds CMake support for the 54638bfc10bd766563830adaac118a4e55b4b52b change. One thing to note, compared to makepanda, is that CMake doesn't automatically rebuild the file if this env var is changed.
This commit is contained in:
parent
613441060b
commit
243fd10db0
@ -43,6 +43,19 @@ set(PANDA_VERSION_SYMBOL panda_version_${PROJECT_VERSION_MAJOR}_${PROJECT_VERSIO
|
||||
# for each component.
|
||||
math(EXPR PANDA_NUMERIC_VERSION "${PROJECT_VERSION_MAJOR}*1000000 + ${PROJECT_VERSION_MINOR}*1000 + ${PROJECT_VERSION_PATCH}")
|
||||
|
||||
# If SOURCE_DATE_EPOCH is set, it affects PandaSystem::get_build_date()
|
||||
if(DEFINED ENV{SOURCE_DATE_EPOCH})
|
||||
if(CMAKE_VERSION VERSION_LESS "3.8")
|
||||
message(FATAL_ERROR "CMake 3.8 is required to support SOURCE_DATE_EPOCH properly.")
|
||||
endif()
|
||||
|
||||
string(TIMESTAMP _build_date "%b %d %Y %H:%M:%S" UTC)
|
||||
|
||||
# CMake doesn't support %e, replace leading zero in day with space
|
||||
string(REGEX REPLACE "^([a-zA-Z]+) 0" "\\1 " PANDA_BUILD_DATE_STR "${_build_date}")
|
||||
unset(_build_date)
|
||||
endif()
|
||||
|
||||
# The Panda Git SHA1 refspec, for PandaSystem::get_git_commit()
|
||||
find_package(Git QUIET)
|
||||
if(GIT_EXECUTABLE)
|
||||
|
@ -49,6 +49,11 @@
|
||||
out from CVS by the builder). */
|
||||
#define PANDA_VERSION_STR "@PANDA_VERSION_STR@"
|
||||
|
||||
/* This is the build date expressed as a string. It can be left undefined
|
||||
to have this set automatically at build time, but it may be desirable to
|
||||
override this to make the build process deterministic. */
|
||||
#cmakedefine PANDA_BUILD_DATE_STR "@PANDA_BUILD_DATE_STR@"
|
||||
|
||||
/* This is the Git commit we built Panda from, or an empty string if this isn't
|
||||
known. */
|
||||
#define PANDA_GIT_COMMIT_STR "@PANDA_GIT_COMMIT_STR@"
|
||||
|
Loading…
x
Reference in New Issue
Block a user