summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2022-09-24 23:11:45 -0700
committerGravatar GitHub2022-09-24 23:11:45 -0700
commit465c46387d38c9fd0c14ad856fb22edb7c2858d7 (patch)
tree94553da8e7ea7c94db602451a11535b900099c36
parentMerge pull request #8941 from Kelebek1/single_core_sucks (diff)
parentcmake: fix git detection (diff)
downloadyuzu-465c46387d38c9fd0c14ad856fb22edb7c2858d7.tar.gz
yuzu-465c46387d38c9fd0c14ad856fb22edb7c2858d7.tar.xz
yuzu-465c46387d38c9fd0c14ad856fb22edb7c2858d7.zip
Merge pull request #8920 from abouvier/cmake-git
cmake: fix git detection
Diffstat (limited to '')
-rw-r--r--CMakeModules/GenerateSCMRev.cmake10
-rw-r--r--src/common/CMakeLists.txt29
2 files changed, 4 insertions, 35 deletions
diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake
index 0e4bd121c..2cdb9189a 100644
--- a/CMakeModules/GenerateSCMRev.cmake
+++ b/CMakeModules/GenerateSCMRev.cmake
@@ -7,11 +7,6 @@ function(get_timestamp _var)
7 set(${_var} "${timestamp}" PARENT_SCOPE) 7 set(${_var} "${timestamp}" PARENT_SCOPE)
8endfunction() 8endfunction()
9 9
10list(APPEND CMAKE_MODULE_PATH "${SRC_DIR}/externals/cmake-modules")
11
12# Find the package here with the known path so that the GetGit commands can find it as well
13find_package(Git QUIET PATHS "${GIT_EXECUTABLE}")
14
15# generate git/build information 10# generate git/build information
16include(GetGitRevisionDescription) 11include(GetGitRevisionDescription)
17if(NOT GIT_REF_SPEC) 12if(NOT GIT_REF_SPEC)
@@ -29,6 +24,7 @@ get_timestamp(BUILD_DATE)
29# Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well 24# Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
30set(REPO_NAME "") 25set(REPO_NAME "")
31set(BUILD_VERSION "0") 26set(BUILD_VERSION "0")
27set(BUILD_ID ${DISPLAY_VERSION})
32if (BUILD_REPOSITORY) 28if (BUILD_REPOSITORY)
33 # regex capture the string nightly or canary into CMAKE_MATCH_1 29 # regex capture the string nightly or canary into CMAKE_MATCH_1
34 string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY}) 30 string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY})
@@ -57,6 +53,4 @@ if (BUILD_REPOSITORY)
57 endif() 53 endif()
58endif() 54endif()
59 55
60# The variable SRC_DIR must be passed into the script 56configure_file(scm_rev.cpp.in scm_rev.cpp @ONLY)
61# (since it uses the current build directory for all values of CMAKE_*_DIR)
62configure_file("${SRC_DIR}/src/common/scm_rev.cpp.in" "scm_rev.cpp" @ONLY)
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 68436a4bc..3447fabd8 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -14,32 +14,7 @@ if (DEFINED ENV{DISPLAYVERSION})
14 set(DISPLAY_VERSION $ENV{DISPLAYVERSION}) 14 set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
15endif () 15endif ()
16 16
17# Pass the path to git to the GenerateSCMRev.cmake as well 17include(GenerateSCMRev)
18find_package(Git QUIET)
19
20add_custom_command(OUTPUT scm_rev.cpp
21 COMMAND ${CMAKE_COMMAND}
22 -DSRC_DIR=${PROJECT_SOURCE_DIR}
23 -DBUILD_REPOSITORY=${BUILD_REPOSITORY}
24 -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
25 -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
26 -DBUILD_TAG=${BUILD_TAG}
27 -DBUILD_ID=${DISPLAY_VERSION}
28 -DGIT_REF_SPEC=${GIT_REF_SPEC}
29 -DGIT_REV=${GIT_REV}
30 -DGIT_DESC=${GIT_DESC}
31 -DGIT_BRANCH=${GIT_BRANCH}
32 -DBUILD_FULLNAME=${BUILD_FULLNAME}
33 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
34 -P ${PROJECT_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
35 DEPENDS
36 # Check that the scm_rev files haven't changed
37 "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
38 "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
39 # technically we should regenerate if the git version changed, but its not worth the effort imo
40 "${PROJECT_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
41 VERBATIM
42)
43 18
44add_library(common STATIC 19add_library(common STATIC
45 algorithm.h 20 algorithm.h
@@ -117,7 +92,7 @@ add_library(common STATIC
117 quaternion.h 92 quaternion.h
118 reader_writer_queue.h 93 reader_writer_queue.h
119 ring_buffer.h 94 ring_buffer.h
120 scm_rev.cpp 95 ${CMAKE_CURRENT_BINARY_DIR}/scm_rev.cpp
121 scm_rev.h 96 scm_rev.h
122 scope_exit.h 97 scope_exit.h
123 settings.cpp 98 settings.cpp