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
|
#ifndef VERSION_HPP
|
||||||
#define VERSION_HPP
|
#define VERSION_HPP
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
namespace Version
|
namespace Version
|
||||||
{
|
{
|
||||||
|
std::string_view getVersion();
|
||||||
|
std::string_view getCommitHash();
|
||||||
|
std::string_view getTagHash();
|
||||||
|
int getLuaApiRevision();
|
||||||
|
|
||||||
struct Version
|
// Prepares string that contains version and commit hash.
|
||||||
{
|
std::string getOpenmwVersionDescription();
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // VERSION_HPP
|
#endif // VERSION_HPP
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface Activation
|
Interface Activation
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_activationhandlers.html
|
:file: generated_html/scripts_omw_activationhandlers.html
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface AI
|
Interface AI
|
||||||
============
|
============
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_ai.html
|
:file: generated_html/scripts_omw_ai.html
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface Camera
|
Interface Camera
|
||||||
================
|
================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_camera_camera.html
|
:file: generated_html/scripts_omw_camera_camera.html
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface Controls
|
Interface Controls
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_playercontrols.html
|
:file: generated_html/scripts_omw_playercontrols.html
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface MWUI
|
Interface MWUI
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_mwui_init.html
|
:file: generated_html/scripts_omw_mwui_init.html
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface Settings
|
Interface Settings
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_settings_player.html
|
:file: generated_html/scripts_omw_settings_player.html
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Interface UI
|
Interface UI
|
||||||
============
|
============
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/scripts_omw_ui.html
|
:file: generated_html/scripts_omw_ui.html
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.ambient
|
Package openmw.ambient
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_ambient.html
|
:file: generated_html/openmw_ambient.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.async
|
Package openmw.async
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_async.html
|
:file: generated_html/openmw_async.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw_aux.calendar
|
Package openmw_aux.calendar
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_aux_calendar.html
|
:file: generated_html/openmw_aux_calendar.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw_aux.time
|
Package openmw_aux.time
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_aux_time.html
|
:file: generated_html/openmw_aux_time.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw_aux.ui
|
Package openmw_aux.ui
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_aux_ui.html
|
:file: generated_html/openmw_aux_ui.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw_aux.util
|
Package openmw_aux.util
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_aux_util.html
|
:file: generated_html/openmw_aux_util.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.camera
|
Package openmw.camera
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_camera.html
|
:file: generated_html/openmw_camera.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.core
|
Package openmw.core
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_core.html
|
:file: generated_html/openmw_core.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.debug
|
Package openmw.debug
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_debug.html
|
:file: generated_html/openmw_debug.html
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
Package openmw.input
|
Package openmw.input
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_input.html
|
:file: generated_html/openmw_input.html
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.nearby
|
Package openmw.nearby
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_nearby.html
|
:file: generated_html/openmw_nearby.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.postprocessing
|
Package openmw.postprocessing
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_postprocessing.html
|
:file: generated_html/openmw_postprocessing.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.self
|
Package openmw.self
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_self.html
|
:file: generated_html/openmw_self.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.storage
|
Package openmw.storage
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_storage.html
|
:file: generated_html/openmw_storage.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.types
|
Package openmw.types
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_types.html
|
:file: generated_html/openmw_types.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.ui
|
Package openmw.ui
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_ui.html
|
:file: generated_html/openmw_ui.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.util
|
Package openmw.util
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_util.html
|
:file: generated_html/openmw_util.html
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
Package openmw.world
|
Package openmw.world
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
.. include:: version.rst
|
||||||
|
|
||||||
.. raw:: html
|
.. raw:: html
|
||||||
:file: generated_html/openmw_world.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