2015-07-15 06:13:07 +00:00
|
|
|
if(NOT PROJECT_NAME)
|
|
|
|
set(PROJECT_NAME "mGBA")
|
|
|
|
endif()
|
2015-07-12 23:02:16 +00:00
|
|
|
set(LIB_VERSION_MAJOR 0)
|
2018-10-07 21:28:00 +00:00
|
|
|
set(LIB_VERSION_MINOR 8)
|
2020-02-16 23:44:45 +00:00
|
|
|
set(LIB_VERSION_PATCH 2)
|
2018-10-07 21:28:00 +00:00
|
|
|
set(LIB_VERSION_ABI 0.8)
|
2015-07-12 23:02:16 +00:00
|
|
|
set(LIB_VERSION_STRING ${LIB_VERSION_MAJOR}.${LIB_VERSION_MINOR}.${LIB_VERSION_PATCH})
|
2015-09-05 04:02:33 +00:00
|
|
|
set(SUMMARY "${PROJECT_NAME} Game Boy Advance Emulator")
|
2015-07-12 23:02:16 +00:00
|
|
|
|
2017-01-27 05:54:52 +00:00
|
|
|
find_program(GIT git)
|
|
|
|
if(GIT AND NOT SKIP_GIT)
|
2017-03-29 00:16:57 +00:00
|
|
|
execute_process(COMMAND ${GIT} describe --always --abbrev=40 --dirty WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_COMMIT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${GIT} describe --always --dirty WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_COMMIT_SHORT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${GIT} symbolic-ref --short HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_BRANCH ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${GIT} rev-list HEAD --count WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_REV ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${GIT} describe --tag --exact-match WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_TAG ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2017-01-27 05:54:52 +00:00
|
|
|
endif()
|
2015-07-12 23:02:16 +00:00
|
|
|
|
2017-01-27 05:54:52 +00:00
|
|
|
if(NOT GIT_REV)
|
2015-07-12 23:02:16 +00:00
|
|
|
set(GIT_REV -1)
|
2015-05-15 15:37:08 +00:00
|
|
|
endif()
|
2017-01-27 05:54:52 +00:00
|
|
|
if(GIT_TAG)
|
2015-07-12 23:02:16 +00:00
|
|
|
set(VERSION_STRING ${GIT_TAG})
|
2017-01-27 05:54:52 +00:00
|
|
|
elseif(NOT GIT_BRANCH)
|
2015-07-12 23:02:16 +00:00
|
|
|
set(VERSION_STRING ${LIB_VERSION_STRING})
|
|
|
|
else()
|
2017-01-27 05:54:52 +00:00
|
|
|
if(GIT_BRANCH STREQUAL "master" OR NOT GIT_BRANCH)
|
2015-07-12 23:02:16 +00:00
|
|
|
set(VERSION_STRING ${GIT_REV}-${GIT_COMMIT_SHORT})
|
|
|
|
else()
|
|
|
|
set(VERSION_STRING ${GIT_BRANCH}-${GIT_REV}-${GIT_COMMIT_SHORT})
|
|
|
|
endif()
|
2015-05-15 15:37:08 +00:00
|
|
|
|
2015-07-12 23:02:16 +00:00
|
|
|
if(NOT LIB_VERSION_ABI STREQUAL GIT_BRANCH)
|
|
|
|
set(VERSION_STRING ${LIB_VERSION_ABI}-${VERSION_STRING})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-08-15 22:31:42 +00:00
|
|
|
if(NOT GIT_COMMIT)
|
|
|
|
set(GIT_COMMIT "(unknown)")
|
|
|
|
endif()
|
|
|
|
if(NOT GIT_COMMIT_SHORT)
|
|
|
|
set(GIT_COMMIT_SHORT "(unknown)")
|
|
|
|
endif()
|
|
|
|
if(NOT GIT_BRANCH)
|
|
|
|
set(GIT_BRANCH "(unknown)")
|
|
|
|
endif()
|
|
|
|
|
2017-01-22 22:26:59 +00:00
|
|
|
if(DEFINED PRINT_STRING)
|
2018-06-25 22:38:31 +00:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${${PRINT_STRING}}")
|
2017-01-22 22:26:59 +00:00
|
|
|
elseif(NOT VERSION_STRING_CACHE OR NOT VERSION_STRING STREQUAL VERSION_STRING_CACHE)
|
2016-09-20 02:49:58 +00:00
|
|
|
set(VERSION_STRING_CACHE ${VERSION_STRING} CACHE STRING "" FORCE)
|
|
|
|
|
|
|
|
if(CONFIG_FILE AND OUT_FILE)
|
|
|
|
configure_file("${CONFIG_FILE}" "${OUT_FILE}")
|
|
|
|
endif()
|
2015-07-12 23:02:16 +00:00
|
|
|
endif()
|