Add tpt.version.vcstag
Which is by default only enabled for static release builds.
This commit is contained in:
parent
3e4fed02d4
commit
2dc468bcd1
@ -220,3 +220,10 @@ option(
|
|||||||
value: 'disabled',
|
value: 'disabled',
|
||||||
description: 'Render icons with Inkscape (inkscape binary needs to be in PATH)'
|
description: 'Render icons with Inkscape (inkscape binary needs to be in PATH)'
|
||||||
)
|
)
|
||||||
|
option(
|
||||||
|
'resolve_vcs_tag',
|
||||||
|
type: 'combo',
|
||||||
|
choices: [ 'no', 'static_release_only', 'yes' ],
|
||||||
|
value: 'static_release_only',
|
||||||
|
description: 'Enable VCS tag resolution, introduces an always-stale custom target'
|
||||||
|
)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "VcsTag.h"
|
||||||
|
|
||||||
constexpr bool SET_WINDOW_ICON = @SET_WINDOW_ICON@;
|
constexpr bool SET_WINDOW_ICON = @SET_WINDOW_ICON@;
|
||||||
constexpr bool DEBUG = @DEBUG@;
|
constexpr bool DEBUG = @DEBUG@;
|
||||||
|
3
src/VcsTag.template.h
Normal file
3
src/VcsTag.template.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
constexpr char VCS_TAG[] = "@VCS_TAG@";
|
@ -1,5 +1,6 @@
|
|||||||
#include "bzip2/bz2wrap.h"
|
#include "bzip2/bz2wrap.h"
|
||||||
#include "common/VariantIndex.h"
|
#include "common/VariantIndex.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
#include "LuaScriptInterface.h"
|
#include "LuaScriptInterface.h"
|
||||||
|
|
||||||
@ -416,6 +417,12 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
|||||||
lua_setfield(l, tptPropertiesVersion, "snapshot");
|
lua_setfield(l, tptPropertiesVersion, "snapshot");
|
||||||
lua_pushinteger(l, MOD_ID);
|
lua_pushinteger(l, MOD_ID);
|
||||||
lua_setfield(l, tptPropertiesVersion, "modid");
|
lua_setfield(l, tptPropertiesVersion, "modid");
|
||||||
|
auto vcsTag = ByteString(VCS_TAG);
|
||||||
|
if (vcsTag.size())
|
||||||
|
{
|
||||||
|
tpt_lua_pushByteString(l, VCS_TAG);
|
||||||
|
lua_setfield(l, tptPropertiesVersion, "vcstag");
|
||||||
|
}
|
||||||
lua_setfield(l, tptProperties, "version");
|
lua_setfield(l, tptProperties, "version");
|
||||||
|
|
||||||
lua_sethook(l, &luacon_hook, LUA_MASKCOUNT, 200);
|
lua_sethook(l, &luacon_hook, LUA_MASKCOUNT, 200);
|
||||||
|
@ -86,6 +86,23 @@ common_files = files(
|
|||||||
'Probability.cpp',
|
'Probability.cpp',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
resolve_vcs_tag = get_option('resolve_vcs_tag')
|
||||||
|
if resolve_vcs_tag == 'yes' or (resolve_vcs_tag == 'static_release_only' and not is_debug and is_static)
|
||||||
|
common_files += vcs_tag(
|
||||||
|
input: 'VcsTag.template.h',
|
||||||
|
output: 'VcsTag.h',
|
||||||
|
fallback: 'unknown',
|
||||||
|
)
|
||||||
|
else
|
||||||
|
vcs_tag_conf_data = configuration_data()
|
||||||
|
vcs_tag_conf_data.set('VCS_TAG', '')
|
||||||
|
configure_file(
|
||||||
|
input: 'VcsTag.template.h',
|
||||||
|
output: 'VcsTag.h',
|
||||||
|
configuration: vcs_tag_conf_data
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
if host_platform == 'linux'
|
if host_platform == 'linux'
|
||||||
powder_files += files('WindowIcon.cpp')
|
powder_files += files('WindowIcon.cpp')
|
||||||
font_files += files('WindowIcon.cpp')
|
font_files += files('WindowIcon.cpp')
|
||||||
|
Reference in New Issue
Block a user