forked from mirror/openmw-tes3mp
Some changes to the version retrieval: ignore shallow clones
This commit is contained in:
parent
85b7240948
commit
b43325119a
3 changed files with 46 additions and 49 deletions
|
@ -6,47 +6,55 @@ if (APPLE)
|
||||||
set(APP_BUNDLE_DIR "${OpenMW_BINARY_DIR}/${APP_BUNDLE_NAME}")
|
set(APP_BUNDLE_DIR "${OpenMW_BINARY_DIR}/${APP_BUNDLE_NAME}")
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
# Macros
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
|
||||||
|
|
||||||
include(OpenMWMacros)
|
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
|
message(STATUS "Configuring OpenMW...")
|
||||||
|
|
||||||
set(OPENMW_VERSION_MAJOR 0)
|
set(OPENMW_VERSION_MAJOR 0)
|
||||||
set(OPENMW_VERSION_MINOR 29)
|
set(OPENMW_VERSION_MINOR 29)
|
||||||
set(OPENMW_VERSION_RELEASE 0)
|
set(OPENMW_VERSION_RELEASE 0)
|
||||||
|
|
||||||
|
set(OPENMW_VERSION_COMMITHASH "")
|
||||||
|
set(OPENMW_VERSION_TAGHASH "")
|
||||||
|
|
||||||
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||||
|
|
||||||
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||||
find_package(Git)
|
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/shallow)
|
||||||
|
find_package(Git)
|
||||||
|
|
||||||
if(GIT_FOUND)
|
if(GIT_FOUND)
|
||||||
include(GetGitRevisionDescription)
|
include(GetGitRevisionDescription)
|
||||||
get_git_tag_revision(TAGHASH --tags --max-count=1)
|
get_git_tag_revision(TAGHASH --tags --max-count=1)
|
||||||
get_git_head_revision(REFSPEC COMMITHASH)
|
get_git_head_revision(REFSPEC COMMITHASH)
|
||||||
git_describe(VERSION --tags ${TAGHASH})
|
git_describe(VERSION --tags ${TAGHASH})
|
||||||
|
|
||||||
string(REGEX MATCH "^openmw-[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" MATCH "${VERSION}")
|
string(REGEX MATCH "^openmw-[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" MATCH "${VERSION}")
|
||||||
if(MATCH)
|
if(MATCH)
|
||||||
string(REGEX REPLACE "^openmw-([0-9]+)\\..*" "\\1" OPENMW_VERSION_MAJOR "${VERSION}")
|
string(REGEX REPLACE "^openmw-([0-9]+)\\..*" "\\1" OPENMW_VERSION_MAJOR "${VERSION}")
|
||||||
string(REGEX REPLACE "^openmw-[0-9]+\\.([0-9]+).*" "\\1" OPENMW_VERSION_MINOR "${VERSION}")
|
string(REGEX REPLACE "^openmw-[0-9]+\\.([0-9]+).*" "\\1" OPENMW_VERSION_MINOR "${VERSION}")
|
||||||
string(REGEX REPLACE "^openmw-[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" OPENMW_VERSION_RELEASE "${VERSION}")
|
string(REGEX REPLACE "^openmw-[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" OPENMW_VERSION_RELEASE "${VERSION}")
|
||||||
|
|
||||||
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
set(OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||||
set(OPENMW_VERSION_COMMITHASH "${COMMITHASH}")
|
set(OPENMW_VERSION_COMMITHASH "${COMMITHASH}")
|
||||||
set(OPENMW_VERSION_TAGHASH "${TAGHASH}")
|
set(OPENMW_VERSION_TAGHASH "${TAGHASH}")
|
||||||
|
|
||||||
message(STATUS "Configuring OpenMW ${OPENMW_VERSION}...")
|
message(STATUS "OpenMW version ${OPENMW_VERSION}")
|
||||||
else(MATCH)
|
else(MATCH)
|
||||||
message(WARNING "Failed to get valid version information from Git")
|
message(WARNING "Failed to get valid version information from Git")
|
||||||
endif(MATCH)
|
endif(MATCH)
|
||||||
else(GIT_FOUND)
|
else(GIT_FOUND)
|
||||||
message(WARNING "Git executable not found")
|
message(WARNING "Git executable not found")
|
||||||
endif(GIT_FOUND)
|
endif(GIT_FOUND)
|
||||||
|
else(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/shallow)
|
||||||
|
message(STATUS "Shallow Git clone detected, not attempting to retrieve version info")
|
||||||
|
endif(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/shallow)
|
||||||
endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||||
|
|
||||||
|
# Macros
|
||||||
|
include(OpenMWMacros)
|
||||||
|
|
||||||
# doxygen main page
|
# doxygen main page
|
||||||
|
|
||||||
configure_file ("${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp")
|
configure_file ("${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp")
|
||||||
|
|
|
@ -76,17 +76,20 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
||||||
QString revision(OPENMW_VERSION_COMMITHASH);
|
QString revision(OPENMW_VERSION_COMMITHASH);
|
||||||
QString tag(OPENMW_VERSION_TAGHASH);
|
QString tag(OPENMW_VERSION_TAGHASH);
|
||||||
|
|
||||||
if (revision == tag) {
|
if (!revision.isEmpty() && !tag.isEmpty())
|
||||||
versionLabel->setText(tr("OpenMW %0 release").arg(OPENMW_VERSION));
|
{
|
||||||
} else {
|
if (revision == tag) {
|
||||||
versionLabel->setText(tr("OpenMW development (%0)").arg(revision.left(10)));
|
versionLabel->setText(tr("OpenMW %0 release").arg(OPENMW_VERSION));
|
||||||
}
|
} else {
|
||||||
|
versionLabel->setText(tr("OpenMW development (%0)").arg(revision.left(10)));
|
||||||
|
}
|
||||||
|
|
||||||
// Add the compile date and time
|
// Add the compile date and time
|
||||||
versionLabel->setToolTip(tr("Compiled on %0 %1").arg(QLocale(QLocale::C).toDate(QString(__DATE__).simplified(),
|
versionLabel->setToolTip(tr("Compiled on %0 %1").arg(QLocale(QLocale::C).toDate(QString(__DATE__).simplified(),
|
||||||
QLatin1String("MMM d yyyy")).toString(Qt::SystemLocaleLongDate),
|
QLatin1String("MMM d yyyy")).toString(Qt::SystemLocaleLongDate),
|
||||||
QLocale(QLocale::C).toTime(QString(__TIME__).simplified(),
|
QLocale(QLocale::C).toTime(QString(__TIME__).simplified(),
|
||||||
QLatin1String("hh:mm:ss")).toString(Qt::SystemLocaleShortDate)));
|
QLatin1String("hh:mm:ss")).toString(Qt::SystemLocaleShortDate)));
|
||||||
|
}
|
||||||
|
|
||||||
createIcons();
|
createIcons();
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,20 +120,6 @@ function(git_describe _var)
|
||||||
out
|
out
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
if(NOT res EQUAL 0)
|
|
||||||
execute_process(COMMAND
|
|
||||||
"${GIT_EXECUTABLE}"
|
|
||||||
describe
|
|
||||||
"--always"
|
|
||||||
WORKING_DIRECTORY
|
|
||||||
"${CMAKE_SOURCE_DIR}"
|
|
||||||
RESULT_VARIABLE
|
|
||||||
res
|
|
||||||
OUTPUT_VARIABLE
|
|
||||||
out
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT res EQUAL 0)
|
if(NOT res EQUAL 0)
|
||||||
set(out "${out}-${res}-NOTFOUND")
|
set(out "${out}-${res}-NOTFOUND")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue