wscript: allow to setup engine default gamedir during configure

This commit is contained in:
Alibek Omarov 2022-09-11 02:12:44 +03:00
parent 686a966ff7
commit f571a41cf3
3 changed files with 14 additions and 4 deletions

View File

@ -35,7 +35,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#endif
#define E_GAME "XASH3D_GAME" // default env dir to start from
#define GAME_PATH "valve" // default dir to start from
#ifndef XASH_GAMEDIR
#define XASH_GAMEDIR "valve"
#endif
static char szGameDir[128]; // safe place to keep gamedir
static int szArgc;
@ -56,7 +58,7 @@ _inline int Sys_Start( void )
const char *game = getenv( E_GAME );
if( !game )
game = GAME_PATH;
game = XASH_GAMEDIR;
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
#if XASH_EMSCRIPTEN

View File

@ -45,7 +45,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#endif
#define E_GAME "XASH3D_GAME" // default env dir to start from
#define GAME_PATH "valve" // default dir to start from
#ifndef XASH_GAMEDIR
#define XASH_GAMEDIR "valve"
#endif
typedef void (*pfnChangeGame)( const char *progname );
typedef int (*pfnInit)( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
@ -152,7 +154,7 @@ _inline int Sys_Start( void )
const char *game = getenv( E_GAME );
if( !game )
game = GAME_PATH;
game = XASH_GAMEDIR;
strncpy( szGameDir, game, sizeof( szGameDir ) - 1 );

View File

@ -64,6 +64,9 @@ def options(opt):
grp.add_option('-d', '--dedicated', action = 'store_true', dest = 'DEDICATED', default = False,
help = 'build Xash Dedicated Server [default: %default]')
grp.add_option('--gamedir', action = 'store', dest = 'GAMEDIR', default = 'valve',
help = 'engine default game directory [default: %default]')
grp.add_option('--single-binary', action = 'store_true', dest = 'SINGLE_BINARY', default = False,
help = 'build single "xash" binary (always enabled for dedicated) [default: %default]')
@ -268,6 +271,9 @@ def configure(conf):
conf.env.GL = conf.options.GL or conf.options.ALL_RENDERERS
conf.env.SOFT = conf.options.SOFT or conf.options.ALL_RENDERERS
conf.env.GAMEDIR = conf.options.GAMEDIR
conf.define('XASH_GAMEDIR', conf.options.GAMEDIR)
if conf.env.DEST_OS != 'win32':
conf.check_cc(lib='dl', mandatory=False)