public: split VCS info to separate file for slightly better compilation speeds

This commit is contained in:
Alibek Omarov 2025-01-13 19:44:07 +03:00
parent 69341e36a3
commit 201d9c8f80
3 changed files with 26 additions and 7 deletions

View file

@ -239,6 +239,3 @@ const char *Q_buildarch( void )
); );
} }
const char *g_buildcommit = XASH_BUILD_COMMIT;
const char *g_buildbranch = XASH_BUILD_BRANCH;

18
public/build_vcs.c Normal file
View file

@ -0,0 +1,18 @@
/*
build_vcs.c - info from VCS
Copyright (C) 2025 Alibek Omarov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
const char *g_buildcommit = XASH_BUILD_COMMIT;
const char *g_buildbranch = XASH_BUILD_BRANCH;

View file

@ -118,11 +118,15 @@ def build(bld):
export_includes = '. ../common ../pm_shared ../engine', export_includes = '. ../common ../pm_shared ../engine',
export_defines = bld.env.EXPORT_DEFINES_LIST) export_defines = bld.env.EXPORT_DEFINES_LIST)
bld.stlib(source = bld.path.ant_glob('*.c'), # build it separately to slightly improve rebuild times
target = 'public', bld.stlib(source = 'build_vcs.c',
use = 'sdk_includes werror', target = 'build_vcs',
defines = ['XASH_BUILD_COMMIT=\"%s\"' % bld.env.GIT_VERSION, 'XASH_BUILD_BRANCH=\"%s\"' % bld.env.GIT_BRANCH]) defines = ['XASH_BUILD_COMMIT=\"%s\"' % bld.env.GIT_VERSION, 'XASH_BUILD_BRANCH=\"%s\"' % bld.env.GIT_BRANCH])
bld.stlib(source = bld.path.ant_glob('*.c', excl='build_vcs.c'),
target = 'public',
use = 'sdk_includes werror build_vcs')
if bld.env.TESTS: if bld.env.TESTS:
if bld.env.VALIDATE_TARGET: if bld.env.VALIDATE_TARGET:
bld.program(features = 'test', bld.program(features = 'test',