all repos — mgba @ 0.3.2

mGBA Game Boy Advance Emulator

version.cmake (view raw)

 1if(NOT PROJECT_NAME)
 2	set(PROJECT_NAME "mGBA")
 3endif()
 4set(LIB_VERSION_MAJOR 0)
 5set(LIB_VERSION_MINOR 3)
 6set(LIB_VERSION_PATCH 2)
 7set(LIB_VERSION_ABI 0.3)
 8set(LIB_VERSION_STRING ${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${LIB_VERSION_PATCH})
 9
10execute_process(COMMAND git describe --always --abbrev=40 --dirty OUTPUT_VARIABLE GIT_COMMIT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
11execute_process(COMMAND git describe --always --dirty OUTPUT_VARIABLE GIT_COMMIT_SHORT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
12execute_process(COMMAND git symbolic-ref --short HEAD OUTPUT_VARIABLE GIT_BRANCH ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
13execute_process(COMMAND git rev-list HEAD --count OUTPUT_VARIABLE GIT_REV ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
14execute_process(COMMAND git describe --tag --exact-match OUTPUT_VARIABLE GIT_TAG ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
15
16if(GIT_REV STREQUAL "")
17	set(GIT_REV -1)
18endif()
19if(NOT GIT_TAG STREQUAL "")
20	set(VERSION_STRING ${GIT_TAG})
21elseif(GIT_BRANCH STREQUAL "")
22	set(VERSION_STRING ${LIB_VERSION_STRING})
23else()
24	if(GIT_BRANCH STREQUAL "master")
25		set(VERSION_STRING ${GIT_REV}-${GIT_COMMIT_SHORT})
26	else()
27		set(VERSION_STRING ${GIT_BRANCH}-${GIT_REV}-${GIT_COMMIT_SHORT})
28	endif()
29
30	if(NOT LIB_VERSION_ABI STREQUAL GIT_BRANCH)
31		set(VERSION_STRING ${LIB_VERSION_ABI}-${VERSION_STRING})
32	endif()
33endif()
34
35if(NOT GIT_COMMIT)
36	set(GIT_COMMIT "(unknown)")
37endif()
38if(NOT GIT_COMMIT_SHORT)
39	set(GIT_COMMIT_SHORT "(unknown)")
40endif()
41if(NOT GIT_BRANCH)
42	set(GIT_BRANCH "(unknown)")
43endif()
44
45if(CONFIG_FILE AND OUT_FILE)
46	configure_file("${CONFIG_FILE}" "${OUT_FILE}")
47endif()