From 43c9695bf975cf1d8df26f35fc973098fe32dcef Mon Sep 17 00:00:00 2001 From: James Rowe Date: Wed, 15 Jan 2020 23:52:41 -0700 Subject: [PATCH] Fix title bar --- CMakeModules/GenerateSCMRev.cmake | 17 +++++++++++------ src/common/CMakeLists.txt | 5 +++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index 030e7a78d..fb9351f79 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake @@ -5,6 +5,10 @@ function(get_timestamp _var) endfunction() list(APPEND CMAKE_MODULE_PATH "${SRC_DIR}/externals/cmake-modules") + +# Find the package here with the known path so that the GetGit commands can find it as well +find_package(Git QUIET PATHS "${GIT_EXECUTABLE}") + # generate git/build information include(GetGitRevisionDescription) get_git_head_revision(GIT_REF_SPEC GIT_REV) @@ -16,20 +20,21 @@ get_timestamp(BUILD_DATE) # Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well set(REPO_NAME "") set(BUILD_VERSION "0") -if ($ENV{CI}) - if ($ENV{TRAVIS}) +if (DEFINED ENV{CI}) + if (DEFINED ENV{TRAVIS}) set(BUILD_REPOSITORY $ENV{TRAVIS_REPO_SLUG}) set(BUILD_TAG $ENV{TRAVIS_TAG}) - elseif($ENV{APPVEYOR}) + elseif(DEFINED ENV{APPVEYOR}) set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME}) set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME}) - elseif($ENV{BITRISE_IO}) + elseif(DEFINED ENV{BITRISE_IO}) set(BUILD_REPOSITORY "$ENV{BITRISEIO_GIT_REPOSITORY_OWNER}/$ENV{BITRISEIO_GIT_REPOSITORY_SLUG}") set(BUILD_TAG $ENV{BITRISE_GIT_TAG}) endif() + # regex capture the string nightly or canary into CMAKE_MATCH_1 string(REGEX MATCH "citra-emu/citra-?(.*)" OUTVAR ${BUILD_REPOSITORY}) - if (${CMAKE_MATCH_COUNT} GREATER 0) + if ("${CMAKE_MATCH_COUNT}" GREATER 0) # capitalize the first letter of each word in the repo name. string(REPLACE "-" ";" REPO_NAME_LIST ${CMAKE_MATCH_1}) foreach(WORD ${REPO_NAME_LIST}) @@ -82,4 +87,4 @@ foreach (F IN LISTS HASH_FILES) set(COMBINED "${COMBINED}${TMP}") endforeach() string(MD5 SHADER_CACHE_VERSION "${COMBINED}") -configure_file("${SRC_DIR}/src/common/scm_rev.cpp.in" "scm_rev.cpp" @ONLY) \ No newline at end of file +configure_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 18b65155e..af07ac215 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -12,11 +12,16 @@ if (DEFINED ENV{CI}) set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME}) endif() endif() + +# Pass the path to git to the GenerateSCMRev.cmake as well +find_package(Git QUIET) + add_custom_command(OUTPUT scm_rev.cpp COMMAND ${CMAKE_COMMAND} -DSRC_DIR="${CMAKE_SOURCE_DIR}" -DBUILD_REPOSITORY="${BUILD_REPOSITORY}" -DBUILD_TAG="${BUILD_TAG}" + -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" -P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake" DEPENDS # WARNING! It was too much work to try and make a common location for this list,