mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2025-01-22 00:11:20 +00:00
moved the create_git_header scripts into the cnq3 repository
This commit is contained in:
parent
ae2560984a
commit
0bc9c75e49
8 changed files with 35 additions and 17 deletions
9
build/create_git_header.cmd
Normal file
9
build/create_git_header.cmd
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
@echo off
|
||||||
|
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse HEAD`) DO (
|
||||||
|
SET GIT_COMMIT_HASH=%%F
|
||||||
|
)
|
||||||
|
FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-parse --abbrev-ref HEAD`) DO (
|
||||||
|
SET GIT_BRANCH_NAME=%%F
|
||||||
|
)
|
||||||
|
:: We create the file in one go to avoid doubled lines in multi-threaded builds.
|
||||||
|
(echo #define GIT_COMMIT ^"%GIT_COMMIT_HASH%^" && echo #define GIT_BRANCH ^"%GIT_BRANCH_NAME%^")>%1
|
6
build/create_git_header.sh
Executable file
6
build/create_git_header.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
COMMIT="$(git rev-parse HEAD)"
|
||||||
|
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
echo "#define GIT_COMMIT \"${COMMIT}\"" > $1
|
||||||
|
echo "#define GIT_BRANCH \"${BRANCH}\"" >> $1
|
|
@ -28,7 +28,7 @@ ifeq ($(config),debug_x32)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
@ -59,7 +59,7 @@ ifeq ($(config),debug_x64)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
@ -90,7 +90,7 @@ ifeq ($(config),release_x32)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
@ -121,7 +121,7 @@ ifeq ($(config),release_x64)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -28,7 +28,7 @@ ifeq ($(config),debug_x32)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
@ -59,7 +59,7 @@ ifeq ($(config),debug_x64)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
@ -90,7 +90,7 @@ ifeq ($(config),release_x32)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
@ -121,7 +121,7 @@ ifeq ($(config),release_x64)
|
||||||
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
define PREBUILDCMDS
|
define PREBUILDCMDS
|
||||||
@echo Running prebuild commands
|
@echo Running prebuild commands
|
||||||
"../../../cnq3tools/git/create_git_header.sh" "../../code/qcommon/git.h"
|
"../create_git_header.sh" "../../code/qcommon/git.h"
|
||||||
endef
|
endef
|
||||||
define PRELINKCMDS
|
define PRELINKCMDS
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -26,7 +26,7 @@ path_build = path_root.."/cnq3/build"
|
||||||
path_bin = path_root.."/.bin"
|
path_bin = path_root.."/.bin"
|
||||||
|
|
||||||
-- relative to the makefile
|
-- relative to the makefile
|
||||||
make_path_git_scripts = "../../../cnq3tools/git"
|
make_path_git_scripts = ".."
|
||||||
make_path_git_header = "../../code/qcommon/git.h"
|
make_path_git_header = "../../code/qcommon/git.h"
|
||||||
make_path_bin = "../../../.bin"
|
make_path_bin = "../../../.bin"
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\debug_x32\cnq3-server-x86.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\debug_x32\cnq3-server-x86.exe" "$(QUAKE3DIR)"
|
||||||
|
@ -148,7 +148,7 @@ copy "..\..\..\.bin\debug_x32\cnq3-server-x86.pdb" "$(QUAKE3DIR)"</Command>
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\debug_x64\cnq3-server-x64.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\debug_x64\cnq3-server-x64.exe" "$(QUAKE3DIR)"
|
||||||
|
@ -187,7 +187,7 @@ copy "..\..\..\.bin\debug_x64\cnq3-server-x64.pdb" "$(QUAKE3DIR)"</Command>
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\release_x32\cnq3-server-x86.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\release_x32\cnq3-server-x86.exe" "$(QUAKE3DIR)"
|
||||||
|
@ -225,7 +225,7 @@ copy "..\..\..\.bin\release_x32\cnq3-server-x86.pdb" "$(QUAKE3DIR)"</Command>
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\release_x64\cnq3-server-x64.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\release_x64\cnq3-server-x64.exe" "$(QUAKE3DIR)"
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\debug_x32\cnq3-x86.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\debug_x32\cnq3-x86.exe" "$(QUAKE3DIR)"
|
||||||
|
@ -150,7 +150,7 @@ copy "..\..\..\.bin\debug_x32\cnq3-x86.pdb" "$(QUAKE3DIR)"</Command>
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\debug_x64\cnq3-x64.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\debug_x64\cnq3-x64.exe" "$(QUAKE3DIR)"
|
||||||
|
@ -190,7 +190,7 @@ copy "..\..\..\.bin\debug_x64\cnq3-x64.pdb" "$(QUAKE3DIR)"</Command>
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\release_x32\cnq3-x86.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\release_x32\cnq3-x86.exe" "$(QUAKE3DIR)"
|
||||||
|
@ -229,7 +229,7 @@ copy "..\..\..\.bin\release_x32\cnq3-x86.pdb" "$(QUAKE3DIR)"</Command>
|
||||||
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions> ..\..\cnq3\code\win32\winquake.res /STACK:8388608 /OPT:REF /OPT:ICF %(AdditionalOptions)</AdditionalOptions>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"..\..\..\cnq3tools\git\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
<Command>"..\create_git_header.cmd" "..\..\code\qcommon\git.h"</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "..\..\..\.bin\release_x64\cnq3-x64.exe" "$(QUAKE3DIR)"
|
<Command>copy "..\..\..\.bin\release_x64\cnq3-x64.exe" "$(QUAKE3DIR)"
|
||||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#include "q_shared.h"
|
#include "q_shared.h"
|
||||||
#include "qcommon.h"
|
#include "qcommon.h"
|
||||||
|
#include "git.h"
|
||||||
|
|
||||||
static cvar_t* cvar_vars;
|
static cvar_t* cvar_vars;
|
||||||
static cvar_t* cvar_cheats;
|
static cvar_t* cvar_cheats;
|
||||||
|
@ -675,6 +676,8 @@ void Cvar_Update( vmCvar_t *vmCvar )
|
||||||
void Cvar_Init()
|
void Cvar_Init()
|
||||||
{
|
{
|
||||||
cvar_cheats = Cvar_Get( "sv_cheats", "1", CVAR_ROM | CVAR_SYSTEMINFO );
|
cvar_cheats = Cvar_Get( "sv_cheats", "1", CVAR_ROM | CVAR_SYSTEMINFO );
|
||||||
|
Cvar_Get( "git_branch", GIT_BRANCH, CVAR_ROM );
|
||||||
|
Cvar_Get( "git_headHash", GIT_COMMIT, CVAR_ROM );
|
||||||
|
|
||||||
Cmd_AddCommand( "toggle", Cvar_Toggle_f );
|
Cmd_AddCommand( "toggle", Cvar_Toggle_f );
|
||||||
Cmd_AddCommand( "set", Cvar_Set_f );
|
Cmd_AddCommand( "set", Cvar_Set_f );
|
||||||
|
|
Loading…
Reference in a new issue