Skip to content

Commit

Permalink
public: split VCS info to separate file for slightly better compilati…
Browse files Browse the repository at this point in the history
…on speeds
  • Loading branch information
a1batross committed Jan 13, 2025
1 parent 69341e3 commit 201d9c8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
3 changes: 0 additions & 3 deletions public/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,3 @@ const char *Q_buildarch( void )
);
}

const char *g_buildcommit = XASH_BUILD_COMMIT;
const char *g_buildbranch = XASH_BUILD_BRANCH;

18 changes: 18 additions & 0 deletions public/build_vcs.c
Original file line number Diff line number Diff line change
@@ -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;

12 changes: 8 additions & 4 deletions public/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,14 @@ def build(bld):
export_includes = '. ../common ../pm_shared ../engine',
export_defines = bld.env.EXPORT_DEFINES_LIST)

bld.stlib(source = bld.path.ant_glob('*.c'),
target = 'public',
use = 'sdk_includes werror',
defines = ['XASH_BUILD_COMMIT=\"%s\"' % bld.env.GIT_VERSION, 'XASH_BUILD_BRANCH=\"%s\"' % bld.env.GIT_BRANCH])
# build it separately to slightly improve rebuild times
bld.stlib(source = 'build_vcs.c',
target = 'build_vcs',
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.VALIDATE_TARGET:
Expand Down

0 comments on commit 201d9c8

Please sign in to comment.