mirror of https://github.com/OpenMW/openmw.git
Show OpenMW version and Lua API revision in documentation.
parent
2cd17830d3
commit
f260fa006e
@ -1,38 +0,0 @@
|
||||
#include "version.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
namespace Version
|
||||
{
|
||||
|
||||
Version getOpenmwVersion(const std::filesystem::path& resourcePath)
|
||||
{
|
||||
std::ifstream stream(resourcePath / "version");
|
||||
|
||||
Version v;
|
||||
std::getline(stream, v.mVersion);
|
||||
std::getline(stream, v.mCommitHash);
|
||||
std::getline(stream, v.mTagHash);
|
||||
return v;
|
||||
}
|
||||
|
||||
std::string Version::describe() const
|
||||
{
|
||||
std::string str = "OpenMW version " + mVersion;
|
||||
std::string rev = mCommitHash;
|
||||
if (!rev.empty())
|
||||
{
|
||||
rev = rev.substr(0, 10);
|
||||
str += "\nRevision: " + rev;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string getOpenmwVersionDescription(const std::filesystem::path& resourcePath)
|
||||
{
|
||||
Version v = getOpenmwVersion(resourcePath);
|
||||
return v.describe();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
#include "version.hpp"
|
||||
|
||||
namespace Version
|
||||
{
|
||||
std::string_view getVersion()
|
||||
{
|
||||
return "@OPENMW_VERSION@";
|
||||
}
|
||||
|
||||
std::string_view getCommitHash()
|
||||
{
|
||||
return "@OPENMW_VERSION_COMMITHASH@";
|
||||
}
|
||||
|
||||
std::string_view getTagHash()
|
||||
{
|
||||
return "@OPENMW_VERSION_TAGHASH@";
|
||||
}
|
||||
|
||||
int getLuaApiRevision()
|
||||
{
|
||||
return @OPENMW_LUA_API_REVISION@;
|
||||
}
|
||||
|
||||
std::string getOpenmwVersionDescription()
|
||||
{
|
||||
std::string str = "OpenMW version ";
|
||||
str += getVersion();
|
||||
if (!getCommitHash().empty())
|
||||
{
|
||||
str += "\nRevision: ";
|
||||
str += getCommitHash().substr(0, 10);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
@ -1,27 +1,18 @@
|
||||
#ifndef VERSION_HPP
|
||||
#define VERSION_HPP
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace Version
|
||||
{
|
||||
std::string_view getVersion();
|
||||
std::string_view getCommitHash();
|
||||
std::string_view getTagHash();
|
||||
int getLuaApiRevision();
|
||||
|
||||
struct Version
|
||||
{
|
||||
std::string mVersion;
|
||||
std::string mCommitHash;
|
||||
std::string mTagHash;
|
||||
|
||||
std::string describe() const;
|
||||
};
|
||||
|
||||
/// Read OpenMW version from the version file located in resourcePath.
|
||||
Version getOpenmwVersion(const std::filesystem::path& resourcePath);
|
||||
|
||||
/// Helper function to getOpenmwVersion and describe() it
|
||||
std::string getOpenmwVersionDescription(const std::filesystem::path& resourcePath);
|
||||
|
||||
// Prepares string that contains version and commit hash.
|
||||
std::string getOpenmwVersionDescription();
|
||||
}
|
||||
|
||||
#endif // VERSION_HPP
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface Activation
|
||||
====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_activationhandlers.html
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface AI
|
||||
============
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_ai.html
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface Camera
|
||||
================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_camera_camera.html
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface Controls
|
||||
==================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_playercontrols.html
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface MWUI
|
||||
==============
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_mwui_init.html
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface Settings
|
||||
==================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_settings_player.html
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
Interface UI
|
||||
============
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/scripts_omw_ui.html
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.ambient
|
||||
======================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_ambient.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.async
|
||||
====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_async.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw_aux.calendar
|
||||
===========================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_aux_calendar.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw_aux.time
|
||||
=======================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_aux_time.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw_aux.ui
|
||||
=======================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_aux_ui.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw_aux.util
|
||||
=======================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_aux_util.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.camera
|
||||
=====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_camera.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.core
|
||||
===================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_core.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.debug
|
||||
====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_debug.html
|
||||
|
@ -1,6 +1,8 @@
|
||||
Package openmw.input
|
||||
====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_input.html
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.nearby
|
||||
=====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_nearby.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.postprocessing
|
||||
=============================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_postprocessing.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.self
|
||||
===================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_self.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.storage
|
||||
======================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_storage.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.types
|
||||
====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_types.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.ui
|
||||
=================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_ui.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.util
|
||||
===================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_util.html
|
||||
|
@ -1,5 +1,7 @@
|
||||
Package openmw.world
|
||||
====================
|
||||
|
||||
.. include:: version.rst
|
||||
|
||||
.. raw:: html
|
||||
:file: generated_html/openmw_world.html
|
||||
|
@ -0,0 +1,2 @@
|
||||
| `OpenMW version:` |version|
|
||||
| `core.API_REVISION:` |luaApiRevision| `* <openmw_core.html##(core).API_REVISION>`_
|
@ -1,3 +0,0 @@
|
||||
@OPENMW_VERSION@
|
||||
@OPENMW_VERSION_COMMITHASH@
|
||||
@OPENMW_VERSION_TAGHASH@
|
Loading…
Reference in New Issue