2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-12 05:10:52 +01:00

Merge branch 'master' into noffice

This commit is contained in:
Andrey Akhmichin 2024-04-07 22:07:06 +05:00
commit 55b973dca3
11 changed files with 69 additions and 12 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

@ -112,7 +112,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

@ -30,7 +30,7 @@ def configure(conf):
else:
conf.env.GOLDSOURCE_SUPPORT = False
if conf.env.GOLDSOURCE_SUPPORT:
if conf.env.GOLDSOURCE_SUPPORT and not conf.env.DEST_OS == 'win32':
conf.check_cc(lib='dl')
if conf.env.USE_VGUI:

View File

@ -161,6 +161,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 noffice)

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"};
@ -470,6 +474,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)