mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Merge remote-tracking branch 'scrawl/version'
Conflicts: apps/openmw/mwgui/windowmanagerimp.cpp
This commit is contained in:
commit
b3ad983f1f
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,7 +41,6 @@ resources
|
|||||||
|
|
||||||
## generated objects
|
## generated objects
|
||||||
apps/openmw/config.hpp
|
apps/openmw/config.hpp
|
||||||
components/version/version.hpp
|
|
||||||
docs/mainpage.hpp
|
docs/mainpage.hpp
|
||||||
moc_*.cxx
|
moc_*.cxx
|
||||||
*.cxx_parameters
|
*.cxx_parameters
|
||||||
|
@ -426,6 +426,7 @@ IF(NOT WIN32 AND NOT APPLE)
|
|||||||
# Install global configuration files
|
# Install global configuration files
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "${SYSCONFDIR}" RENAME "openmw.cfg" COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "${SYSCONFDIR}" RENAME "openmw.cfg" COMPONENT "openmw")
|
||||||
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/resources/version" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/gamecontrollerdb.txt" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/gamecontrollerdb.txt" DESTINATION "${SYSCONFDIR}" COMPONENT "openmw")
|
||||||
|
|
||||||
IF(BUILD_OPENCS)
|
IF(BUILD_OPENCS)
|
||||||
@ -441,6 +442,7 @@ if(WIN32)
|
|||||||
FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll")
|
FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll")
|
||||||
INSTALL(FILES ${dll_files} DESTINATION ".")
|
INSTALL(FILES ${dll_files} DESTINATION ".")
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
|
||||||
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/resources/version" DESTINATION ".")
|
||||||
INSTALL(FILES "${OpenMW_SOURCE_DIR}/CHANGELOG.md" DESTINATION "." RENAME "CHANGELOG.txt")
|
INSTALL(FILES "${OpenMW_SOURCE_DIR}/CHANGELOG.md" DESTINATION "." RENAME "CHANGELOG.txt")
|
||||||
INSTALL(FILES "${OpenMW_SOURCE_DIR}/README.md" DESTINATION "." RENAME "README.txt")
|
INSTALL(FILES "${OpenMW_SOURCE_DIR}/README.md" DESTINATION "." RENAME "README.txt")
|
||||||
INSTALL(FILES
|
INSTALL(FILES
|
||||||
|
@ -57,26 +57,6 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
|||||||
// Remove what's this? button
|
// Remove what's this? button
|
||||||
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
|
|
||||||
// Add version information to bottom of the window
|
|
||||||
QString revision(OPENMW_VERSION_COMMITHASH);
|
|
||||||
QString tag(OPENMW_VERSION_TAGHASH);
|
|
||||||
|
|
||||||
versionLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
|
||||||
if (!revision.isEmpty() && !tag.isEmpty())
|
|
||||||
{
|
|
||||||
if (revision == tag) {
|
|
||||||
versionLabel->setText(tr("OpenMW %1 release").arg(OPENMW_VERSION));
|
|
||||||
} else {
|
|
||||||
versionLabel->setText(tr("OpenMW development (%1)").arg(revision.left(10)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the compile date and time
|
|
||||||
versionLabel->setToolTip(tr("Compiled on %1 %2").arg(QLocale(QLocale::C).toDate(QString(__DATE__).simplified(),
|
|
||||||
QLatin1String("MMM d yyyy")).toString(Qt::SystemLocaleLongDate),
|
|
||||||
QLocale(QLocale::C).toTime(QString(__TIME__).simplified(),
|
|
||||||
QLatin1String("hh:mm:ss")).toString(Qt::SystemLocaleShortDate)));
|
|
||||||
}
|
|
||||||
|
|
||||||
createIcons();
|
createIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,11 +166,38 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog()
|
|||||||
return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure;
|
return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Launcher::MainDialog::setVersionLabel()
|
||||||
|
{
|
||||||
|
// Add version information to bottom of the window
|
||||||
|
Version::Version v = Version::getOpenmwVersion(mGameSettings.value("resources").toUtf8().constData());
|
||||||
|
|
||||||
|
QString revision(QString::fromUtf8(v.mCommitHash.c_str()));
|
||||||
|
QString tag(QString::fromUtf8(v.mTagHash.c_str()));
|
||||||
|
|
||||||
|
versionLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
if (!revision.isEmpty() && !tag.isEmpty())
|
||||||
|
{
|
||||||
|
if (revision == tag) {
|
||||||
|
versionLabel->setText(tr("OpenMW %1 release").arg(QString::fromUtf8(v.mVersion.c_str())));
|
||||||
|
} else {
|
||||||
|
versionLabel->setText(tr("OpenMW development (%1)").arg(revision.left(10)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the compile date and time
|
||||||
|
versionLabel->setToolTip(tr("Compiled on %1 %2").arg(QLocale(QLocale::C).toDate(QString(__DATE__).simplified(),
|
||||||
|
QLatin1String("MMM d yyyy")).toString(Qt::SystemLocaleLongDate),
|
||||||
|
QLocale(QLocale::C).toTime(QString(__TIME__).simplified(),
|
||||||
|
QLatin1String("hh:mm:ss")).toString(Qt::SystemLocaleShortDate)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Launcher::MainDialog::setup()
|
bool Launcher::MainDialog::setup()
|
||||||
{
|
{
|
||||||
if (!setupGameSettings())
|
if (!setupGameSettings())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
setVersionLabel();
|
||||||
|
|
||||||
mLauncherSettings.setContentList(mGameSettings);
|
mLauncherSettings.setContentList(mGameSettings);
|
||||||
|
|
||||||
if (!setupGraphicsSettings())
|
if (!setupGraphicsSettings())
|
||||||
@ -309,11 +316,11 @@ bool Launcher::MainDialog::setupGameSettings()
|
|||||||
mGameSettings.readUserFile(stream);
|
mGameSettings.readUserFile(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now the rest
|
// Now the rest - priority: user > local > global
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
paths.append(userPath + QString("openmw.cfg"));
|
|
||||||
paths.append(QString("openmw.cfg"));
|
|
||||||
paths.append(globalPath + QString("openmw.cfg"));
|
paths.append(globalPath + QString("openmw.cfg"));
|
||||||
|
paths.append(QString("openmw.cfg"));
|
||||||
|
paths.append(userPath + QString("openmw.cfg"));
|
||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
qDebug() << "Loading config file:" << qPrintable(path);
|
qDebug() << "Loading config file:" << qPrintable(path);
|
||||||
|
@ -72,6 +72,8 @@ namespace Launcher
|
|||||||
bool setupGameSettings();
|
bool setupGameSettings();
|
||||||
bool setupGraphicsSettings();
|
bool setupGraphicsSettings();
|
||||||
|
|
||||||
|
void setVersionLabel();
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
#include <components/translation/translation.hpp>
|
#include <components/translation/translation.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadcell.hpp>
|
#include <components/version/version.hpp>
|
||||||
|
|
||||||
#include "mwinput/inputmanagerimp.hpp"
|
#include "mwinput/inputmanagerimp.hpp"
|
||||||
|
|
||||||
@ -493,7 +493,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
|||||||
rootNode->addChild(guiRoot);
|
rootNode->addChild(guiRoot);
|
||||||
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(),
|
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem.get(),
|
||||||
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
|
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
|
||||||
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mFallbackMap);
|
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mFallbackMap,
|
||||||
|
Version::getOpenmwVersionDescription(mResDir.string()));
|
||||||
mEnvironment.setWindowManager (window);
|
mEnvironment.setWindowManager (window);
|
||||||
|
|
||||||
// Create sound system
|
// Create sound system
|
||||||
|
@ -199,18 +199,14 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "OpenMW version " << OPENMW_VERSION;
|
|
||||||
std::string rev = OPENMW_VERSION_COMMITHASH;
|
|
||||||
std::string tag = OPENMW_VERSION_TAGHASH;
|
|
||||||
if (!rev.empty() && !tag.empty())
|
|
||||||
{
|
|
||||||
rev = rev.substr(0, 10);
|
|
||||||
std::cout << " (revision " << rev << ")";
|
|
||||||
}
|
|
||||||
std::cout << std::endl;
|
|
||||||
|
|
||||||
if (variables.count ("version"))
|
if (variables.count ("version"))
|
||||||
|
{
|
||||||
|
cfgMgr.readConfiguration(variables, desc, true);
|
||||||
|
|
||||||
|
Version::Version v = Version::getOpenmwVersion(variables["resources"].as<std::string>());
|
||||||
|
std::cout << v.describe() << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
cfgMgr.readConfiguration(variables, desc);
|
cfgMgr.readConfiguration(variables, desc);
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
|
||||||
#include <components/version/version.hpp>
|
|
||||||
|
|
||||||
#include <components/widgets/imagebutton.hpp>
|
#include <components/widgets/imagebutton.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
@ -28,7 +26,7 @@
|
|||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
MainMenu::MainMenu(int w, int h, const VFS::Manager* vfs)
|
MainMenu::MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription)
|
||||||
: Layout("openmw_mainmenu.layout")
|
: Layout("openmw_mainmenu.layout")
|
||||||
, mWidth (w), mHeight (h)
|
, mWidth (w), mHeight (h)
|
||||||
, mVFS(vfs), mButtonBox(0)
|
, mVFS(vfs), mButtonBox(0)
|
||||||
@ -38,20 +36,7 @@ namespace MWGui
|
|||||||
, mSaveGameDialog(NULL)
|
, mSaveGameDialog(NULL)
|
||||||
{
|
{
|
||||||
getWidget(mVersionText, "VersionText");
|
getWidget(mVersionText, "VersionText");
|
||||||
std::stringstream sstream;
|
mVersionText->setCaption(versionDescription);
|
||||||
sstream << "OpenMW Version: " << OPENMW_VERSION;
|
|
||||||
|
|
||||||
// adding info about git hash if available
|
|
||||||
std::string rev = OPENMW_VERSION_COMMITHASH;
|
|
||||||
std::string tag = OPENMW_VERSION_TAGHASH;
|
|
||||||
if (!rev.empty() && !tag.empty())
|
|
||||||
{
|
|
||||||
rev = rev.substr(0,10);
|
|
||||||
sstream << "\nRevision: " << rev;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string output = sstream.str();
|
|
||||||
mVersionText->setCaption(output);
|
|
||||||
|
|
||||||
mHasAnimatedMenu = mVFS->exists("video/menu_background.bik");
|
mHasAnimatedMenu = mVFS->exists("video/menu_background.bik");
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace MWGui
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MainMenu(int w, int h, const VFS::Manager* vfs);
|
MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription);
|
||||||
~MainMenu();
|
~MainMenu();
|
||||||
|
|
||||||
void onResChange(int w, int h);
|
void onResChange(int w, int h);
|
||||||
|
@ -113,7 +113,7 @@ namespace MWGui
|
|||||||
WindowManager::WindowManager(
|
WindowManager::WindowManager(
|
||||||
osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem
|
osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem
|
||||||
, const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts,
|
, const std::string& logpath, const std::string& resourcePath, bool consoleOnlyScripts,
|
||||||
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string, std::string>& fallbackMap)
|
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string, std::string>& fallbackMap, const std::string& versionDescription)
|
||||||
: mResourceSystem(resourceSystem)
|
: mResourceSystem(resourceSystem)
|
||||||
, mViewer(viewer)
|
, mViewer(viewer)
|
||||||
, mConsoleOnlyScripts(consoleOnlyScripts)
|
, mConsoleOnlyScripts(consoleOnlyScripts)
|
||||||
@ -188,6 +188,7 @@ namespace MWGui
|
|||||||
, mFPS(0.0f)
|
, mFPS(0.0f)
|
||||||
, mFallbackMap(fallbackMap)
|
, mFallbackMap(fallbackMap)
|
||||||
, mShowOwned(false)
|
, mShowOwned(false)
|
||||||
|
, mVersionDescription(versionDescription)
|
||||||
{
|
{
|
||||||
float uiScale = Settings::Manager::getFloat("scaling factor", "GUI");
|
float uiScale = Settings::Manager::getFloat("scaling factor", "GUI");
|
||||||
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager(), uiScale);
|
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager(), uiScale);
|
||||||
@ -262,7 +263,7 @@ namespace MWGui
|
|||||||
|
|
||||||
MyGUI::ClipboardManager::getInstance().eventClipboardChanged += MyGUI::newDelegate(this, &WindowManager::onClipboardChanged);
|
MyGUI::ClipboardManager::getInstance().eventClipboardChanged += MyGUI::newDelegate(this, &WindowManager::onClipboardChanged);
|
||||||
MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &WindowManager::onClipboardRequested);
|
MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &WindowManager::onClipboardRequested);
|
||||||
|
|
||||||
mShowOwned = Settings::Manager::getBool("show owned", "Game");
|
mShowOwned = Settings::Manager::getBool("show owned", "Game");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +276,7 @@ namespace MWGui
|
|||||||
mDragAndDrop = new DragAndDrop();
|
mDragAndDrop = new DragAndDrop();
|
||||||
|
|
||||||
mRecharge = new Recharge();
|
mRecharge = new Recharge();
|
||||||
mMenu = new MainMenu(w, h, mResourceSystem->getVFS());
|
mMenu = new MainMenu(w, h, mResourceSystem->getVFS(), mVersionDescription);
|
||||||
mLocalMapRender = new MWRender::LocalMap(mViewer);
|
mLocalMapRender = new MWRender::LocalMap(mViewer);
|
||||||
mMap = new MapWindow(mCustomMarkers, mDragAndDrop, mLocalMapRender);
|
mMap = new MapWindow(mCustomMarkers, mDragAndDrop, mLocalMapRender);
|
||||||
trackWindow(mMap, "map");
|
trackWindow(mMap, "map");
|
||||||
@ -1041,11 +1042,11 @@ namespace MWGui
|
|||||||
void WindowManager::setFocusObject(const MWWorld::Ptr& focus)
|
void WindowManager::setFocusObject(const MWWorld::Ptr& focus)
|
||||||
{
|
{
|
||||||
mToolTips->setFocusObject(focus);
|
mToolTips->setFocusObject(focus);
|
||||||
|
|
||||||
if(mShowOwned && mHud)
|
if(mShowOwned && mHud)
|
||||||
{
|
{
|
||||||
bool owned = mToolTips->checkOwned();
|
bool owned = mToolTips->checkOwned();
|
||||||
mHud->setCrosshairOwned(owned);
|
mHud->setCrosshairOwned(owned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace MWGui
|
|||||||
|
|
||||||
WindowManager(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem,
|
WindowManager(osgViewer::Viewer* viewer, osg::Group* guiRoot, Resource::ResourceSystem* resourceSystem,
|
||||||
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
|
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
|
||||||
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string,std::string>& fallbackMap);
|
Translation::Storage& translationDataStorage, ToUTF8::FromType encoding, bool exportFonts, const std::map<std::string,std::string>& fallbackMap, const std::string& versionDescription);
|
||||||
virtual ~WindowManager();
|
virtual ~WindowManager();
|
||||||
|
|
||||||
void initUI();
|
void initUI();
|
||||||
@ -489,6 +489,8 @@ namespace MWGui
|
|||||||
|
|
||||||
bool mShowOwned;
|
bool mShowOwned;
|
||||||
|
|
||||||
|
std::string mVersionDescription;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property.
|
* Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property.
|
||||||
* Supported syntax:
|
* Supported syntax:
|
||||||
|
@ -21,4 +21,4 @@ else (SUCCESS)
|
|||||||
message(WARNING "Failed to get valid version information from Git")
|
message(WARNING "Failed to get valid version information from Git")
|
||||||
endif (SUCCESS)
|
endif (SUCCESS)
|
||||||
|
|
||||||
configure_file(${VERSION_HPP_IN} ${VERSION_HPP})
|
configure_file(${VERSION_IN_FILE} ${VERSION_FILE})
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
project (Components)
|
project (Components)
|
||||||
|
|
||||||
# Version file
|
# Version file
|
||||||
set (VERSION_HPP_IN ${CMAKE_CURRENT_SOURCE_DIR}/version/version.hpp.cmake)
|
set (VERSION_IN_FILE "${OpenMW_SOURCE_DIR}/files/version.in")
|
||||||
set (VERSION_HPP ${CMAKE_CURRENT_SOURCE_DIR}/version/version.hpp)
|
set (VERSION_FILE "${OpenMW_BINARY_DIR}/resources/version")
|
||||||
if (GIT_CHECKOUT)
|
if (GIT_CHECKOUT)
|
||||||
add_custom_target (git-version
|
add_custom_target (git-version
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
|
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
|
||||||
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
|
-DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
|
||||||
-DVERSION_HPP_IN=${VERSION_HPP_IN}
|
-DVERSION_IN_FILE=${VERSION_IN_FILE}
|
||||||
-DVERSION_HPP=${VERSION_HPP}
|
-DVERSION_FILE=${VERSION_FILE}
|
||||||
-DOPENMW_VERSION_MAJOR=${OPENMW_VERSION_MAJOR}
|
-DOPENMW_VERSION_MAJOR=${OPENMW_VERSION_MAJOR}
|
||||||
-DOPENMW_VERSION_MINOR=${OPENMW_VERSION_MINOR}
|
-DOPENMW_VERSION_MINOR=${OPENMW_VERSION_MINOR}
|
||||||
-DOPENMW_VERSION_RELEASE=${OPENMW_VERSION_RELEASE}
|
-DOPENMW_VERSION_RELEASE=${OPENMW_VERSION_RELEASE}
|
||||||
-DOPENMW_VERSION=${OPENMW_VERSION}
|
-DOPENMW_VERSION=${OPENMW_VERSION}
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/GitVersion.cmake
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/GitVersion.cmake
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
else (GIT_CHECKOUT)
|
else (GIT_CHECKOUT)
|
||||||
configure_file(${VERSION_HPP_IN} ${VERSION_HPP})
|
configure_file(${VERSION_IN_FILE} ${VERSION_FILE})
|
||||||
endif (GIT_CHECKOUT)
|
endif (GIT_CHECKOUT)
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
41
components/version/version.cpp
Normal file
41
components/version/version.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include "version.hpp"
|
||||||
|
|
||||||
|
#include <boost/filesystem/path.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
|
namespace Version
|
||||||
|
{
|
||||||
|
|
||||||
|
Version getOpenmwVersion(const std::string &resourcePath)
|
||||||
|
{
|
||||||
|
boost::filesystem::path path (resourcePath + "/version");
|
||||||
|
|
||||||
|
boost::filesystem::ifstream stream (path);
|
||||||
|
|
||||||
|
Version v;
|
||||||
|
std::getline(stream, v.mVersion);
|
||||||
|
std::getline(stream, v.mCommitHash);
|
||||||
|
std::getline(stream, v.mTagHash);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Version::describe()
|
||||||
|
{
|
||||||
|
std::string str = "OpenMW version " + mVersion;
|
||||||
|
std::string rev = mCommitHash;
|
||||||
|
std::string tag = mTagHash;
|
||||||
|
if (!rev.empty() && !tag.empty())
|
||||||
|
{
|
||||||
|
rev = rev.substr(0, 10);
|
||||||
|
str += "\nRevision: " + rev;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getOpenmwVersionDescription(const std::string &resourcePath)
|
||||||
|
{
|
||||||
|
Version v = getOpenmwVersion(resourcePath);
|
||||||
|
return v.describe();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
components/version/version.hpp
Normal file
28
components/version/version.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef VERSION_HPP
|
||||||
|
#define VERSION_HPP
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace Version
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Version
|
||||||
|
{
|
||||||
|
std::string mVersion;
|
||||||
|
std::string mCommitHash;
|
||||||
|
std::string mTagHash;
|
||||||
|
|
||||||
|
std::string describe();
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Read OpenMW version from the version file located in resourcePath.
|
||||||
|
Version getOpenmwVersion(const std::string& resourcePath);
|
||||||
|
|
||||||
|
/// Helper function to getOpenmwVersion and describe() it
|
||||||
|
std::string getOpenmwVersionDescription(const std::string& resourcePath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // VERSION_HPP
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
#ifndef VERSION_HPP
|
|
||||||
#define VERSION_HPP
|
|
||||||
|
|
||||||
#define OPENMW_VERSION_MAJOR @OPENMW_VERSION_MAJOR@
|
|
||||||
#define OPENMW_VERSION_MINOR @OPENMW_VERSION_MINOR@
|
|
||||||
#define OPENMW_VERSION_RELEASE @OPENMW_VERSION_RELEASE@
|
|
||||||
#define OPENMW_VERSION "@OPENMW_VERSION@"
|
|
||||||
|
|
||||||
#define OPENMW_VERSION_COMMITHASH "@OPENMW_VERSION_COMMITHASH@"
|
|
||||||
#define OPENMW_VERSION_TAGHASH "@OPENMW_VERSION_TAGHASH@"
|
|
||||||
|
|
||||||
#endif // VERSION_HPP
|
|
||||||
|
|
3
files/version.in
Normal file
3
files/version.in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@OPENMW_VERSION@
|
||||||
|
@OPENMW_VERSION_COMMITHASH@
|
||||||
|
@OPENMW_VERSION_TAGHASH@
|
Loading…
x
Reference in New Issue
Block a user