Browse Source

engine: remove single-binary option. Now platforms that don't need external launcher, shall set env.DISABLE_LAUNCHER

pull/2/head
Alibek Omarov 10 months ago
parent
commit
ae9c1d9f18
  1. 43
      engine/common/launcher.c
  2. 1
      engine/platform/platform.h
  3. 2
      engine/wscript
  4. 15
      wscript

43
engine/common/launcher.c

@ -13,17 +13,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -13,17 +13,15 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifdef SINGLE_BINARY
#include "build.h"
#include "common.h"
#ifdef XASH_SDLMAIN
#include "SDL.h"
#if XASH_ENABLE_MAIN
#if XASH_SDLMAIN
#include <SDL.h>
#endif
#if XASH_EMSCRIPTEN
#include <emscripten.h>
#endif
#include "build.h"
#include "common.h"
#define E_GAME "XASH3D_GAME" // default env dir to start from
#ifndef XASH_GAMEDIR
@ -47,40 +45,35 @@ static void Sys_ChangeGame( const char *progname ) @@ -47,40 +45,35 @@ static void Sys_ChangeGame( const char *progname )
exit( Host_Main( szArgc, szArgv, szGameDir, 1, &Sys_ChangeGame ) );
}
_inline int Sys_Start( void )
static int Sys_Start( void )
{
int ret;
const char *game = getenv( E_GAME );
if( !game )
game = XASH_GAMEDIR;
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
#if XASH_EMSCRIPTEN
#ifdef EMSCRIPTEN_LIB_FS
// For some unknown reason emscripten refusing to load libraries later
COM_LoadLibrary("menu", 0 );
COM_LoadLibrary("server", 0 );
COM_LoadLibrary("client", 0 );
COM_LoadLibrary( "menu", 0 );
COM_LoadLibrary( "server", 0 );
COM_LoadLibrary( "client", 0 );
#endif
#if XASH_DEDICATED
// NodeJS support for debug
EM_ASM(try{
FS.mkdir('/xash');
FS.mount(NODEFS, { root: '.'}, '/xash' );
FS.chdir('/xash');
}catch(e){};);
EM_ASM(try {
FS.mkdir( '/xash' );
FS.mount( NODEFS, { root: '.'}, '/xash' );
FS.chdir( '/xash' );
} catch( e ) { };);
#endif
#elif XASH_IOS
{
void IOS_LaunchDialog( void );
IOS_LaunchDialog();
}
IOS_LaunchDialog();
#endif
ret = Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
return ret;
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
}
int main( int argc, char **argv )
@ -94,4 +87,4 @@ int main( int argc, char **argv ) @@ -94,4 +87,4 @@ int main( int argc, char **argv )
#endif // XASH_PSVITA
return Sys_Start();
}
#endif // SINGLE_BINARY
#endif // XASH_ENABLE_MAIN

1
engine/platform/platform.h

@ -40,6 +40,7 @@ void Platform_SetStatus( const char *status ); @@ -40,6 +40,7 @@ void Platform_SetStatus( const char *status );
// legacy iOS port functions
#if TARGET_OS_IOS
const char *IOS_GetDocsDir( void );
void IOS_LaunchDialog( void );
#endif // TARGET_OS_IOS
#if XASH_WIN32 || XASH_LINUX

2
engine/wscript

@ -110,7 +110,7 @@ def configure(conf): @@ -110,7 +110,7 @@ def configure(conf):
conf.define_cond('XASH_ENGINE_TESTS', conf.env.ENGINE_TESTS)
conf.define_cond('XASH_STATIC_LIBS', conf.env.STATIC_LINKING)
conf.define_cond('XASH_CUSTOM_SWAP', conf.options.CUSTOM_SWAP)
conf.define_cond('SINGLE_BINARY', conf.env.SINGLE_BINARY)
conf.define_cond('XASH_ENABLE_MAIN', conf.env.DISABLE_LAUNCHER)
conf.define_cond('XASH_NO_ASYNC_NS_RESOLVE', conf.options.NO_ASYNC_RESOLVE)
conf.define_cond('SUPPORT_BSP2_FORMAT', conf.options.SUPPORT_BSP2_FORMAT)
conf.define_cond('XASH_64BIT', conf.env.DEST_SIZEOF_VOID_P != 4)

15
wscript

@ -78,7 +78,7 @@ SUBDIRS = [ @@ -78,7 +78,7 @@ SUBDIRS = [
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
Subproject('stub/client', lambda x: not x.env.DEDICATED),
Subproject('game_launch', lambda x: not x.env.SINGLE_BINARY and x.env.DEST_OS != 'android'),
Subproject('game_launch', lambda x: not x.env.DEDICATED and not x.env.DISABLE_LAUNCHER),
# disable only by external dependency presense
Subproject('3rdparty/opus', lambda x: not x.env.HAVE_SYSTEM_OPUS and not x.env.DEDICATED),
@ -113,9 +113,6 @@ def options(opt): @@ -113,9 +113,6 @@ def options(opt):
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]')
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
@ -202,29 +199,23 @@ def configure(conf): @@ -202,29 +199,23 @@ def configure(conf):
conf.options.GL4ES = True
conf.options.GLES3COMPAT = True
conf.options.GL = False
conf.options.SINGLE_BINARY = True
conf.define('XASH_SDLMAIN', 1)
elif conf.env.MAGX:
conf.options.SDL12 = True
conf.options.NO_VGUI = True
conf.options.GL = False
conf.options.LOW_MEMORY = 1
conf.options.SINGLE_BINARY = True
conf.options.NO_ASYNC_RESOLVE = True
conf.define('XASH_SDLMAIN', 1)
enforce_pic = False
elif conf.env.DEST_OS == 'dos':
conf.options.SINGLE_BINARY = True
elif conf.env.DEST_OS == 'nswitch':
conf.options.NO_VGUI = True
conf.options.GL = True
conf.options.SINGLE_BINARY = True
conf.options.NO_ASYNC_RESOLVE = True
conf.options.USE_STBTT = True
elif conf.env.DEST_OS == 'psvita':
conf.options.NO_VGUI = True
conf.options.GL = True
conf.options.SINGLE_BINARY = True
conf.options.NO_ASYNC_RESOLVE = True
conf.options.USE_STBTT = True
# we'll specify -fPIC by hand for shared libraries only
@ -357,9 +348,11 @@ def configure(conf): @@ -357,9 +348,11 @@ def configure(conf):
conf.env.ENABLE_UTILS = conf.options.ENABLE_UTILS
conf.env.ENABLE_FUZZER = conf.options.ENABLE_FUZZER
conf.env.DEDICATED = conf.options.DEDICATED
conf.env.SINGLE_BINARY = conf.options.SINGLE_BINARY or conf.env.DEDICATED
conf.env.SUPPORT_BSP2_FORMAT = conf.options.SUPPORT_BSP2_FORMAT
# disable game_launch compiling on platform where it's not needed
conf.env.DISABLE_LAUNCHER = conf.env.DEST_OS in ['android', 'nswitch', 'psvita', 'dos'] or conf.env.MAGX
if conf.env.SAILFISH == 'aurora':
conf.env.DEFAULT_RPATH = '/usr/share/su.xash.Engine/lib'
elif conf.env.DEST_OS == 'darwin':

Loading…
Cancel
Save