summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CMakeLists.txt24
-rw-r--r--src/common/scm_rev.cpp.in4
-rw-r--r--src/common/scm_rev.h2
3 files changed, 25 insertions, 5 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index d9424ea91..f41946cc6 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -1,13 +1,16 @@
1# Generate cpp with Git revision from template 1# Generate cpp with Git revision from template
2# Also if this is a CI build, add the build name (ie: Nightly, Bleeding Edge) to the scm_rev file as well 2# Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
3set(REPO_NAME "") 3set(REPO_NAME "")
4set(BUILD_VERSION "0")
4if ($ENV{CI}) 5if ($ENV{CI})
5 if ($ENV{TRAVIS}) 6 if ($ENV{TRAVIS})
6 set(BUILD_REPOSITORY $ENV{TRAVIS_REPO_SLUG}) 7 set(BUILD_REPOSITORY $ENV{TRAVIS_REPO_SLUG})
8 set(BUILD_TAG $ENV{TRAVIS_TAG})
7 elseif($ENV{APPVEYOR}) 9 elseif($ENV{APPVEYOR})
8 set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME}) 10 set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME})
11 set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME})
9 endif() 12 endif()
10 # regex capture the string nightly or bleeding-edge into CMAKE_MATCH_1 13 # regex capture the string nightly or canary into CMAKE_MATCH_1
11 string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY}) 14 string(REGEX MATCH "yuzu-emu/yuzu-?(.*)" OUTVAR ${BUILD_REPOSITORY})
12 if (${CMAKE_MATCH_COUNT} GREATER 0) 15 if (${CMAKE_MATCH_COUNT} GREATER 0)
13 # capitalize the first letter of each word in the repo name. 16 # capitalize the first letter of each word in the repo name.
@@ -16,10 +19,21 @@ if ($ENV{CI})
16 string(SUBSTRING ${WORD} 0 1 FIRST_LETTER) 19 string(SUBSTRING ${WORD} 0 1 FIRST_LETTER)
17 string(SUBSTRING ${WORD} 1 -1 REMAINDER) 20 string(SUBSTRING ${WORD} 1 -1 REMAINDER)
18 string(TOUPPER ${FIRST_LETTER} FIRST_LETTER) 21 string(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
19 # this leaves a trailing space on the last word, but we actually want that 22 set(REPO_NAME "${REPO_NAME}${FIRST_LETTER}${REMAINDER}")
20 # because of how it's styled in the title bar.
21 set(REPO_NAME "${REPO_NAME}${FIRST_LETTER}${REMAINDER} ")
22 endforeach() 23 endforeach()
24 if (BUILD_TAG)
25 string(REGEX MATCH "${CMAKE_MATCH_1}-([0-9]+)" OUTVAR ${BUILD_TAG})
26 if (${CMAKE_MATCH_COUNT} GREATER 0)
27 set(BUILD_VERSION ${CMAKE_MATCH_1})
28 endif()
29 if (BUILD_VERSION)
30 # This leaves a trailing space on the last word, but we actually want that
31 # because of how it's styled in the title bar.
32 set(BUILD_FULLNAME "${REPO_NAME} #${BUILD_VERSION} ")
33 else()
34 set(BUILD_FULLNAME "")
35 endif()
36 endif()
23 endif() 37 endif()
24endif() 38endif()
25configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp" @ONLY) 39configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp" @ONLY)
diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in
index 4083095d5..2b1727769 100644
--- a/src/common/scm_rev.cpp.in
+++ b/src/common/scm_rev.cpp.in
@@ -9,6 +9,8 @@
9#define GIT_DESC "@GIT_DESC@" 9#define GIT_DESC "@GIT_DESC@"
10#define BUILD_NAME "@REPO_NAME@" 10#define BUILD_NAME "@REPO_NAME@"
11#define BUILD_DATE "@BUILD_DATE@" 11#define BUILD_DATE "@BUILD_DATE@"
12#define BUILD_FULLNAME "@BUILD_FULLNAME@"
13#define BUILD_VERSION "@BUILD_VERSION@"
12 14
13namespace Common { 15namespace Common {
14 16
@@ -17,6 +19,8 @@ const char g_scm_branch[] = GIT_BRANCH;
17const char g_scm_desc[] = GIT_DESC; 19const char g_scm_desc[] = GIT_DESC;
18const char g_build_name[] = BUILD_NAME; 20const char g_build_name[] = BUILD_NAME;
19const char g_build_date[] = BUILD_DATE; 21const char g_build_date[] = BUILD_DATE;
22const char g_build_fullname[] = BUILD_FULLNAME;
23const char g_build_version[] = BUILD_VERSION;
20 24
21} // namespace 25} // namespace
22 26
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h
index db0f4a947..af9a9daed 100644
--- a/src/common/scm_rev.h
+++ b/src/common/scm_rev.h
@@ -11,5 +11,7 @@ extern const char g_scm_branch[];
11extern const char g_scm_desc[]; 11extern const char g_scm_desc[];
12extern const char g_build_name[]; 12extern const char g_build_name[];
13extern const char g_build_date[]; 13extern const char g_build_date[];
14extern const char g_build_fullname[];
15extern const char g_build_version[];
14 16
15} // namespace Common 17} // namespace Common