Merge branch 'master' into residual_point

This commit is contained in:
Andrey Akhmichin 2024-04-07 22:14:21 +05:00
commit 2f55dd0478
11 changed files with 75 additions and 14 deletions

View File

@ -88,6 +88,24 @@ endif()
# MAIN BUILD CODE \
###################\
execute_process(COMMAND "git" "describe" "--dirty" "--always"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "git" "rev-parse" "--abbrev-ref" "HEAD"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_VERSION)
add_definitions(-DXASH_BUILD_COMMIT="${GIT_VERSION}")
endif()
if(GIT_BRANCH)
add_definitions(-DXASH_BUILD_BRANCH="${GIT_BRANCH}")
endif()
file(STRINGS "mod_options.txt" MOD_OPTIONS_STRINGS REGEX "^([A-Za-z0-9_-]+)=([A-Za-z0-9_-]+)\ \#\ (.*)$")
foreach(LINE IN LISTS MOD_OPTIONS_STRINGS)
# file() itself doesn't populate CMAKE_MATCH_<n>, so

View File

@ -123,7 +123,9 @@ set (CLDLL_SOURCES
train.cpp
tri.cpp
util.cpp
view.cpp)
view.cpp
../game_shared/vcs_info.cpp
)
if (USE_VGUI)
list(APPEND CLDLL_SOURCES

View File

@ -42,6 +42,7 @@ extern "C"
}
#include <string.h>
#include "vcs_info.h"
cl_enginefunc_t gEngfuncs;
CHud gHUD;
@ -171,6 +172,9 @@ int DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
EV_HookEvents();
gEngfuncs.pfnRegisterVariable( "cl_game_build_commit", g_VCSInfo_Commit, 0 );
gEngfuncs.pfnRegisterVariable( "cl_game_build_branch", g_VCSInfo_Branch, 0 );
return 1;
}

View File

@ -15,7 +15,7 @@ def options(opt):
grp.add_option('--enable-novgui-scoreboard', action = 'store_true', dest = 'USE_NOVGUI_SCOREBOARD', default = False,
help = 'Prefer non-VGUI Scoreboard when USE_VGUI is enabled')
grp.add_option('--disable-goldsrc-support', action = 'store_false', dest = 'GOLDSOURCE_SUPPORT',
default=True, help = 'disable GoldSource compatibility')
default=True, help = 'disable GoldSource compatibility on i386 Win/Mac/Linux')
opt.load('vgui')
@ -24,9 +24,13 @@ def configure(conf):
conf.env.USE_NOVGUI_MOTD = conf.options.USE_NOVGUI_MOTD
conf.env.USE_NOVGUI_SCOREBOARD = conf.options.USE_NOVGUI_SCOREBOARD
conf.env.USE_VOICEMGR = conf.options.USE_VOICEMGR
conf.env.GOLDSOURCE_SUPPORT = conf.options.GOLDSOURCE_SUPPORT
if conf.env.GOLDSOURCE_SUPPORT:
if (conf.env.DEST_CPU == 'x86' or (conf.env.DEST_CPU == 'x86_64' and not conf.options.ALLOW64)) and conf.env.DEST_OS in ['win32', 'linux', 'darwin']:
conf.env.GOLDSOURCE_SUPPORT = conf.options.GOLDSOURCE_SUPPORT
else:
conf.env.GOLDSOURCE_SUPPORT = False
if conf.env.GOLDSOURCE_SUPPORT and not conf.env.DEST_OS == 'win32':
conf.check_cc(lib='dl')
if conf.env.USE_VGUI:

View File

@ -157,6 +157,7 @@ set (SVDLL_SOURCES
../pm_shared/pm_debug.c
../pm_shared/pm_math.c
../pm_shared/pm_shared.c
../game_shared/vcs_info.cpp
)
include_directories (. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public)

View File

@ -16,6 +16,10 @@
#include "eiface.h"
#include "util.h"
#include "game.h"
#include "vcs_info.h"
static cvar_t build_commit = { "sv_game_build_commit", g_VCSInfo_Commit };
static cvar_t build_branch = { "sv_game_build_branch", g_VCSInfo_Commit };
cvar_t displaysoundlist = {"displaysoundlist","0"};
@ -548,6 +552,9 @@ void GameDLLInit( void )
g_enable_cheats = CVAR_GET_POINTER( "sv_cheats" );
CVAR_REGISTER( &build_commit );
CVAR_REGISTER( &build_branch );
CVAR_REGISTER( &displaysoundlist );
CVAR_REGISTER( &allow_spectators );

View File

@ -24,10 +24,11 @@ def build(bld):
source = bld.path.ant_glob('**/*.cpp', excl=excluded_files)
source += bld.path.parent.ant_glob('pm_shared/*.c')
source += ['../game_shared/vcs_info.cpp']
defines = []
if bld.env.USE_VOICEMGR:
source += bld.path.parent.ant_glob('game_shared/voice_gamemgr.cpp')
source += ['../game_shared/voice_gamemgr.cpp']
else:
defines += ['NO_VOICEGAMEMGR']

13
game_shared/vcs_info.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "vcs_info.h"
#ifdef XASH_BUILD_COMMIT
const char *g_VCSInfo_Commit = XASH_BUILD_COMMIT;
#else
const char *g_VCSInfo_Commit = "unknown-commit";
#endif
#ifdef XASH_BUILD_BRANCH
const char *g_VCSInfo_Branch = XASH_BUILD_BRANCH;
#else
const char *g_VCSInfo_Branch = "unknown-commit";
#endif

7
game_shared/vcs_info.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef VCS_INFO_H
#define VCS_INFO_H
extern const char *g_VCSInfo_Commit;
extern const char *g_VCSInfo_Branch;
#endif // VCS_INFO_H

16
waf vendored

File diff suppressed because one or more lines are too long

View File

@ -55,7 +55,11 @@ def configure(conf):
if conf.env.COMPILER_CC == 'msvc':
conf.load('msvc_pdb')
conf.load('msvs msdev subproject clang_compilation_database strip_on_install enforce_pic')
conf.load('msvs msdev subproject clang_compilation_database strip_on_install enforce_pic gitversion')
if conf.env.GIT_VERSION:
conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION)
if conf.env.GIT_BRANCH:
conf.define('XASH_BUILD_BRANCH', conf.env.GIT_BRANCH)
enforce_pic = True # modern defaults
conf.check_pic(enforce_pic)