mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Update git-version generation
This commit is contained in:
parent
1e303e9f97
commit
6a0ce010eb
1 changed files with 17 additions and 11 deletions
|
@ -10,13 +10,19 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
|
|||
OUTPUT_VARIABLE RPCS3_GIT_VERSION)
|
||||
if(NOT ${exit_code} EQUAL 0)
|
||||
message(WARNING "git rev-list failed, unable to include version.")
|
||||
else()
|
||||
string(STRIP ${RPCS3_GIT_VERSION} RPCS3_GIT_VERSION)
|
||||
endif()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE exit_code
|
||||
RESULT_VARIABLE exit_code2
|
||||
OUTPUT_VARIABLE GIT_VERSION_)
|
||||
if(NOT ${exit_code} EQUAL 0)
|
||||
if(NOT ${exit_code2} EQUAL 0)
|
||||
message(WARNING "git rev-parse failed, unable to include version.")
|
||||
string(STRIP ${GIT_VERSION_} GIT_VERSION_)
|
||||
if(${exit_code} EQUAL 0)
|
||||
string(STRIP ${RPCS3_GIT_VERSION}-${GIT_VERSION_} RPCS3_GIT_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -24,6 +30,8 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
|
|||
OUTPUT_VARIABLE RPCS3_GIT_BRANCH)
|
||||
if(NOT ${exit_code} EQUAL 0)
|
||||
message(WARNING "git rev-parse failed, unable to include git branch.")
|
||||
else()
|
||||
string(STRIP ${RPCS3_GIT_BRANCH} RPCS3_GIT_BRANCH)
|
||||
endif()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
|
@ -31,14 +39,11 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
|
|||
OUTPUT_VARIABLE RPCS3_GIT_TAG)
|
||||
if(NOT ${exit_code} EQUAL 0)
|
||||
message(WARNING "git describe failed, unable to include git tag.")
|
||||
endif()
|
||||
|
||||
string(STRIP ${RPCS3_GIT_VERSION} RPCS3_GIT_VERSION)
|
||||
string(STRIP ${GIT_VERSION_} GIT_VERSION_)
|
||||
string(STRIP ${RPCS3_GIT_VERSION}-${GIT_VERSION_} RPCS3_GIT_VERSION)
|
||||
string(STRIP ${RPCS3_GIT_BRANCH} RPCS3_GIT_BRANCH)
|
||||
string(STRIP ${RPCS3_GIT_TAG} RPCS3_GIT_TAG)
|
||||
string(REPLACE "v" "" RPCS3_GIT_TAG ${RPCS3_GIT_TAG})
|
||||
else()
|
||||
string(STRIP ${RPCS3_GIT_TAG} RPCS3_GIT_TAG)
|
||||
string(REPLACE "v" "" RPCS3_GIT_TAG ${RPCS3_GIT_TAG})
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(WARNING "git not found, unable to include version.")
|
||||
endif()
|
||||
|
@ -69,7 +74,8 @@ function(gen_git_version rpcs3_src_dir)
|
|||
|
||||
set(code_string "// This is a generated file.\n\n"
|
||||
"#define RPCS3_GIT_VERSION \"${RPCS3_GIT_VERSION}\"\n"
|
||||
"#define RPCS3_GIT_BRANCH \"${RPCS3_GIT_BRANCH}\"\n\n"
|
||||
"#define RPCS3_GIT_BRANCH \"${RPCS3_GIT_BRANCH}\"\n"
|
||||
"#define RPCS3_GIT_TAG \"${RPCS3_GIT_TAG}\"\n\n"
|
||||
"// If you don't want this file to update/recompile, change to 1.\n"
|
||||
"#define RPCS3_GIT_VERSION_NO_UPDATE 0\n")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue