diff options
| author | 2021-12-20 19:13:07 -0500 | |
|---|---|---|
| committer | 2021-12-20 19:13:07 -0500 | |
| commit | caf38725ae2802bdc71ea45c40c34635c5090dca (patch) | |
| tree | b15631de010afdacdab9ac503be4b5fd9ffa41d7 | |
| parent | Merge pull request #7532 from goldenx86/patch-3 (diff) | |
| download | yuzu-caf38725ae2802bdc71ea45c40c34635c5090dca.tar.gz yuzu-caf38725ae2802bdc71ea45c40c34635c5090dca.tar.xz yuzu-caf38725ae2802bdc71ea45c40c34635c5090dca.zip | |
Allow overriding SCM version info
If the build is from a non-repository, these functions will return empty. This
patch allows using defines to CMake to set version info such as
-DGIT_BRANCH=master.
Diffstat (limited to '')
| -rw-r--r-- | CMakeModules/GenerateSCMRev.cmake | 12 | ||||
| -rw-r--r-- | src/common/CMakeLists.txt | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index 43ca730ec..c7da2b91d 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake | |||
| @@ -11,9 +11,15 @@ find_package(Git QUIET PATHS "${GIT_EXECUTABLE}") | |||
| 11 | 11 | ||
| 12 | # generate git/build information | 12 | # generate git/build information |
| 13 | include(GetGitRevisionDescription) | 13 | include(GetGitRevisionDescription) |
| 14 | get_git_head_revision(GIT_REF_SPEC GIT_REV) | 14 | if(NOT GIT_REF_SPEC) |
| 15 | git_describe(GIT_DESC --always --long --dirty) | 15 | get_git_head_revision(GIT_REF_SPEC GIT_REV) |
| 16 | git_branch_name(GIT_BRANCH) | 16 | endif() |
| 17 | if(NOT GIT_DESC) | ||
| 18 | git_describe(GIT_DESC --always --long --dirty) | ||
| 19 | endif() | ||
| 20 | if (NOT GIT_BRANCH) | ||
| 21 | git_branch_name(GIT_BRANCH) | ||
| 22 | endif() | ||
| 17 | get_timestamp(BUILD_DATE) | 23 | get_timestamp(BUILD_DATE) |
| 18 | 24 | ||
| 19 | # Generate cpp with Git revision from template | 25 | # Generate cpp with Git revision from template |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 919da4a53..790193b00 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -22,6 +22,11 @@ add_custom_command(OUTPUT scm_rev.cpp | |||
| 22 | -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING} | 22 | -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING} |
| 23 | -DBUILD_TAG=${BUILD_TAG} | 23 | -DBUILD_TAG=${BUILD_TAG} |
| 24 | -DBUILD_ID=${DISPLAY_VERSION} | 24 | -DBUILD_ID=${DISPLAY_VERSION} |
| 25 | -DGIT_REF_SPEC=${GIT_REF_SPEC} | ||
| 26 | -DGIT_REV=${GIT_REV} | ||
| 27 | -DGIT_DESC=${GIT_DESC} | ||
| 28 | -DGIT_BRANCH=${GIT_BRANCH} | ||
| 29 | -DBUILD_FULLNAME=${BUILD_FULLNAME} | ||
| 25 | -DGIT_EXECUTABLE=${GIT_EXECUTABLE} | 30 | -DGIT_EXECUTABLE=${GIT_EXECUTABLE} |
| 26 | -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake | 31 | -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake |
| 27 | DEPENDS | 32 | DEPENDS |