Add Linux Makefiles, more MSVC6 fixes.

This commit is contained in:
Marco Cawthorne 2023-09-09 13:32:07 -07:00
parent d62c5fda47
commit d8af1b1bc7
Signed by: eukara
GPG key ID: CE2032F0A2882A22
21 changed files with 3319 additions and 3162 deletions

16
.gitignore vendored
View file

@ -1,8 +1,8 @@
build/ linux/cl_obj/*
waf3-*/ linux/sv_obj/*
waf-*/ linux/client.so
.waf3-*/ linux/thewastes.so
.waf-*/ win32/cl_obj/*
*.kate-swp win32/sv_obj/*
.lock* win32/client.dll
*.pyc win32/thewastes.dll

View file

@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\utils\vgui\include" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\utils\vgui\include" /I "..\engine" /I "..\common" /I "..\game_shared" /I "..\pm_shared" /I "..\dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /D "CLIENT_WEAPONS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"

View file

@ -15,7 +15,6 @@
#include "camera.h" #include "camera.h"
#include "in_defs.h" #include "in_defs.h"
#define USE_SDL
#ifndef USE_SDL #ifndef USE_SDL
#include "windows.h" #include "windows.h"
#else #else

1070
cl_dll/input_sdl.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
@ -19,16 +19,7 @@
#include "in_defs.h" #include "in_defs.h"
#include "../engine/keydefs.h" #include "../engine/keydefs.h"
#include "view.h" #include "view.h"
#include "port.h" #include "windows.h"
#define USE_SDL
#ifndef USE_SDL
#include <windows.h>
#else
#include <SDL2/SDL_mouse.h>
#include <SDL2/SDL_gamecontroller.h>
#endif
#define MOUSE_BUTTON_COUNT 5 #define MOUSE_BUTTON_COUNT 5
@ -74,9 +65,7 @@ cvar_t *sensitivity;
int mouse_buttons; int mouse_buttons;
int mouse_oldbuttonstate; int mouse_oldbuttonstate;
#ifndef USE_SDL
POINT current_pos; POINT current_pos;
#endif
int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum; int mouse_x, mouse_y, old_mouse_x, old_mouse_y, mx_accum, my_accum;
static int restore_spi; static int restore_spi;
@ -107,7 +96,6 @@ enum _ControlList
AxisTurn AxisTurn
}; };
#ifndef USE_SDL
DWORD dwAxisFlags[JOY_MAX_AXES] = DWORD dwAxisFlags[JOY_MAX_AXES] =
{ {
JOY_RETURNX, JOY_RETURNX,
@ -117,15 +105,10 @@ DWORD dwAxisFlags[JOY_MAX_AXES] =
JOY_RETURNU, JOY_RETURNU,
JOY_RETURNV JOY_RETURNV
}; };
#endif
DWORD dwAxisMap[ JOY_MAX_AXES ]; DWORD dwAxisMap[ JOY_MAX_AXES ];
DWORD dwControlMap[ JOY_MAX_AXES ]; DWORD dwControlMap[ JOY_MAX_AXES ];
#ifdef USE_SDL
int pdwRawValue[ JOY_MAX_AXES ];
#else
PDWORD pdwRawValue[ JOY_MAX_AXES ]; PDWORD pdwRawValue[ JOY_MAX_AXES ];
#endif
// none of these cvars are saved over a session // none of these cvars are saved over a session
// this means that advanced controller configuration needs to be executed // this means that advanced controller configuration needs to be executed
@ -159,11 +142,7 @@ int joy_id;
DWORD joy_flags; DWORD joy_flags;
DWORD joy_numbuttons; DWORD joy_numbuttons;
#ifdef USE_SDL
static SDL_GameController *s_pJoystick = NULL;
#else
static JOYINFOEX ji; static JOYINFOEX ji;
#endif
/* /*
=========== ===========
@ -191,10 +170,8 @@ void DLLEXPORT IN_ActivateMouse (void)
{ {
if (mouseinitialized) if (mouseinitialized)
{ {
#ifdef _WIN32
if (mouseparmsvalid) if (mouseparmsvalid)
restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
#endif
mouseactive = 1; mouseactive = 1;
} }
} }
@ -208,10 +185,9 @@ void DLLEXPORT IN_DeactivateMouse (void)
{ {
if (mouseinitialized) if (mouseinitialized)
{ {
#ifdef _WIN32
if (restore_spi) if (restore_spi)
SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0); SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0);
#endif
mouseactive = 0; mouseactive = 0;
} }
} }
@ -227,7 +203,6 @@ void IN_StartupMouse (void)
return; return;
mouseinitialized = 1; mouseinitialized = 1;
#ifdef _WIN32
mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);
if (mouseparmsvalid) if (mouseparmsvalid)
@ -248,7 +223,7 @@ void IN_StartupMouse (void)
newmouseparms[2] = originalmouseparms[2]; newmouseparms[2] = originalmouseparms[2];
} }
} }
#endif
mouse_buttons = MOUSE_BUTTON_COUNT; mouse_buttons = MOUSE_BUTTON_COUNT;
} }
@ -283,9 +258,7 @@ FIXME: Call through to engine?
*/ */
void IN_ResetMouse( void ) void IN_ResetMouse( void )
{ {
#ifndef USE_SDL
SetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() ); SetCursorPos ( gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY() );
#endif
} }
/* /*
@ -341,17 +314,10 @@ void IN_MouseMove ( float frametime, usercmd_t *cmd)
// GAGE -> if your dead you cant move your head dumbass :) // GAGE -> if your dead you cant move your head dumbass :)
if ( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission) if ( !iMouseInUse && !g_iVisibleMouse && !gHUD.m_iIntermission)
{ {
#ifdef USE_SDL
int deltaX, deltaY;
SDL_GetRelativeMouseState( &deltaX, &deltaY );
mx = deltaX + mx_accum;
my = deltaY + my_accum;
#else
GetCursorPos (&current_pos); GetCursorPos (&current_pos);
mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum;
my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum;
#endif
mx_accum = 0; mx_accum = 0;
my_accum = 0; my_accum = 0;
@ -444,17 +410,10 @@ void DLLEXPORT IN_Accumulate (void)
{ {
if (mouseactive) if (mouseactive)
{ {
#ifdef USE_SDL
int x = 0, y = 0;
SDL_GetRelativeMouseState( &x, &y );
mx_accum += x;
my_accum += y;
#else
GetCursorPos (&current_pos); GetCursorPos (&current_pos);
mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX();
my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); my_accum += current_pos.y - gEngfuncs.GetWindowCenterY();
#endif
// force the mouse to the center, so there's room to move // force the mouse to the center, so there's room to move
IN_ResetMouse(); IN_ResetMouse();
@ -486,10 +445,9 @@ IN_StartupJoystick
void IN_StartupJoystick (void) void IN_StartupJoystick (void)
{ {
int numdevs; int numdevs;
#ifndef USE_SDL
JOYCAPS jc; JOYCAPS jc;
MMRESULT mmr; MMRESULT mmr;
#endif
// assume no joystick // assume no joystick
joy_avail = 0; joy_avail = 0;
@ -497,41 +455,6 @@ void IN_StartupJoystick (void)
if ( gEngfuncs.CheckParm ("-nojoy", NULL ) ) if ( gEngfuncs.CheckParm ("-nojoy", NULL ) )
return; return;
#ifdef USE_SDL
int nJoysticks = SDL_NumJoysticks();
if( nJoysticks > 0 )
{
for( int i = 0; i < nJoysticks; i++ )
{
if( SDL_IsGameController( i ))
{
s_pJoystick = SDL_GameControllerOpen( i );
if( s_pJoystick )
{
//save the joystick's number of buttons and POV status
joy_numbuttons = SDL_CONTROLLER_BUTTON_MAX;
joy_haspov = 0;
// old button and POV states default to no buttons pressed
joy_oldbuttonstate = joy_oldpovstate = 0;
// mark the joystick as available and advanced initialization not completed
// this is needed as cvars are not available during initialization
gEngfuncs.Con_Printf ("joystick found\n\n", SDL_GameControllerName(s_pJoystick));
joy_avail = 1;
joy_advancedinit = 0;
break;
}
}
}
}
else
{
gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n");
return;
}
#else
// verify joystick driver is present // verify joystick driver is present
if ((numdevs = joyGetNumDevs ()) == 0) if ((numdevs = joyGetNumDevs ()) == 0)
{ {
@ -578,7 +501,6 @@ void IN_StartupJoystick (void)
gEngfuncs.Con_Printf ("joystick found\n\n", mmr); gEngfuncs.Con_Printf ("joystick found\n\n", mmr);
joy_avail = 1; joy_avail = 1;
joy_advancedinit = 0; joy_advancedinit = 0;
#endif
} }
@ -587,27 +509,8 @@ void IN_StartupJoystick (void)
RawValuePointer RawValuePointer
=========== ===========
*/ */
#ifdef USE_SDL
int RawValuePointer (int axis)
#else
PDWORD RawValuePointer (int axis) PDWORD RawValuePointer (int axis)
#endif
{ {
#ifdef USE_SDL
switch (axis)
{
default:
case JOY_AXIS_X:
return SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_LEFTX );
case JOY_AXIS_Y:
return SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_LEFTY );
case JOY_AXIS_Z:
return SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_RIGHTX );
case JOY_AXIS_R:
return SDL_GameControllerGetAxis( s_pJoystick, SDL_CONTROLLER_AXIS_RIGHTY );
}
return 0;
#else
switch (axis) switch (axis)
{ {
case JOY_AXIS_X: case JOY_AXIS_X:
@ -625,7 +528,6 @@ PDWORD RawValuePointer (int axis)
} }
// FIX: need to do some kind of error // FIX: need to do some kind of error
return &ji.dwXpos; return &ji.dwXpos;
#endif
} }
@ -689,7 +591,6 @@ void Joy_AdvancedUpdate_f (void)
dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS;
} }
#ifndef USE_SDL
// compute the axes to collect from DirectInput // compute the axes to collect from DirectInput
joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV;
for (i = 0; i < JOY_MAX_AXES; i++) for (i = 0; i < JOY_MAX_AXES; i++)
@ -699,7 +600,6 @@ void Joy_AdvancedUpdate_f (void)
joy_flags |= dwAxisFlags[i]; joy_flags |= dwAxisFlags[i];
} }
} }
#endif
} }
@ -721,19 +621,7 @@ void IN_Commands (void)
// loop through the joystick buttons // loop through the joystick buttons
// key a joystick event or auxillary event for higher number buttons for each state change // key a joystick event or auxillary event for higher number buttons for each state change
#ifdef USE_SDL
buttonstate = 0;
for( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ )
{
if( SDL_GameControllerGetButton( s_pJoystick, (SDL_GameControllerButton)i ))
buttonstate |= i;
}
for (i = 0; i < JOY_MAX_AXES; i++)
pdwRawValue[i] = RawValuePointer(i);
#else
buttonstate = ji.dwButtons; buttonstate = ji.dwButtons;
#endif
for (i=0 ; i < (int)joy_numbuttons ; i++) for (i=0 ; i < (int)joy_numbuttons ; i++)
{ {
if ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) ) if ( (buttonstate & (1<<i)) && !(joy_oldbuttonstate & (1<<i)) )
@ -756,7 +644,6 @@ void IN_Commands (void)
// this avoids any potential problems related to moving from one // this avoids any potential problems related to moving from one
// direction to another without going through the center position // direction to another without going through the center position
povstate = 0; povstate = 0;
#ifndef USE_SDL
if(ji.dwPOV != JOY_POVCENTERED) if(ji.dwPOV != JOY_POVCENTERED)
{ {
if (ji.dwPOV == JOY_POVFORWARD) if (ji.dwPOV == JOY_POVFORWARD)
@ -768,7 +655,6 @@ void IN_Commands (void)
if (ji.dwPOV == JOY_POVLEFT) if (ji.dwPOV == JOY_POVLEFT)
povstate |= 0x08; povstate |= 0x08;
} }
#endif
// determine which bits have changed and key an auxillary event for each change // determine which bits have changed and key an auxillary event for each change
for (i=0 ; i < 4 ; i++) for (i=0 ; i < 4 ; i++)
{ {
@ -794,7 +680,7 @@ IN_ReadJoystick
*/ */
int IN_ReadJoystick (void) int IN_ReadJoystick (void)
{ {
#ifndef USE_SDL
memset (&ji, 0, sizeof(ji)); memset (&ji, 0, sizeof(ji));
ji.dwSize = sizeof(ji); ji.dwSize = sizeof(ji);
ji.dwFlags = joy_flags; ji.dwFlags = joy_flags;
@ -819,10 +705,6 @@ int IN_ReadJoystick (void)
// joy_avail = 0; // joy_avail = 0;
return 0; return 0;
} }
#else
SDL_JoystickUpdate();
return 1;
#endif
} }
@ -872,13 +754,10 @@ void IN_JoyMove ( float frametime, usercmd_t *cmd )
for (i = 0; i < JOY_MAX_AXES; i++) for (i = 0; i < JOY_MAX_AXES; i++)
{ {
// get the floating point zero-centered, potentially-inverted data for the current axis // get the floating point zero-centered, potentially-inverted data for the current axis
#ifdef USE_SDL
fAxisValue = (float)pdwRawValue[i];
#else
fAxisValue = (float) *pdwRawValue[i]; fAxisValue = (float) *pdwRawValue[i];
// move centerpoint to zero // move centerpoint to zero
fAxisValue -= 32768.0; fAxisValue -= 32768.0;
#endif
if (joy_wwhack2->value != 0.0) if (joy_wwhack2->value != 0.0)
{ {
if (dwAxisMap[i] == AxisTurn) if (dwAxisMap[i] == AxisTurn)

View file

@ -1,130 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# a1batross, mittorn, 2018
from waflib import Utils
import os
def options(opt):
opt.load('vgui')
def configure(conf):
conf.env.INCLUDES_SDL = ['../external/SDL2']
conf.env.LIBPATH_SDL = ['../linux']
conf.env.LIB_SDL = ['SDL2']
conf.load('vgui')
if not conf.check_vgui():
conf.fatal('VGUI was enabled but VGUI cannot be used')
def build(bld):
libs = ['VGUI', 'SDL']
defines = ['CLIENT_DLL']
includes = ['.',
'../dlls',
'../common',
'../engine',
'../pm_shared',
'../game_shared',
'../public',
'../external/SDL2']
source = [
'./ev_thewastes.cpp',
'./thewastes/hl_baseentity.cpp',
'./thewastes/hl_events.cpp',
'./thewastes/hl_objects.cpp',
'./thewastes/hl_weapons.cpp',
'../common/interface.cpp',
'../dlls/thewastes.cpp',
'../dlls/wpn_shared/tw_akimbos.cpp',
'../dlls/wpn_shared/tw_automatics.cpp',
'../dlls/wpn_shared/tw_explosives.cpp',
'../dlls/wpn_shared/tw_melee.cpp',
'../dlls/wpn_shared/tw_shotguns.cpp',
'../dlls/wpn_shared/tw_sidearms.cpp',
'../game_shared/vgui_scrollbar2.cpp',
'../game_shared/vgui_slider2.cpp',
'../game_shared/voice_banmgr.cpp',
'../game_shared/voice_status.cpp',
'../game_shared/voice_vgui_tweakdlg.cpp',
'./ammo.cpp',
'./ammo_secondary.cpp',
'./ammohistory.cpp',
'./cdll_int.cpp',
'./com_weapons.cpp',
'./death.cpp',
'./demo.cpp',
'./entity.cpp',
'./env_fog.cpp',
'./ev_common.cpp',
'./events.cpp',
'./flashlight.cpp',
'./GameStudioModelRenderer.cpp',
'./geiger.cpp',
'./health.cpp',
'./hud.cpp',
'./hud_msg.cpp',
'./hud_redraw.cpp',
'./hud_servers.cpp',
'./hud_spectator.cpp',
'./hud_update.cpp',
'./in_camera.cpp',
'./input.cpp',
'./inputw32.cpp',
'./menu.cpp',
'./message.cpp',
'./parsebsp.cpp',
'./ParseBspEnt.cpp',
'./parsemsg.cpp',
'./ParticleBase.cpp',
'../pm_shared/pm_debug.c',
'../pm_shared/pm_math.c',
'../pm_shared/pm_shared.c',
'./saytext.cpp',
'./status_icons.cpp',
'./statusbar.cpp',
'./studio_util.cpp',
'./studioevent.cpp',
'./StudioModelRenderer.cpp',
'./text_message.cpp',
'./thewastes_hud.cpp',
'./train.cpp',
'./tri.cpp',
'./twm.cpp',
'./util.cpp',
'../game_shared/vgui_checkbutton2.cpp',
'./vgui_ConsolePanel.cpp',
'./vgui_ControlConfigPanel.cpp',
'./vgui_CustomObjects.cpp',
'../game_shared/vgui_grid.cpp',
'../game_shared/vgui_helpers.cpp',
'./vgui_int.cpp',
'./vgui_ItemSelection.cpp',
'../game_shared/vgui_listbox.cpp',
'../game_shared/vgui_loadtga.cpp',
'./vgui_MOTDWindow.cpp',
'./vgui_SchemeManager.cpp',
'./vgui_ScorePanel.cpp',
'./vgui_ServerBrowser.cpp',
'./vgui_teammenu.cpp',
'./vgui_TheWastesViewport.cpp',
'./view.cpp',
]
if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_INSTALL_DIR)
else:
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = 'client' + bld.env.POSTFIX,
name = 'client',
features = 'c cxx',
includes = includes,
defines = defines,
use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

View file

@ -77,7 +77,7 @@ typedef union DLONG {
extern DLONG dlong; extern DLONG dlong;
#ifdef _WIN32 #if defined(_WIN32) && !defined(__MINGW32__)
void __inline set_fpu_cw(void) void __inline set_fpu_cw(void)
{ {
_asm _asm

View file

@ -1,108 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# a1batross, mittorn, 2018
from waflib import Utils
import os
def options(opt):
return
def configure(conf):
if conf.env.COMPILER_CC == 'msvc':
# hl.def removes MSVC function name decoration from GiveFnptrsToDll on Windows.
# Without this, the lookup for this function fails.
hlDefNode = conf.path.find_resource("./thewastes.def")
if hlDefNode is not None:
conf.env.append_value('LINKFLAGS', '/def:%s' % hlDefNode.abspath())
else:
conf.fatal("Could not find hl.def")
def build(bld):
source = [
'./animating.cpp',
'./animation.cpp',
'./bmodels.cpp',
'./buttons.cpp',
'./cbase.cpp',
'./client.cpp',
'./combat.cpp',
'./doors.cpp',
'./effects.cpp',
'./explode.cpp',
'./func_break.cpp',
'./func_tank.cpp',
'./game.cpp',
'./game_deathmatch.cpp',
'./game_lastmanstanding.cpp',
'./game_singleplay.cpp',
'./game_teamplay.cpp',
'./gamerules.cpp',
'./ggrenade.cpp',
'./globals.cpp',
'./h_ai.cpp',
'./h_cycler.cpp',
'./h_export.cpp',
'./items.cpp',
'./lights.cpp',
'./maprules.cpp',
'./monsters.cpp',
'./mortar.cpp',
'./nodes.cpp',
'./observer.cpp',
'./pathcorner.cpp',
'./plane.cpp',
'./plats.cpp',
'./player.cpp',
'../pm_shared/pm_debug.c',
'../pm_shared/pm_math.c',
'../pm_shared/pm_shared.c',
'./schedule.cpp',
'./scripted.cpp',
'./skill.cpp',
'./sound.cpp',
'./soundent.cpp',
'./spectator.cpp',
'./subs.cpp',
'./thewastes.cpp',
'./triggers.cpp',
'./turret.cpp',
'./wpn_shared/tw_akimbos.cpp',
'./wpn_shared/tw_automatics.cpp',
'./wpn_shared/tw_explosives.cpp',
'./wpn_shared/tw_melee.cpp',
'./wpn_shared/tw_shotguns.cpp',
'./wpn_shared/tw_sidearms.cpp',
'./util.cpp',
'../game_shared/voice_gamemgr.cpp',
'./weapons.cpp',
'./world.cpp',
]
defines = []
includes = [
'.',
'../common',
'../engine',
'../pm_shared',
'../game_shared',
'../public'
]
if bld.env.DEST_OS not in ['android', 'dos']:
install_path = os.path.join(bld.env.GAMEDIR, bld.env.SERVER_INSTALL_DIR)
else:
install_path = bld.env.PREFIX
bld.shlib(
source = source,
target = bld.env.SERVER_LIBRARY_NAME + bld.env.SERVER_POSTFIX,
name = 'server',
features = 'c cxx',
includes = includes,
defines = defines,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

648
linux/Makefile Normal file
View file

@ -0,0 +1,648 @@
# The Wastes Makefile for Linux
#
# Sep '23 by eukara <marco@vera-visions.com>
#
all:
$(MAKE) client.so
$(MAKE) thewastes.so
# Fix platform differences
PLAT_CFLAGS=\
-Dstricmp=strcasecmp \
-Dstrnicmp=strncasecmp \
-D_snprintf=snprintf \
-D_vsnprintf=vsnprintf
SHARED_CFLAGS=\
-m32 \
-std=c++98 \
-fvisibility=hidden \
-Os -s \
-fPIC \
-D_LINUX=1 \
-DLINUX=1
#############################################################################
# CLIENT GAME
#############################################################################
CLDLL_CFLAGS=\
$(SHARED_CFLAGS) \
$(PLAT_CFLAGS) \
-I../dlls \
-I../common \
-I../engine \
-I../pm_shared \
-I../game_shared \
-I../external/SDL2 \
-I../utils/vgui/include \
-DSERVER_USES_OLD_I386_POSTFIX=1 \
-DCLIENT_WEAPONS=1 \
-DCLIENT_DLL \
-DUSE_SDL
CLDLL_LDFLAGS=\
-m32 \
-shared \
-L../linux \
-L../utils/vgui/lib \
-l:vgui.so \
-lSDL2 \
-ldl
DO_CLDLL_CC=$(CC) $(CFLAGS) $(CLDLL_CFLAGS) -o $@ -c $<
DO_CLDLL_CXX=$(CXX) $(CFLAGS) $(CLDLL_CFLAGS) -o $@ -c $<
CL_SRCDIR=../cl_dll
CL_OBJDIR=./cl_obj
CLDLL_OBJS = \
$(CL_OBJDIR)/ev_thewastes.o \
$(CL_OBJDIR)/hl_baseentity.o \
$(CL_OBJDIR)/hl_events.o \
$(CL_OBJDIR)/hl_objects.o \
$(CL_OBJDIR)/hl_weapons.o \
$(CL_OBJDIR)/interface.o \
$(CL_OBJDIR)/thewastes.o \
$(CL_OBJDIR)/tw_akimbos.o \
$(CL_OBJDIR)/tw_automatics.o \
$(CL_OBJDIR)/tw_explosives.o \
$(CL_OBJDIR)/tw_melee.o \
$(CL_OBJDIR)/tw_shotguns.o \
$(CL_OBJDIR)/tw_sidearms.o \
$(CL_OBJDIR)/vgui_scrollbar2.o \
$(CL_OBJDIR)/vgui_slider2.o \
$(CL_OBJDIR)/voice_banmgr.o \
$(CL_OBJDIR)/voice_status.o \
$(CL_OBJDIR)/voice_vgui_tweakdlg.o \
$(CL_OBJDIR)/ammo.o \
$(CL_OBJDIR)/ammo_secondary.o \
$(CL_OBJDIR)/ammohistory.o \
$(CL_OBJDIR)/cdll_int.o \
$(CL_OBJDIR)/com_weapons.o \
$(CL_OBJDIR)/death.o \
$(CL_OBJDIR)/demo.o \
$(CL_OBJDIR)/entity.o \
$(CL_OBJDIR)/env_fog.o \
$(CL_OBJDIR)/ev_common.o \
$(CL_OBJDIR)/events.o \
$(CL_OBJDIR)/flashlight.o \
$(CL_OBJDIR)/GameStudioModelRenderer.o \
$(CL_OBJDIR)/geiger.o \
$(CL_OBJDIR)/health.o \
$(CL_OBJDIR)/hud.o \
$(CL_OBJDIR)/hud_msg.o \
$(CL_OBJDIR)/hud_redraw.o \
$(CL_OBJDIR)/hud_servers.o \
$(CL_OBJDIR)/hud_spectator.o \
$(CL_OBJDIR)/hud_update.o \
$(CL_OBJDIR)/in_camera.o \
$(CL_OBJDIR)/input.o \
$(CL_OBJDIR)/input_sdl.o \
$(CL_OBJDIR)/menu.o \
$(CL_OBJDIR)/message.o \
$(CL_OBJDIR)/parsebsp.o \
$(CL_OBJDIR)/ParseBspEnt.o \
$(CL_OBJDIR)/parsemsg.o \
$(CL_OBJDIR)/ParticleBase.o \
$(CL_OBJDIR)/pm_debug.o \
$(CL_OBJDIR)/pm_math.o \
$(CL_OBJDIR)/pm_shared.o \
$(CL_OBJDIR)/saytext.o \
$(CL_OBJDIR)/status_icons.o \
$(CL_OBJDIR)/statusbar.o \
$(CL_OBJDIR)/studio_util.o \
$(CL_OBJDIR)/studioevent.o \
$(CL_OBJDIR)/StudioModelRenderer.o \
$(CL_OBJDIR)/text_message.o \
$(CL_OBJDIR)/thewastes_hud.o \
$(CL_OBJDIR)/train.o \
$(CL_OBJDIR)/tri.o \
$(CL_OBJDIR)/twm.o \
$(CL_OBJDIR)/util.o \
$(CL_OBJDIR)/vgui_checkbutton2.o \
$(CL_OBJDIR)/vgui_ConsolePanel.o \
$(CL_OBJDIR)/vgui_ControlConfigPanel.o \
$(CL_OBJDIR)/vgui_CustomObjects.o \
$(CL_OBJDIR)/vgui_grid.o \
$(CL_OBJDIR)/vgui_helpers.o \
$(CL_OBJDIR)/vgui_int.o \
$(CL_OBJDIR)/vgui_ItemSelection.o \
$(CL_OBJDIR)/vgui_listbox.o \
$(CL_OBJDIR)/vgui_loadtga.o \
$(CL_OBJDIR)/vgui_MOTDWindow.o \
$(CL_OBJDIR)/vgui_SchemeManager.o \
$(CL_OBJDIR)/vgui_ScorePanel.o \
$(CL_OBJDIR)/vgui_ServerBrowser.o \
$(CL_OBJDIR)/vgui_teammenu.o \
$(CL_OBJDIR)/vgui_TheWastesViewport.o \
$(CL_OBJDIR)/view.o
client.so :
@-mkdir -p $(CL_OBJDIR)
$(MAKE) $(CLDLL_OBJS)
$(CXX) $(CFLAGS) $(CLDLL_LDFLAGS) -o $@ $(CLDLL_OBJS)
$(CL_OBJDIR)/ev_thewastes.o : $(CL_SRCDIR)/ev_thewastes.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_baseentity.o : $(CL_SRCDIR)/thewastes/hl_baseentity.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_events.o : $(CL_SRCDIR)/thewastes/hl_events.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_objects.o : $(CL_SRCDIR)/thewastes/hl_objects.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_weapons.o : $(CL_SRCDIR)/thewastes/hl_weapons.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/interface.o : $(CL_SRCDIR)/../common/interface.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/thewastes.o : $(CL_SRCDIR)/../dlls/thewastes.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_akimbos.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_akimbos.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_automatics.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_automatics.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_explosives.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_explosives.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_melee.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_melee.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_shotguns.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_shotguns.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_sidearms.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_sidearms.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_scrollbar2.o : $(CL_SRCDIR)/../game_shared/vgui_scrollbar2.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_slider2.o : $(CL_SRCDIR)/../game_shared/vgui_slider2.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/voice_banmgr.o : $(CL_SRCDIR)/../game_shared/voice_banmgr.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/voice_status.o : $(CL_SRCDIR)/../game_shared/voice_status.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/voice_vgui_tweakdlg.o : $(CL_SRCDIR)/../game_shared/voice_vgui_tweakdlg.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ammo.o : $(CL_SRCDIR)/ammo.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ammo_secondary.o : $(CL_SRCDIR)/ammo_secondary.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ammohistory.o : $(CL_SRCDIR)/ammohistory.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/cdll_int.o : $(CL_SRCDIR)/cdll_int.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/com_weapons.o : $(CL_SRCDIR)/com_weapons.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/death.o : $(CL_SRCDIR)/death.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/demo.o : $(CL_SRCDIR)/demo.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/entity.o : $(CL_SRCDIR)/entity.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/env_fog.o : $(CL_SRCDIR)/env_fog.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ev_common.o : $(CL_SRCDIR)/ev_common.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/events.o : $(CL_SRCDIR)/events.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/flashlight.o : $(CL_SRCDIR)/flashlight.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/GameStudioModelRenderer.o : $(CL_SRCDIR)/GameStudioModelRenderer.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/geiger.o : $(CL_SRCDIR)/geiger.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/health.o : $(CL_SRCDIR)/health.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud.o : $(CL_SRCDIR)/hud.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_msg.o : $(CL_SRCDIR)/hud_msg.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_redraw.o : $(CL_SRCDIR)/hud_redraw.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_servers.o : $(CL_SRCDIR)/hud_servers.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_spectator.o : $(CL_SRCDIR)/hud_spectator.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_update.o : $(CL_SRCDIR)/hud_update.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/in_camera.o : $(CL_SRCDIR)/in_camera.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/input.o : $(CL_SRCDIR)/input.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/input_sdl.o : $(CL_SRCDIR)/input_sdl.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/menu.o : $(CL_SRCDIR)/menu.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/message.o : $(CL_SRCDIR)/message.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/parsebsp.o : $(CL_SRCDIR)/parsebsp.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ParseBspEnt.o : $(CL_SRCDIR)/ParseBspEnt.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/parsemsg.o : $(CL_SRCDIR)/parsemsg.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ParticleBase.o : $(CL_SRCDIR)/ParticleBase.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/pm_debug.o : $(CL_SRCDIR)/../pm_shared/pm_debug.c
$(DO_CLDLL_CC)
$(CL_OBJDIR)/pm_math.o : $(CL_SRCDIR)/../pm_shared/pm_math.c
$(DO_CLDLL_CC)
$(CL_OBJDIR)/pm_shared.o : $(CL_SRCDIR)/../pm_shared/pm_shared.c
$(DO_CLDLL_CC)
$(CL_OBJDIR)/saytext.o : $(CL_SRCDIR)/saytext.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/status_icons.o : $(CL_SRCDIR)/status_icons.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/statusbar.o : $(CL_SRCDIR)/statusbar.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/studio_util.o : $(CL_SRCDIR)/studio_util.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/studioevent.o : $(CL_SRCDIR)/studioevent.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/StudioModelRenderer.o : $(CL_SRCDIR)/StudioModelRenderer.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/text_message.o : $(CL_SRCDIR)/text_message.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/thewastes_hud.o : $(CL_SRCDIR)/thewastes_hud.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/train.o : $(CL_SRCDIR)/train.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tri.o : $(CL_SRCDIR)/tri.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/twm.o : $(CL_SRCDIR)/twm.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/util.o : $(CL_SRCDIR)/util.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_checkbutton2.o : $(CL_SRCDIR)/../game_shared/vgui_checkbutton2.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ConsolePanel.o : $(CL_SRCDIR)/vgui_ConsolePanel.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ControlConfigPanel.o : $(CL_SRCDIR)/vgui_ControlConfigPanel.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_CustomObjects.o : $(CL_SRCDIR)/vgui_CustomObjects.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_grid.o : $(CL_SRCDIR)/../game_shared/vgui_grid.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_helpers.o : $(CL_SRCDIR)/../game_shared/vgui_helpers.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_int.o : $(CL_SRCDIR)/vgui_int.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ItemSelection.o : $(CL_SRCDIR)/vgui_ItemSelection.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_listbox.o : $(CL_SRCDIR)/../game_shared/vgui_listbox.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_loadtga.o : $(CL_SRCDIR)/../game_shared/vgui_loadtga.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_MOTDWindow.o : $(CL_SRCDIR)/vgui_MOTDWindow.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_SchemeManager.o : $(CL_SRCDIR)/vgui_SchemeManager.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ScorePanel.o : $(CL_SRCDIR)/vgui_ScorePanel.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ServerBrowser.o : $(CL_SRCDIR)/vgui_ServerBrowser.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_teammenu.o : $(CL_SRCDIR)/vgui_teammenu.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_TheWastesViewport.o : $(CL_SRCDIR)/vgui_TheWastesViewport.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/view.o : $(CL_SRCDIR)/view.cpp
$(DO_CLDLL_CXX)
#############################################################################
# SERVER GAME
#############################################################################
SVDLL_CFLAGS=\
$(SHARED_CFLAGS) \
$(PLAT_CFLAGS) \
-I../common \
-I../dlls \
-I../engine \
-I../pm_shared \
-I../game_shared
SVDLL_LDFLAGS=\
-m32 \
-shared
DO_SVDLL_CC=$(CC) $(CFLAGS) $(SVDLL_CFLAGS) -o $@ -c $<
DO_SVDLL_CXX=$(CXX) $(CFLAGS) $(SVDLL_CFLAGS) -o $@ -c $<
SV_SRCDIR=../dlls
SV_OBJDIR=./sv_obj
SVDLL_OBJS = \
$(SV_OBJDIR)/animating.o \
$(SV_OBJDIR)/animation.o \
$(SV_OBJDIR)/bmodels.o \
$(SV_OBJDIR)/buttons.o \
$(SV_OBJDIR)/cbase.o \
$(SV_OBJDIR)/client.o \
$(SV_OBJDIR)/combat.o \
$(SV_OBJDIR)/doors.o \
$(SV_OBJDIR)/effects.o \
$(SV_OBJDIR)/explode.o \
$(SV_OBJDIR)/func_break.o \
$(SV_OBJDIR)/func_tank.o \
$(SV_OBJDIR)/game.o \
$(SV_OBJDIR)/game_deathmatch.o \
$(SV_OBJDIR)/game_lastmanstanding.o \
$(SV_OBJDIR)/game_singleplay.o \
$(SV_OBJDIR)/game_teamplay.o \
$(SV_OBJDIR)/gamerules.o \
$(SV_OBJDIR)/ggrenade.o \
$(SV_OBJDIR)/globals.o \
$(SV_OBJDIR)/h_ai.o \
$(SV_OBJDIR)/h_cycler.o \
$(SV_OBJDIR)/h_export.o \
$(SV_OBJDIR)/items.o \
$(SV_OBJDIR)/lights.o \
$(SV_OBJDIR)/maprules.o \
$(SV_OBJDIR)/monsters.o \
$(SV_OBJDIR)/mortar.o \
$(SV_OBJDIR)/nodes.o \
$(SV_OBJDIR)/observer.o \
$(SV_OBJDIR)/pathcorner.o \
$(SV_OBJDIR)/plane.o \
$(SV_OBJDIR)/plats.o \
$(SV_OBJDIR)/player.o \
$(SV_OBJDIR)/pm_debug.o \
$(SV_OBJDIR)/pm_math.o \
$(SV_OBJDIR)/pm_shared.o \
$(SV_OBJDIR)/schedule.o \
$(SV_OBJDIR)/scripted.o \
$(SV_OBJDIR)/skill.o \
$(SV_OBJDIR)/sound.o \
$(SV_OBJDIR)/soundent.o \
$(SV_OBJDIR)/spectator.o \
$(SV_OBJDIR)/subs.o \
$(SV_OBJDIR)/thewastes.o \
$(SV_OBJDIR)/triggers.o \
$(SV_OBJDIR)/turret.o \
$(SV_OBJDIR)/tw_akimbos.o \
$(SV_OBJDIR)/tw_automatics.o \
$(SV_OBJDIR)/tw_explosives.o \
$(SV_OBJDIR)/tw_melee.o \
$(SV_OBJDIR)/tw_shotguns.o \
$(SV_OBJDIR)/tw_sidearms.o \
$(SV_OBJDIR)/util.o \
$(SV_OBJDIR)/voice_gamemgr.o \
$(SV_OBJDIR)/weapons.o \
$(SV_OBJDIR)/world.o
thewastes.so :
@-mkdir -p $(SV_OBJDIR)
$(MAKE) $(SVDLL_OBJS)
$(CXX) $(CFLAGS) $(SVDLL_LDFLAGS) -o $@ $(SVDLL_OBJS)
$(SV_OBJDIR)/animating.o : $(SV_SRCDIR)/animating.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/animation.o : $(SV_SRCDIR)/animation.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/bmodels.o : $(SV_SRCDIR)/bmodels.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/buttons.o : $(SV_SRCDIR)/buttons.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/cbase.o : $(SV_SRCDIR)/cbase.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/client.o : $(SV_SRCDIR)/client.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/combat.o : $(SV_SRCDIR)/combat.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/doors.o : $(SV_SRCDIR)/doors.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/effects.o : $(SV_SRCDIR)/effects.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/explode.o : $(SV_SRCDIR)/explode.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/func_break.o : $(SV_SRCDIR)/func_break.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/func_tank.o : $(SV_SRCDIR)/func_tank.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game.o : $(SV_SRCDIR)/game.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_deathmatch.o : $(SV_SRCDIR)/game_deathmatch.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_lastmanstanding.o : $(SV_SRCDIR)/game_lastmanstanding.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_singleplay.o : $(SV_SRCDIR)/game_singleplay.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_teamplay.o : $(SV_SRCDIR)/game_teamplay.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/gamerules.o : $(SV_SRCDIR)/gamerules.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/ggrenade.o : $(SV_SRCDIR)/ggrenade.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/globals.o : $(SV_SRCDIR)/globals.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/h_ai.o : $(SV_SRCDIR)/h_ai.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/h_cycler.o : $(SV_SRCDIR)/h_cycler.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/h_export.o : $(SV_SRCDIR)/h_export.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/items.o : $(SV_SRCDIR)/items.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/lights.o : $(SV_SRCDIR)/lights.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/maprules.o : $(SV_SRCDIR)/maprules.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/monsters.o : $(SV_SRCDIR)/monsters.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/mortar.o : $(SV_SRCDIR)/mortar.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/nodes.o : $(SV_SRCDIR)/nodes.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/observer.o : $(SV_SRCDIR)/observer.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/pathcorner.o : $(SV_SRCDIR)/pathcorner.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/plane.o : $(SV_SRCDIR)/plane.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/plats.o : $(SV_SRCDIR)/plats.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/player.o : $(SV_SRCDIR)/player.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/pm_debug.o : $(SV_SRCDIR)/../pm_shared/pm_debug.c
$(DO_SVDLL_CC)
$(SV_OBJDIR)/pm_math.o : $(SV_SRCDIR)/../pm_shared/pm_math.c
$(DO_SVDLL_CC)
$(SV_OBJDIR)/pm_shared.o : $(SV_SRCDIR)/../pm_shared/pm_shared.c
$(DO_SVDLL_CC)
$(SV_OBJDIR)/schedule.o : $(SV_SRCDIR)/schedule.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/scripted.o : $(SV_SRCDIR)/scripted.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/skill.o : $(SV_SRCDIR)/skill.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/sound.o : $(SV_SRCDIR)/sound.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/soundent.o : $(SV_SRCDIR)/soundent.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/spectator.o : $(SV_SRCDIR)/spectator.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/subs.o : $(SV_SRCDIR)/subs.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/thewastes.o : $(SV_SRCDIR)/thewastes.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/triggers.o : $(SV_SRCDIR)/triggers.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/turret.o : $(SV_SRCDIR)/turret.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_akimbos.o : $(SV_SRCDIR)/wpn_shared/tw_akimbos.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_automatics.o : $(SV_SRCDIR)/wpn_shared/tw_automatics.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_explosives.o : $(SV_SRCDIR)/wpn_shared/tw_explosives.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_melee.o : $(SV_SRCDIR)/wpn_shared/tw_melee.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_shotguns.o : $(SV_SRCDIR)/wpn_shared/tw_shotguns.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_sidearms.o : $(SV_SRCDIR)/wpn_shared/tw_sidearms.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/util.o : $(SV_SRCDIR)/util.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/voice_gamemgr.o : $(SV_SRCDIR)/../game_shared/voice_gamemgr.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/weapons.o : $(SV_SRCDIR)/weapons.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/world.o : $(SV_SRCDIR)/world.cpp
$(DO_SVDLL_CXX)
clean:
rm -v $(SVDLL_OBJS)
rm -v $(CLDLL_OBJS)
rm -v client.so
rm -v thewastes.so

View file

@ -1,7 +0,0 @@
SERVER_USES_OLD_I386_POSTFIX=ON # Add _i386 on linux-i386 builds
CLIENT_WEAPONS=ON # Use client-side weapon prediction
GAMEDIR=thewastes # Gamedir path
SERVER_INSTALL_DIR=dlls # Where put server dll
CLIENT_INSTALL_DIR=cl_dlls # Where put client dll
SERVER_LIBRARY_NAME=thewastes # Library name for PC platforms

View file

@ -27,9 +27,11 @@
#pragma warning(disable : 4244) #pragma warning(disable : 4244)
#ifndef CLIENT_DLL // HACK: MSVC still needs this?
#if !defined(CLIENT_DLL) || defined(_WIN32)
vec3_t vec3_origin = {0,0,0}; vec3_t vec3_origin = {0,0,0};
#endif #endif
int nanmask = 255<<23; int nanmask = 255<<23;
float anglemod(float a) float anglemod(float a)

View file

@ -1,261 +0,0 @@
/*
build.h - compile-time build information
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
#pragma once
#ifndef BUILD_H
#define BUILD_H
/*
All XASH_* macros set by this header are guaranteed to have positive value
otherwise not defined.
Every macro is intended to be the unified interface for buildsystems that lack
platform & CPU detection, and a neat quick way for checks in platform code
For Q_build* macros, refer to buildenums.h
Any new define must be undefined at first
You can generate #undef list below with this oneliner:
$ sed 's/\t//g' build.h | grep '^#define XASH' | awk '{ print $2 }' | \
sort | uniq | awk '{ print "#undef " $1 }'
Then you can use another oneliner to query all variables:
$ grep '^#undef XASH' build.h | awk '{ print $2 }'
*/
#undef XASH_64BIT
#undef XASH_AMD64
#undef XASH_ANDROID
#undef XASH_APPLE
#undef XASH_ARM
#undef XASH_ARM_HARDFP
#undef XASH_ARM_SOFTFP
#undef XASH_ARMv4
#undef XASH_ARMv5
#undef XASH_ARMv6
#undef XASH_ARMv7
#undef XASH_ARMv8
#undef XASH_BIG_ENDIAN
#undef XASH_DOS4GW
#undef XASH_E2K
#undef XASH_EMSCRIPTEN
#undef XASH_FREEBSD
#undef XASH_HAIKU
#undef XASH_IOS
#undef XASH_IRIX
#undef XASH_JS
#undef XASH_LINUX
#undef XASH_LINUX_UNKNOWN
#undef XASH_LITTLE_ENDIAN
#undef XASH_MIPS
#undef XASH_MOBILE_PLATFORM
#undef XASH_NETBSD
#undef XASH_OPENBSD
#undef XASH_POSIX
#undef XASH_PPC
#undef XASH_RISCV
#undef XASH_RISCV_DOUBLEFP
#undef XASH_RISCV_SINGLEFP
#undef XASH_RISCV_SOFTFP
#undef XASH_SERENITY
#undef XASH_WIN32
#undef XASH_X86
#undef XASH_NSWITCH
#undef XASH_PSVITA
//================================================================
//
// PLATFORM DETECTION CODE
//
//================================================================
#if defined _WIN32
#define XASH_WIN32 1
#elif defined __EMSCRIPTEN__
#define XASH_EMSCRIPTEN 1
#elif defined __WATCOMC__ && defined __DOS__
#define XASH_DOS4GW 1
#else // POSIX compatible
#define XASH_POSIX 1
#if defined __linux__
#if defined __ANDROID__
#define XASH_ANDROID 1
#else
#include <features.h>
// if our system libc has features.h header
// try to detect it to not confuse other libcs with built with glibc game libraries
#if !defined __GLIBC__
#define XASH_LINUX_UNKNOWN 1
#endif
#endif
#define XASH_LINUX 1
#elif defined __FreeBSD__
#define XASH_FREEBSD 1
#elif defined __NetBSD__
#define XASH_NETBSD 1
#elif defined __OpenBSD__
#define XASH_OPENBSD 1
#elif defined __HAIKU__
#define XASH_HAIKU 1
#elif defined __serenity__
#define XASH_SERENITY 1
#elif defined __sgi
#define XASH_IRIX 1
#elif defined __APPLE__
#include <TargetConditionals.h>
#define XASH_APPLE 1
#if TARGET_OS_IOS
#define XASH_IOS 1
#endif // TARGET_OS_IOS
#elif defined __SWITCH__
#define XASH_NSWITCH 1
#elif defined __vita__
#define XASH_PSVITA 1
#else
#error
#endif
#endif
// XASH_SAILFISH is special: SailfishOS by itself is a normal GNU/Linux platform
// It doesn't make sense to split it to separate platform
// but we still need XASH_MOBILE_PLATFORM for the engine.
// So this macro is defined entirely in build-system: see main wscript
// HLSDK/PrimeXT/other SDKs users note: you may ignore this macro
#if XASH_ANDROID || XASH_IOS || XASH_NSWITCH || XASH_PSVITA || XASH_SAILFISH
#define XASH_MOBILE_PLATFORM 1
#endif
//================================================================
//
// ENDIANNESS DEFINES
//
//================================================================
#if !defined XASH_ENDIANNESS
#if defined XASH_WIN32 || __LITTLE_ENDIAN__
//!!! Probably all WinNT installations runs in little endian
#define XASH_LITTLE_ENDIAN 1
#elif __BIG_ENDIAN__
#define XASH_BIG_ENDIAN 1
#elif defined __BYTE_ORDER__ && defined __ORDER_BIG_ENDIAN__ && defined __ORDER_LITTLE_ENDIAN__ // some compilers define this
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define XASH_BIG_ENDIAN 1
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define XASH_LITTLE_ENDIAN 1
#endif
#else
#include <sys/param.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define XASH_BIG_ENDIAN 1
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#define XASH_LITTLE_ENDIAN 1
#endif
#endif // !XASH_WIN32
#endif
//================================================================
//
// CPU ARCHITECTURE DEFINES
//
//================================================================
#if defined __x86_64__ || defined _M_X64
#define XASH_64BIT 1
#define XASH_AMD64 1
#elif defined __i386__ || defined _X86_ || defined _M_IX86
#define XASH_X86 1
#elif defined __aarch64__ || defined _M_ARM64
#define XASH_64BIT 1
#define XASH_ARM 8
#elif defined __mips__
#define XASH_MIPS 1
#elif defined __EMSCRIPTEN__
#define XASH_JS 1
#elif defined __e2k__
#define XASH_64BIT 1
#define XASH_E2K 1
#elif defined __PPC__ || defined __powerpc__
#define XASH_PPC 1
#if defined __PPC64__ || defined __powerpc64__
#define XASH_64BIT 1
#endif
#elif defined _M_ARM // msvc
#define XASH_ARM 7
#define XASH_ARM_HARDFP 1
#elif defined __arm__
#if __ARM_ARCH == 8 || __ARM_ARCH_8__
#define XASH_ARM 8
#elif __ARM_ARCH == 7 || __ARM_ARCH_7__
#define XASH_ARM 7
#elif __ARM_ARCH == 6 || __ARM_ARCH_6__ || __ARM_ARCH_6J__
#define XASH_ARM 6
#elif __ARM_ARCH == 5 || __ARM_ARCH_5__
#define XASH_ARM 5
#elif __ARM_ARCH == 4 || __ARM_ARCH_4__
#define XASH_ARM 4
#else
#error "Unknown ARM"
#endif
#if defined __SOFTFP__ || __ARM_PCS_VFP == 0
#define XASH_ARM_SOFTFP 1
#else // __SOFTFP__
#define XASH_ARM_HARDFP 1
#endif // __SOFTFP__
#elif defined __riscv
#define XASH_RISCV 1
#if __riscv_xlen == 64
#define XASH_64BIT 1
#elif __riscv_xlen != 32
#error "Unknown RISC-V ABI"
#endif
#if defined __riscv_float_abi_soft
#define XASH_RISCV_SOFTFP 1
#elif defined __riscv_float_abi_single
#define XASH_RISCV_SINGLEFP 1
#elif defined __riscv_float_abi_double
#define XASH_RISCV_DOUBLEFP 1
#else
#error "Unknown RISC-V float ABI"
#endif
#else
#error "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug"
#endif
#if XASH_ARM == 8
#define XASH_ARMv8 1
#elif XASH_ARM == 7
#define XASH_ARMv7 1
#elif XASH_ARM == 6
#define XASH_ARMv6 1
#elif XASH_ARM == 5
#define XASH_ARMv5 1
#elif XASH_ARM == 4
#define XASH_ARMv4 1
#endif
#endif // BUILD_H

View file

@ -1,180 +0,0 @@
# encoding: utf-8
# compiler_optimizations.py -- main entry point for configuring C/C++ compilers
# Copyright (C) 2021 a1batross
# 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.
try: from fwgslib import get_flags_by_type, get_flags_by_compiler
except: from waflib.extras.fwgslib import get_flags_by_type, get_flags_by_compiler
from waflib.Configure import conf
from waflib import Logs
'''
Flags can be overriden and new types can be added
by importing this as normal Python module
Example:
#!/usr/bin/env python
from waflib.extras import compiler_optimizations
compiler_optimizations.VALID_BUILD_TYPES += 'gottagofast'
compiler_optimizations.CFLAGS['gottagofast'] = {
'gcc': ['-Ogentoo']
}
'''
VALID_BUILD_TYPES = ['fastnative', 'fast', 'release', 'debug', 'sanitize', 'msan', 'none']
LINKFLAGS = {
'common': {
'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries
'gcc': ['-Wl,--no-undefined'],
'owcc': ['-Wl,option stack=512k']
},
'msan': {
'clang': ['-fsanitize=memory', '-pthread'],
'default': ['NO_MSAN_HERE']
},
'sanitize': {
'clang': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'gcc': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'msvc': ['/SAFESEH:NO']
},
'debug': {
'msvc': ['/INCREMENTAL', '/SAFESEH:NO']
}
}
CFLAGS = {
'common': {
# disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP
'msvc': ['/D_USING_V110_SDK71_', '/FS', '/Zc:threadSafeInit-', '/MT', '/MP', '/Zc:__cplusplus'],
'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden', '-fno-threadsafe-statics'],
'gcc': ['-g', '-fvisibility=hidden'],
'owcc': ['-fno-short-enum', '-ffloat-store', '-g3']
},
'fast': {
'msvc': ['/O2', '/Oy', '/Zi'],
'gcc': {
'3': ['-O3', '-fomit-frame-pointer'],
'default': ['-Ofast', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer']
},
'clang': ['-Ofast'],
'default': ['-O3']
},
'fastnative': {
'msvc': ['/O2', '/Oy', '/Zi'],
'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'],
'clang': ['-Ofast', '-march=native'],
'default': ['-O3']
},
'release': {
'msvc': ['/O2', '/Zi'],
'owcc': ['-O3', '-foptimize-sibling-calls', '-fomit-leaf-frame-pointer', '-fomit-frame-pointer', '-fschedule-insns', '-funsafe-math-optimizations', '-funroll-loops', '-frerun-optimizer', '-finline-functions', '-finline-limit=512', '-fguess-branch-probability', '-fno-strict-aliasing', '-floop-optimize'],
'default': ['-O3']
},
'debug': {
'msvc': ['/Od', '/ZI'],
'owcc': ['-O0', '-fno-omit-frame-pointer', '-funwind-tables', '-fno-omit-leaf-frame-pointer'],
'default': ['-O0']
},
'msan': {
'clang': ['-O2', '-g', '-fno-omit-frame-pointer', '-fsanitize=memory', '-pthread'],
'default': ['NO_MSAN_HERE']
},
'sanitize': {
'msvc': ['/Od', '/RTC1', '/Zi', '/fsanitize=address'],
'gcc': ['-O0', '-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'clang': ['-O0', '-fsanitize=undefined', '-fsanitize=address', '-pthread'],
'default': ['-O0']
},
}
LTO_CFLAGS = {
'msvc': ['/GL'],
'gcc': ['-flto'],
'clang': ['-flto']
}
LTO_LINKFLAGS = {
'msvc': ['/LTCG'],
'gcc': ['-flto'],
'clang': ['-flto']
}
POLLY_CFLAGS = {
'gcc': ['-fgraphite-identity'],
'clang': ['-mllvm', '-polly']
# msvc sosat :(
}
def options(opt):
grp = opt.add_option_group('Compiler optimization options')
grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default='release',
help = 'build type: debug, release or none(custom flags)')
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
help = 'enable Link Time Optimization if possible [default: %default]')
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
help = 'enable polyhedral optimization if possible [default: %default]')
def configure(conf):
conf.start_msg('Build type')
if not conf.options.BUILD_TYPE in VALID_BUILD_TYPES:
conf.end_msg(conf.options.BUILD_TYPE, color='RED')
conf.fatal('Invalid build type. Valid are: %s' % ', '.join(VALID_BUILD_TYPES))
conf.end_msg(conf.options.BUILD_TYPE)
conf.msg('LTO build', 'yes' if conf.options.LTO else 'no')
conf.msg('PolyOpt build', 'yes' if conf.options.POLLY else 'no')
# -march=native should not be used
if conf.options.BUILD_TYPE.startswith('fast'):
Logs.warn('WARNING: \'%s\' build type should not be used in release builds', conf.options.BUILD_TYPE)
try:
conf.env.CC_VERSION[0]
except IndexError:
conf.env.CC_VERSION = (0,)
@conf
def get_optimization_flags(conf):
'''Returns a list of compile flags,
depending on build type and options set by user
NOTE: it doesn't filter out unsupported flags
:returns: tuple of cflags and linkflags
'''
linkflags = conf.get_flags_by_type(LINKFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
cflags = conf.get_flags_by_type(CFLAGS, conf.options.BUILD_TYPE, conf.env.COMPILER_CC, conf.env.CC_VERSION[0])
if conf.options.LTO:
linkflags+= conf.get_flags_by_compiler(LTO_LINKFLAGS, conf.env.COMPILER_CC)
cflags += conf.get_flags_by_compiler(LTO_CFLAGS, conf.env.COMPILER_CC)
if conf.options.POLLY:
cflags += conf.get_flags_by_compiler(POLLY_CFLAGS, conf.env.COMPILER_CC)
if conf.env.DEST_OS == 'nswitch' and conf.options.BUILD_TYPE == 'debug':
# enable remote debugger
cflags.append('-DNSWITCH_DEBUG')
elif conf.env.DEST_OS == 'psvita':
# this optimization is broken in vitasdk
cflags.append('-fno-optimize-sibling-calls')
# remove fvisibility to allow everything to be exported by default
cflags.remove('-fvisibility=hidden')
return cflags, linkflags

View file

@ -1,188 +0,0 @@
#! /usr/bin/env python
# Copyright 2019 (C) a1batross
from waflib import Configure, Errors, Utils
# TODO: make generic
CHECK_SYMBOL_EXISTS_FRAGMENT = '''
#include "build.h"
int main(int argc, char** argv)
{
(void)argv;
#ifndef %s
return ((int*)(&%s))[argc];
#else
(void)argc;
return 0;
#endif
}
'''
# generated(see comments in public/build.h)
# cat build.h | grep '^#undef XASH' | awk '{ print "'\''" $2 "'\''," }'
DEFINES = [
'XASH_64BIT',
'XASH_AMD64',
'XASH_ANDROID',
'XASH_APPLE',
'XASH_ARM',
'XASH_ARM_HARDFP',
'XASH_ARM_SOFTFP',
'XASH_ARMv4',
'XASH_ARMv5',
'XASH_ARMv6',
'XASH_ARMv7',
'XASH_ARMv8',
'XASH_BIG_ENDIAN',
'XASH_DOS4GW',
'XASH_E2K',
'XASH_EMSCRIPTEN',
'XASH_FREEBSD',
'XASH_HAIKU',
'XASH_IOS',
'XASH_IRIX',
'XASH_JS',
'XASH_LINUX',
'XASH_LINUX_UNKNOWN',
'XASH_LITTLE_ENDIAN',
'XASH_MIPS',
'XASH_MOBILE_PLATFORM',
'XASH_NETBSD',
'XASH_OPENBSD',
'XASH_POSIX',
'XASH_PPC',
'XASH_RISCV',
'XASH_RISCV_DOUBLEFP',
'XASH_RISCV_SINGLEFP',
'XASH_RISCV_SOFTFP',
'XASH_SERENITY',
'XASH_WIN32',
'XASH_X86',
'XASH_NSWITCH',
'XASH_PSVITA',
]
def configure(conf):
conf.env.stash()
conf.start_msg('Determining library postfix')
tests = map(lambda x: {
'fragment': CHECK_SYMBOL_EXISTS_FRAGMENT % (x, x),
'includes': [conf.path.find_node('public/').abspath()],
'define_name': x }, DEFINES )
conf.multicheck(*tests, msg = '', mandatory = False, quiet = True)
append_i386 = False
# engine/common/build.c
if conf.env.XASH_ANDROID:
buildos = "android"
elif conf.env.XASH_LINUX_UNKNOWN:
buildos = "linuxunkabi"
elif conf.env.XASH_WIN32 or conf.env.XASH_LINUX or conf.env.XASH_APPLE:
buildos = "" # no prefix for default OS
elif conf.env.XASH_FREEBSD:
buildos = "freebsd"
elif conf.env.XASH_NETBSD:
buildos = "netbsd"
elif conf.env.XASH_OPENBSD:
buildos = "openbsd"
elif conf.env.XASH_EMSCRIPTEN:
buildos = "emscripten"
elif conf.env.XASH_DOS4GW:
buildos = "dos4gw" # unused, just in case
elif conf.env.XASH_HAIKU:
buildos = "haiku"
elif conf.env.XASH_SERENITY:
buildos = "serenityos"
elif conf.env.XASH_NSWITCH:
buildos = "nswitch"
elif conf.env.XASH_PSVITA:
buildos = "psvita"
elif conf.env.XASH_IRIX:
buildos = "irix"
else:
conf.fatal("Place your operating system name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")
if conf.env.XASH_AMD64:
buildarch = "amd64"
elif conf.env.XASH_X86:
if conf.env.SERVER_USES_OLD_I386_POSTFIX and conf.env.XASH_LINUX:
append_i386 = True
if conf.env.XASH_WIN32 or conf.env.XASH_LINUX or conf.env.XASH_APPLE:
buildarch = ""
else:
buildarch = "i386"
elif conf.env.XASH_ARM and conf.env.XASH_64BIT:
buildarch = "arm64"
elif conf.env.XASH_ARM:
buildarch = "armv"
if conf.env.XASH_ARMv8:
buildarch += "8_32"
elif conf.env.XASH_ARMv7:
buildarch += "7"
elif conf.env.XASH_ARMv6:
buildarch += "6"
elif conf.env.XASH_ARMv5:
buildarch += "5"
elif conf.env.XASH_ARMv4:
buildarch += "4"
else:
raise conf.fatal('Unknown ARM')
if conf.env.XASH_ARM_HARDFP:
buildarch += "hf"
else:
buildarch += "l"
elif conf.env.XASH_MIPS:
buildarch = "mips"
if conf.env.XASH_64BIT:
buildarch += "64"
if conf.env.XASH_LITTLE_ENDIAN:
buildarch += "el"
elif conf.env.XASH_RISCV:
buildarch = "riscv"
if conf.env.XASH_64BIT:
buildarch += "64"
else:
buildarch += "32"
if conf.env.XASH_RISCV_DOUBLEFP:
buildarch += "d"
elif conf.env.XASH_RISCV_SINGLEFP:
buildarch += "f"
elif conf.env.XASH_JS:
buildarch = "javascript"
elif conf.env.XASH_E2K:
buildarch = "e2k"
elif conf.env.XASH_PPC:
buildarch = "ppc"
if conf.env.XASH_64BIT:
buildarch += "64"
if conf.env.XASH_LITTLE_ENDIAN:
buildarch += "el"
else:
raise conf.fatal("Place your architecture name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug")
conf.env.revert()
if buildos == 'android':
# force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming
conf.env.POSTFIX = ''
elif buildos != '' and buildarch != '':
conf.env.POSTFIX = '_%s_%s' % (buildos,buildarch)
elif buildarch != '':
conf.env.POSTFIX = '_%s' % buildarch
else:
conf.env.POSTFIX = ''
if append_i386:
conf.env.SERVER_POSTFIX = '_i386'
else:
conf.env.SERVER_POSTFIX = conf.env.POSTFIX
conf.end_msg(conf.env.POSTFIX)

View file

@ -1,49 +0,0 @@
#! /usr/bin/env python
# Modified: Alibek Omarov <a1ba.omarov@gmail.com>
# Originally taken from Thomas Nagy's blogpost
"""
Strip executables upon installation
"""
import shutil, os
from waflib import Build, Utils, Context, Errors, Logs
def options(opt):
grp = opt.option_groups['install/uninstall options']
grp.add_option('--no-strip', dest='no_strip', action='store_true', default=False,
help='don\'t strip binaries. You must pass this flag to install command(default: False)')
def configure(conf):
if conf.env.DEST_BINFMT in ['elf', 'mac-o']:
conf.find_program('strip', var='STRIP')
if not conf.env.STRIPFLAGS:
conf.env.STRIPFLAGS = os.environ['STRIPFLAGS'] if 'STRIPFLAGS' in os.environ else []
def copy_fun(self, src, tgt):
inst_copy_fun(self, src, tgt)
if self.generator.bld.options.no_strip:
return
if self.env.DEST_BINFMT not in ['elf', 'mac-o']: # don't strip unknown formats or PE
return
if getattr(self.generator, 'link_task', None) and self.generator.link_task.outputs[0] in self.inputs:
cmd = self.env.STRIP + self.env.STRIPFLAGS + [tgt]
try:
self.generator.bld.cmd_and_log(cmd, output=Context.BOTH, quiet=Context.BOTH)
if not self.generator.bld.progress_bar:
c1 = Logs.colors.NORMAL
c2 = Logs.colors.CYAN
f1 = os.path.getsize(src)
f2 = os.path.getsize(tgt)
Logs.info('%s+ strip %s%s%s (%d bytes change)', c1, c2, tgt, c1, f2 - f1)
except Errors.WafError as e:
print(e.stdout, e.stderr)
inst_copy_fun = Build.inst.copy_fun
Build.inst.copy_fun = copy_fun

View file

@ -1,79 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# mittorn, 2018
from waflib.Configure import conf
import os
VGUI_SUPPORTED_OS = ['win32', 'darwin', 'linux']
VGUI_FRAGMENT = '''#include <VGUI.h>
int main() { return 0; }'''
def options(opt):
grp = opt.add_option_group('VGUI options')
vgui_dev_path = os.path.join(opt.path.path_from(opt.path), 'utils', 'vgui')
grp.add_option('--vgui', action = 'store', dest = 'VGUI_DEV', default=vgui_dev_path,
help = 'path to vgui-dev repo [default: %default]')
grp.add_option('--skip-vgui-sanity-check', action = 'store_false', dest = 'VGUI_SANITY_CHECK', default=True,
help = 'skip checking VGUI sanity [default: %default]' )
return
@conf
def check_vgui(conf):
conf.start_msg('Does this architecture support VGUI?')
if conf.env.DEST_CPU != 'x86' and not (conf.env.DEST_CPU == 'x86_64' and not conf.options.ALLOW64):
conf.end_msg('no')
Logs.warn('vgui is not supported on this CPU: ' + str(conf.env.DEST_CPU))
return False
else: conf.end_msg('yes')
conf.start_msg('Does this OS support VGUI?')
if conf.env.DEST_OS not in VGUI_SUPPORTED_OS:
conf.end_msg('no')
Logs.warn('vgui is not supported on this OS: ' + str(conf.env.DEST_OS))
return False
else: conf.end_msg('yes')
conf.start_msg('Does this toolchain able to link VGUI?')
if conf.env.DEST_OS == 'win32' and conf.env.COMPILER_CXX == 'g++':
conf.end_msg('no')
# we have ABI incompatibility ONLY on MinGW
Logs.warn('vgui can\'t be linked with MinGW')
return False
else: conf.end_msg('yes')
conf.start_msg('Configuring VGUI by provided path')
vgui_dev = conf.options.VGUI_DEV
if conf.env.DEST_OS == 'win32':
conf.env.LIB_VGUI = ['vgui']
conf.env.LIBPATH_VGUI = [os.path.abspath(os.path.join(vgui_dev, 'lib/win32_vc6/'))]
else:
libpath = os.path.abspath(os.path.join(vgui_dev, 'lib'))
if conf.env.DEST_OS == 'linux':
conf.env.LIB_VGUI = [':vgui.so']
conf.env.LIBPATH_VGUI = [libpath]
elif conf.env.DEST_OS == 'darwin':
conf.env.LDFLAGS_VGUI = [os.path.join(libpath, 'vgui.dylib')]
else:
conf.fatal('vgui is not supported on this OS: ' + conf.env.DEST_OS)
conf.env.INCLUDES_VGUI = [os.path.abspath(os.path.join(vgui_dev, 'include'))]
conf.env.HAVE_VGUI = 1
conf.end_msg('yes: {0}, {1}, {2}'.format(conf.env.LIB_VGUI, conf.env.LIBPATH_VGUI, conf.env.INCLUDES_VGUI))
if conf.env.HAVE_VGUI and conf.options.VGUI_SANITY_CHECK:
try:
conf.check_cxx(fragment=VGUI_FRAGMENT,
msg = 'Checking for library VGUI sanity',
use = 'VGUI',
execute = False)
except conf.errors.ConfigurationError:
conf.fatal("Can't compile simple program. Check your path to vgui-dev repository.")
return True

View file

@ -1,660 +0,0 @@
# encoding: utf-8
# xcompile.py -- crosscompiling utils
# Copyright (C) 2018 a1batross
# 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.
try: from fwgslib import get_flags_by_compiler
except: from waflib.extras.fwgslib import get_flags_by_compiler
from waflib import Logs, TaskGen
from waflib.Tools import c_config
from collections import OrderedDict
import os
import sys
ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK']
ANDROID_NDK_SUPPORTED = [10, 19, 20, 23, 25]
ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp
ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC
ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15
ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag
ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16, 23: 16, 25: 19 } # minimal API level ndk revision supports
ANDROID_STPCPY_API_MIN = 21 # stpcpy() introduced in SDK 21
ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets
NSWITCH_ENVVARS = ['DEVKITPRO']
PSVITA_ENVVARS = ['VITASDK']
# This class does support ONLY r10e and r19c/r20 NDK
class Android:
ctx = None # waf context
arch = None
toolchain = None
api = None
ndk_home = None
ndk_rev = 0
is_hardfloat = False
clang = False
def __init__(self, ctx, arch, toolchain, api):
self.ctx = ctx
self.api = api
self.toolchain = toolchain
self.arch = arch
for i in ANDROID_NDK_ENVVARS:
self.ndk_home = os.getenv(i)
if self.ndk_home != None:
break
else:
ctx.fatal('Set %s environment variable pointing to the root of Android NDK!' %
' or '.join(ANDROID_NDK_ENVVARS))
# TODO: this were added at some point of NDK development
# but I don't know at which version
# r10e don't have it
source_prop = os.path.join(self.ndk_home, 'source.properties')
if os.path.exists(source_prop):
with open(source_prop) as ndk_props_file:
for line in ndk_props_file.readlines():
tokens = line.split('=')
trimed_tokens = [token.strip() for token in tokens]
if 'Pkg.Revision' in trimed_tokens:
self.ndk_rev = int(trimed_tokens[1].split('.')[0])
if self.ndk_rev not in ANDROID_NDK_SUPPORTED:
ctx.fatal('Unknown NDK revision: %d' % (self.ndk_rev))
else:
self.ndk_rev = ANDROID_NDK_SUPPORTED[0]
if 'clang' in self.toolchain or self.ndk_rev > ANDROID_NDK_GCC_MAX:
self.clang = True
if self.arch == 'armeabi-v7a-hard':
if self.ndk_rev <= ANDROID_NDK_HARDFP_MAX:
self.arch = 'armeabi-v7a' # Only armeabi-v7a have hard float ABI
self.is_hardfloat = True
else:
ctx.fatal('NDK does not support hardfloat ABI')
if self.api < ANDROID_NDK_API_MIN[self.ndk_rev]:
self.api = ANDROID_NDK_API_MIN[self.ndk_rev]
Logs.warn('API level automatically was set to %d due to NDK support' % self.api)
if self.is_arm64() or self.is_amd64() and self.api < ANDROID_64BIT_API_MIN:
self.api = ANDROID_64BIT_API_MIN
Logs.warn('API level for 64-bit target automatically was set to %d' % self.api)
def is_host(self):
'''
Checks if we using host compiler(implies clang)
'''
return self.toolchain == 'host'
def is_arm(self):
'''
Checks if selected architecture is **32-bit** ARM
'''
return self.arch.startswith('armeabi')
def is_x86(self):
'''
Checks if selected architecture is **32-bit** or **64-bit** x86
'''
return self.arch == 'x86'
def is_amd64(self):
'''
Checks if selected architecture is **64-bit** x86
'''
return self.arch == 'x86_64'
def is_arm64(self):
'''
Checks if selected architecture is AArch64
'''
return self.arch == 'aarch64'
def is_clang(self):
'''
Checks if selected toolchain is Clang (TODO)
'''
return self.clang
def is_hardfp(self):
return self.is_hardfloat
def ndk_triplet(self, llvm_toolchain = False, toolchain_folder = False):
if self.is_x86():
if toolchain_folder:
return 'x86'
else:
return 'i686-linux-android'
elif self.is_arm():
if llvm_toolchain:
return 'armv7a-linux-androideabi'
else:
return 'arm-linux-androideabi'
elif self.is_amd64() and toolchain_folder:
return 'x86_64'
else:
return self.arch + '-linux-android'
def apk_arch(self):
if self.is_arm64():
return 'arm64-v8a'
return self.arch
def gen_host_toolchain(self):
# With host toolchain we don't care about OS
# so just download NDK for Linux x86_64
if 'HOST_TOOLCHAIN' in self.ctx.environ:
return self.ctx.environ['HOST_TOOLCHAIN']
if self.is_host():
return 'linux-x86_64'
if sys.platform.startswith('win32') or sys.platform.startswith('cygwin'):
osname = 'windows'
elif sys.platform.startswith('darwin'):
osname = 'darwin'
elif sys.platform.startswith('linux'):
osname = 'linux'
else:
self.ctx.fatal('Unsupported by NDK host platform')
if sys.maxsize > 2**32:
arch = 'x86_64'
else: arch = 'x86'
return '%s-%s' % (osname, arch)
def gen_gcc_toolchain_path(self):
path = 'toolchains'
toolchain_host = self.gen_host_toolchain()
if self.is_clang():
toolchain_folder = 'llvm'
else:
if self.is_host():
toolchain = '4.9'
else:
toolchain = self.toolchain
toolchain_folder = '%s-%s' % (self.ndk_triplet(toolchain_folder = True), toolchain)
return os.path.abspath(os.path.join(self.ndk_home, path, toolchain_folder, 'prebuilt', toolchain_host))
def gen_toolchain_path(self):
if self.is_clang():
triplet = '%s%d-' % (self.ndk_triplet(llvm_toolchain = True), self.api)
else:
triplet = self.ndk_triplet() + '-'
return os.path.join(self.gen_gcc_toolchain_path(), 'bin', triplet)
def gen_binutils_path(self):
if self.ndk_rev >= 23:
return os.path.join(self.gen_gcc_toolchain_path(), 'bin')
return os.path.join(self.gen_gcc_toolchain_path(), self.ndk_triplet(), 'bin')
def cc(self):
if self.is_host():
s = 'clang'
environ = getattr(self.ctx, 'environ', os.environ)
if 'CC' in environ:
s = environ['CC']
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc')
def cxx(self):
if self.is_host():
s = 'clang++'
environ = getattr(self.ctx, 'environ', os.environ)
if 'CXX' in environ:
s = environ['CXX']
return '%s --target=%s%d' % (s, self.ndk_triplet(), self.api)
return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++')
def strip(self):
if self.is_host():
environ = getattr(self.ctx, 'environ', os.environ)
if 'STRIP' in environ:
return environ['STRIP']
return 'llvm-strip'
if self.ndk_rev >= 23:
return os.path.join(self.gen_binutils_path(), 'llvm-strip')
return os.path.join(self.gen_binutils_path(), 'strip')
def system_stl(self):
# TODO: proper STL support
return os.path.abspath(os.path.join(self.ndk_home, 'sources', 'cxx-stl', 'system', 'include'))
def libsysroot(self):
arch = self.arch
if self.is_arm():
arch = 'arm'
elif self.is_arm64():
arch = 'arm64'
path = 'platforms/android-%s/arch-%s' % (self.api, arch)
return os.path.abspath(os.path.join(self.ndk_home, path))
def sysroot(self):
if self.ndk_rev >= ANDROID_NDK_UNIFIED_SYSROOT_MIN:
return os.path.abspath(os.path.join(self.ndk_home, 'sysroot'))
else:
return self.libsysroot()
def cflags(self, cxx = False):
cflags = []
if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX:
cflags += ['--sysroot=%s' % (self.sysroot())]
else:
if self.is_host():
cflags += [
'--sysroot=%s/sysroot' % (self.gen_gcc_toolchain_path()),
'-isystem', '%s/usr/include/' % (self.sysroot())
]
cflags += ['-I%s' % (self.system_stl())]
if not self.is_clang():
cflags += ['-DANDROID', '-D__ANDROID__']
if cxx and not self.is_clang() and self.toolchain not in ['4.8','4.9']:
cflags += ['-fno-sized-deallocation']
if self.is_clang():
# stpcpy() isn't available in early Android versions
# disable it here so Clang won't use it
if self.api < ANDROID_STPCPY_API_MIN:
cflags += ['-fno-builtin-stpcpy']
if self.is_arm():
if self.arch == 'armeabi-v7a':
# ARMv7 support
cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9']
if self.is_hardfp():
cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK']
if self.is_host():
# Clang builtin redefine w/ different calling convention bug
# NOTE: I did not added complex.h functions here, despite
# that NDK devs forgot to put __NDK_FPABI_MATH__ for complex
# math functions
# I personally don't need complex numbers support, but if you want it
# just run sed to patch header
for f in ['strtod', 'strtof', 'strtold']:
cflags += ['-fno-builtin-%s' % f]
else:
cflags += ['-mfloat-abi=softfp']
else:
# ARMv5 support
cflags += ['-march=armv5te', '-msoft-float']
elif self.is_x86():
cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse']
return cflags
# they go before object list
def linkflags(self):
linkflags = []
if self.is_host():
linkflags += ['--gcc-toolchain=%s' % self.gen_gcc_toolchain_path()]
if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX:
linkflags += ['--sysroot=%s' % (self.sysroot())]
elif self.is_host():
linkflags += ['--sysroot=%s/sysroot' % (self.gen_gcc_toolchain_path())]
if self.is_clang() or self.is_host():
linkflags += ['-fuse-ld=lld']
else: linkflags += ['-no-canonical-prefixes']
linkflags += ['-Wl,--hash-style=sysv', '-Wl,--no-undefined']
return linkflags
def ldflags(self):
ldflags = []
if self.ndk_rev < 23:
ldflags += ['-lgcc']
if self.is_clang() or self.is_host():
ldflags += ['-stdlib=libstdc++']
else: ldflags += ['-no-canonical-prefixes']
if self.is_arm():
if self.arch == 'armeabi-v7a':
ldflags += ['-march=armv7-a', '-mthumb']
if not self.is_clang() and not self.is_host(): # lld only
ldflags += ['-Wl,--fix-cortex-a8']
if self.is_hardfp():
ldflags += ['-Wl,--no-warn-mismatch', '-lm_hard']
else:
ldflags += ['-march=armv5te']
return ldflags
class NintendoSwitch:
ctx = None # waf context
arch = "arm64"
dkp_dir = None
portlibs_dir = None
dka64_dir = None
libnx_dir = None
def __init__(self, ctx):
self.ctx = ctx
for i in NSWITCH_ENVVARS:
self.dkp_dir = os.getenv(i)
if self.dkp_dir != None:
break
else:
ctx.fatal('Set %s environment variable pointing to the DEVKITPRO home!' %
' or '.join(NSWITCH_ENVVARS))
self.dkp_dir = os.path.abspath(self.dkp_dir)
self.dka64_dir = os.path.join(self.dkp_dir, 'devkitA64')
if not os.path.exists(self.dka64_dir):
ctx.fatal('devkitA64 not found in `%s`. Install devkitA64!' % self.dka64_dir)
self.libnx_dir = os.path.join(self.dkp_dir, 'libnx')
if not os.path.exists(self.libnx_dir):
ctx.fatal('libnx not found in `%s`. Install libnx!' % self.libnx_dir)
self.portlibs_dir = os.path.join(self.dkp_dir, 'portlibs', 'switch')
if not os.path.exists(self.portlibs_dir):
ctx.fatal('No Switch libraries found in `%s`!' % self.portlibs_dir)
def gen_toolchain_prefix(self):
return 'aarch64-none-elf-'
def gen_gcc_toolchain_path(self):
return os.path.join(self.dka64_dir, 'bin', self.gen_toolchain_prefix())
def cc(self):
return self.gen_gcc_toolchain_path() + 'gcc'
def cxx(self):
return self.gen_gcc_toolchain_path() + 'g++'
def strip(self):
return self.gen_gcc_toolchain_path() + 'strip'
def pkgconfig(self):
# counter-intuitively, this motherfucker is in $DEVKITPRO/portlibs/switch/bin
return os.path.join(self.portlibs_dir, 'bin', self.gen_toolchain_prefix() + 'pkg-config')
def cflags(self, cxx = False):
cflags = []
# arch flags
cflags += ['-D__SWITCH__', '-march=armv8-a+crc+crypto', '-mtune=cortex-a57', '-mtp=soft', '-ftls-model=local-exec', '-fPIE']
# help the linker out
cflags += ['-ffunction-sections', '-fdata-sections']
# base include dirs
cflags += ['-isystem %s/include' % self.libnx_dir, '-I%s/include' % self.portlibs_dir]
# the game wants GNU extensions
if cxx:
cflags += ['-std=gnu++17', '-D_GNU_SOURCE']
else:
cflags += ['-std=gnu11', '-D_GNU_SOURCE']
return cflags
# they go before object list
def linkflags(self):
linkflags = ['-fPIE', '-specs=%s/switch.specs' % self.libnx_dir]
# libsolder only supports sysv hashes and we need to build everything with -rdynamic
linkflags += ['-Wl,--hash-style=sysv', '-rdynamic']
# avoid pulling in and exposing mesa's internals, that crashes it for some god forsaken reason
linkflags += ['-Wl,--exclude-libs=libglapi.a', '-Wl,--exclude-libs=libdrm_nouveau.a']
return linkflags
def ldflags(self):
# NOTE: shared libraries should be built without standard libs, so that they could import their contents from the NRO,
# but executables, including the SDL2 sanity check, will generally require libstdc++ and libm, which we will add manually
ldflags = [] # ['-lm', '-lstdc++']
return ldflags
class PSVita:
ctx = None # waf context
arch ='armeabi-v7a-hard'
vitasdk_dir = None
def __init__(self, ctx):
self.ctx = ctx
for i in PSVITA_ENVVARS:
self.vitasdk_dir = os.getenv(i)
if self.vitasdk_dir != None:
break
else:
ctx.fatal('Set %s environment variable pointing to the VitaSDK directory!' %
' or '.join(PSVITA_ENVVARS))
def gen_toolchain_prefix(self):
return 'arm-vita-eabi-'
def gen_gcc_toolchain_path(self):
return os.path.join(self.vitasdk_dir, 'bin', self.gen_toolchain_prefix())
def cc(self):
return self.gen_gcc_toolchain_path() + 'gcc'
def cxx(self):
return self.gen_gcc_toolchain_path() + 'g++'
def strip(self):
return self.gen_gcc_toolchain_path() + 'strip'
def ar(self):
return self.gen_gcc_toolchain_path() + 'ar'
def pkgconfig(self):
return self.gen_gcc_toolchain_path() + 'pkg-config'
def cflags(self, cxx = False):
cflags = []
# arch flags
cflags += ['-D__vita__', '-mtune=cortex-a9', '-mfpu=neon']
# necessary linker flags
cflags += ['-Wl,-q', '-Wl,-z,nocopyreloc']
# this optimization is broken in vitasdk
cflags += ['-fno-optimize-sibling-calls']
# disable some ARM bullshit
cflags += ['-fno-short-enums', '-Wno-attributes']
# base include dir
cflags += ['-isystem %s/arm-vita-eabi/include' % self.vitasdk_dir]
# SDL include dir
cflags += ['-I%s/arm-vita-eabi/include/SDL2' % self.vitasdk_dir]
return cflags
# they go before object list
def linkflags(self):
linkflags = ['-Wl,--hash-style=sysv', '-Wl,-q', '-Wl,-z,nocopyreloc', '-mtune=cortex-a9', '-mfpu=neon']
# enforce no-short-enums again
linkflags += ['-Wl,-no-enum-size-warning', '-fno-short-enums']
return linkflags
def ldflags(self):
ldflags = []
return ldflags
def options(opt):
xc = opt.add_option_group('Cross compile options')
xc.add_option('--android', action='store', dest='ANDROID_OPTS', default=None,
help='enable building for android, format: --android=<arch>,<toolchain>,<api>, example: --android=armeabi-v7a-hard,4.9,9')
xc.add_option('--enable-magx', action='store_true', dest='MAGX', default=False,
help='enable building for Motorola MAGX [default: %default]')
xc.add_option('--enable-msvc-wine', action='store_true', dest='MSVC_WINE', default=False,
help='enable building with MSVC using Wine [default: %default]')
xc.add_option('--nswitch', action='store_true', dest='NSWITCH', default = False,
help ='enable building for Nintendo Switch [default: %default]')
xc.add_option('--psvita', action='store_true', dest='PSVITA', default = False,
help ='enable building for PlayStation Vita [default: %default]')
def configure(conf):
if conf.options.ANDROID_OPTS:
values = conf.options.ANDROID_OPTS.split(',')
if len(values) != 3:
conf.fatal('Invalid --android paramater value!')
valid_archs = ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'aarch64']
if values[0] not in valid_archs:
conf.fatal('Unknown arch: %s. Supported: %r' % (values[0], ', '.join(valid_archs)))
conf.android = android = Android(conf, values[0], values[1], int(values[2]))
conf.environ['CC'] = android.cc()
conf.environ['CXX'] = android.cxx()
conf.environ['STRIP'] = android.strip()
conf.env.CFLAGS += android.cflags()
conf.env.CXXFLAGS += android.cflags(True)
conf.env.LINKFLAGS += android.linkflags()
conf.env.LDFLAGS += android.ldflags()
conf.env.HAVE_M = True
if android.is_hardfp():
conf.env.LIB_M = ['m_hard']
else: conf.env.LIB_M = ['m']
conf.env.PREFIX = '/lib/%s' % android.apk_arch()
conf.msg('Selected Android NDK', '%s, version: %d' % (android.ndk_home, android.ndk_rev))
# no need to print C/C++ compiler, as it would be printed by compiler_c/cxx
conf.msg('... C/C++ flags', ' '.join(android.cflags()).replace(android.ndk_home, '$NDK/'))
conf.msg('... link flags', ' '.join(android.linkflags()).replace(android.ndk_home, '$NDK/'))
conf.msg('... ld flags', ' '.join(android.ldflags()).replace(android.ndk_home, '$NDK/'))
elif conf.options.MAGX:
# useless to change toolchain path, as toolchain meant to be placed in this path
toolchain_path = '/opt/toolchains/motomagx/arm-eabi2/lib/'
conf.env.INCLUDES_MAGX = [toolchain_path + i for i in ['ezx-z6/include', 'qt-2.3.8/include']]
conf.env.LIBPATH_MAGX = [toolchain_path + i for i in ['ezx-z6/lib', 'qt-2.3.8/lib']]
conf.env.LINKFLAGS_MAGX = ['-Wl,-rpath-link=' + i for i in conf.env.LIBPATH_MAGX]
elif conf.options.MSVC_WINE:
try:
toolchain_path = conf.environ['MSVC_WINE_PATH']
except KeyError:
conf.fatal('Set MSVC_WINE_PATH environment variable to the MSVC toolchain root!')
conf.environ['CC'] = conf.environ['CXX'] = os.path.join(toolchain_path, 'bin', conf.env.MSVC_TARGETS[0], 'cl')
conf.environ['LINK_CXX'] = os.path.join(toolchain_path, 'bin', conf.env.MSVC_TARGETS[0], 'link')
conf.environ['AR'] = os.path.join(toolchain_path, 'bin', conf.env.MSVC_TARGETS[0], 'lib')
conf.environ['WINRC'] = os.path.join(toolchain_path, 'bin', conf.env.MSVC_TARGETS[0], 'rc')
conf.env.DEST_OS = 'win32'
conf.env.DEST_CPU = conf.env.MSVC_TARGETS[0]
conf.env.COMPILER_CXX = conf.env.COMPILER_CC = 'msvc'
elif conf.options.NSWITCH:
conf.nswitch = nswitch = NintendoSwitch(conf)
conf.environ['CC'] = nswitch.cc()
conf.environ['CXX'] = nswitch.cxx()
conf.environ['STRIP'] = nswitch.strip()
conf.env.PKGCONFIG = nswitch.pkgconfig()
conf.env.CFLAGS += nswitch.cflags()
conf.env.CXXFLAGS += nswitch.cflags(True)
conf.env.LINKFLAGS += nswitch.linkflags()
conf.env.LDFLAGS += nswitch.ldflags()
conf.env.HAVE_M = True
conf.env.LIB_M = ['m']
conf.env.DEST_OS = 'nswitch'
elif conf.options.PSVITA:
conf.psvita = psvita = PSVita(conf)
conf.environ['CC'] = psvita.cc()
conf.environ['CXX'] = psvita.cxx()
conf.environ['STRIP'] = psvita.strip()
conf.environ['AR'] = psvita.ar()
conf.env.PKGCONFIG = psvita.pkgconfig()
conf.env.CFLAGS += psvita.cflags()
conf.env.CXXFLAGS += psvita.cflags(True)
conf.env.LINKFLAGS += psvita.linkflags()
conf.env.LDFLAGS += psvita.ldflags()
conf.env.HAVE_M = True
conf.env.LIB_M = ['m']
conf.env.VRTLD = ['vrtld']
conf.env.DEST_OS = 'psvita'
conf.env.MAGX = conf.options.MAGX
conf.env.MSVC_WINE = conf.options.MSVC_WINE
MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android', '__SWITCH__' : 'nswitch', '__vita__' : 'psvita' })
for k in c_config.MACRO_TO_DESTOS:
MACRO_TO_DESTOS[k] = c_config.MACRO_TO_DESTOS[k] # ordering is important
c_config.MACRO_TO_DESTOS = MACRO_TO_DESTOS
def post_compiler_cxx_configure(conf):
conf.msg('Target OS', conf.env.DEST_OS)
conf.msg('Target CPU', conf.env.DEST_CPU)
conf.msg('Target binfmt', conf.env.DEST_BINFMT)
if conf.options.ANDROID_OPTS:
if conf.android.ndk_rev == 19:
conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++']
conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++']
elif conf.options.MAGX:
for lib in ['qte-mt', 'ezxappbase', 'ezxpm', 'log_util']:
conf.check_cc(lib=lib, use='MAGX', uselib_store='MAGX')
return
def post_compiler_c_configure(conf):
conf.msg('Target OS', conf.env.DEST_OS)
conf.msg('Target CPU', conf.env.DEST_CPU)
conf.msg('Target binfmt', conf.env.DEST_BINFMT)
return
from waflib.Tools import compiler_cxx, compiler_c
compiler_cxx_configure = getattr(compiler_cxx, 'configure')
compiler_c_configure = getattr(compiler_c, 'configure')
def patch_compiler_cxx_configure(conf):
if not conf.env.MSVC_WINE:
compiler_cxx_configure(conf)
else:
conf.load('msvc', funs='no_autodetect')
post_compiler_cxx_configure(conf)
def patch_compiler_c_configure(conf):
if not conf.env.MSVC_WINE:
compiler_c_configure(conf)
else:
conf.load('msvc', funs='no_autodetect')
post_compiler_c_configure(conf)
setattr(compiler_cxx, 'configure', patch_compiler_cxx_configure)
setattr(compiler_c, 'configure', patch_compiler_c_configure)
@TaskGen.feature('cshlib', 'cxxshlib', 'dshlib', 'fcshlib', 'vnum')
@TaskGen.after_method('apply_link', 'propagate_uselib_vars')
@TaskGen.before_method('apply_vnum')
def apply_android_soname(self):
"""
Enforce SONAME on Android
"""
if self.env.DEST_OS != 'android':
return
setattr(self, 'vnum', None) # remove vnum, so SONAME would not be overwritten
link = self.link_task
node = link.outputs[0]
libname = node.name
v = self.env.SONAME_ST % libname
self.env.append_value('LINKFLAGS', v.split())

175
waf vendored

File diff suppressed because one or more lines are too long

635
win32/Makefile Normal file
View file

@ -0,0 +1,635 @@
# The Wastes Makefile for Mingw
#
# Requires vgui.so to be in the same format.
# So don't bother cross-compiling unless OK'd by Valve
#
# Sep '23 by eukara <marco@vera-visions.com>
#
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
all:
$(MAKE) thewastes.dll
SHARED_CFLAGS=\
-m32 \
-std=c++98 \
-fvisibility=hidden \
-Os -s
#############################################################################
# CLIENT GAME
#############################################################################
CLDLL_CFLAGS=\
$(SHARED_CFLAGS) \
-I../dlls \
-I../common \
-I../engine \
-I../pm_shared \
-I../game_shared \
-I../external \
-I../utils/vgui/include \
-DSERVER_USES_OLD_I386_POSTFIX=1 \
-DCLIENT_WEAPONS=1 \
-DCLIENT_DLL
CLDLL_LDFLAGS=\
-m32 \
-shared
DO_CLDLL_CC=$(CC) $(CFLAGS) $(CLDLL_CFLAGS) -o $@ -c $<
DO_CLDLL_CXX=$(CXX) $(CFLAGS) $(CLDLL_CFLAGS) -o $@ -c $<
CL_SRCDIR=../cl_dll
CL_OBJDIR=./cl_obj
CLDLL_OBJS = \
$(CL_OBJDIR)/ev_thewastes.o \
$(CL_OBJDIR)/hl_baseentity.o \
$(CL_OBJDIR)/hl_events.o \
$(CL_OBJDIR)/hl_objects.o \
$(CL_OBJDIR)/hl_weapons.o \
$(CL_OBJDIR)/interface.o \
$(CL_OBJDIR)/thewastes.o \
$(CL_OBJDIR)/tw_akimbos.o \
$(CL_OBJDIR)/tw_automatics.o \
$(CL_OBJDIR)/tw_explosives.o \
$(CL_OBJDIR)/tw_melee.o \
$(CL_OBJDIR)/tw_shotguns.o \
$(CL_OBJDIR)/tw_sidearms.o \
$(CL_OBJDIR)/vgui_scrollbar2.o \
$(CL_OBJDIR)/vgui_slider2.o \
$(CL_OBJDIR)/voice_banmgr.o \
$(CL_OBJDIR)/voice_status.o \
$(CL_OBJDIR)/voice_vgui_tweakdlg.o \
$(CL_OBJDIR)/ammo.o \
$(CL_OBJDIR)/ammo_secondary.o \
$(CL_OBJDIR)/ammohistory.o \
$(CL_OBJDIR)/cdll_int.o \
$(CL_OBJDIR)/com_weapons.o \
$(CL_OBJDIR)/death.o \
$(CL_OBJDIR)/demo.o \
$(CL_OBJDIR)/entity.o \
$(CL_OBJDIR)/env_fog.o \
$(CL_OBJDIR)/ev_common.o \
$(CL_OBJDIR)/events.o \
$(CL_OBJDIR)/flashlight.o \
$(CL_OBJDIR)/GameStudioModelRenderer.o \
$(CL_OBJDIR)/geiger.o \
$(CL_OBJDIR)/health.o \
$(CL_OBJDIR)/hud.o \
$(CL_OBJDIR)/hud_msg.o \
$(CL_OBJDIR)/hud_redraw.o \
$(CL_OBJDIR)/hud_servers.o \
$(CL_OBJDIR)/hud_spectator.o \
$(CL_OBJDIR)/hud_update.o \
$(CL_OBJDIR)/in_camera.o \
$(CL_OBJDIR)/input.o \
$(CL_OBJDIR)/inputw32.o \
$(CL_OBJDIR)/menu.o \
$(CL_OBJDIR)/message.o \
$(CL_OBJDIR)/parsebsp.o \
$(CL_OBJDIR)/ParseBspEnt.o \
$(CL_OBJDIR)/parsemsg.o \
$(CL_OBJDIR)/ParticleBase.o \
$(CL_OBJDIR)/pm_debug.o \
$(CL_OBJDIR)/pm_math.o \
$(CL_OBJDIR)/pm_shared.o \
$(CL_OBJDIR)/saytext.o \
$(CL_OBJDIR)/status_icons.o \
$(CL_OBJDIR)/statusbar.o \
$(CL_OBJDIR)/studio_util.o \
$(CL_OBJDIR)/studioevent.o \
$(CL_OBJDIR)/StudioModelRenderer.o \
$(CL_OBJDIR)/text_message.o \
$(CL_OBJDIR)/thewastes_hud.o \
$(CL_OBJDIR)/train.o \
$(CL_OBJDIR)/tri.o \
$(CL_OBJDIR)/twm.o \
$(CL_OBJDIR)/util.o \
$(CL_OBJDIR)/vgui_checkbutton2.o \
$(CL_OBJDIR)/vgui_ConsolePanel.o \
$(CL_OBJDIR)/vgui_ControlConfigPanel.o \
$(CL_OBJDIR)/vgui_CustomObjects.o \
$(CL_OBJDIR)/vgui_grid.o \
$(CL_OBJDIR)/vgui_helpers.o \
$(CL_OBJDIR)/vgui_int.o \
$(CL_OBJDIR)/vgui_ItemSelection.o \
$(CL_OBJDIR)/vgui_listbox.o \
$(CL_OBJDIR)/vgui_loadtga.o \
$(CL_OBJDIR)/vgui_MOTDWindow.o \
$(CL_OBJDIR)/vgui_SchemeManager.o \
$(CL_OBJDIR)/vgui_ScorePanel.o \
$(CL_OBJDIR)/vgui_ServerBrowser.o \
$(CL_OBJDIR)/vgui_teammenu.o \
$(CL_OBJDIR)/vgui_TheWastesViewport.o \
$(CL_OBJDIR)/view.o
client.dll :
@-mkdir -p $(CL_OBJDIR)
$(MAKE) $(CLDLL_OBJS)
$(CXX) $(CFLAGS) $(CLDLL_LDFLAGS) -o $@ $(CLDLL_OBJS) $(CL_SRCDIR)/../utils/vgui/lib/win32_vc6/vgui.lib
$(CL_OBJDIR)/ev_thewastes.o : $(CL_SRCDIR)/ev_thewastes.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_baseentity.o : $(CL_SRCDIR)/thewastes/hl_baseentity.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_events.o : $(CL_SRCDIR)/thewastes/hl_events.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_objects.o : $(CL_SRCDIR)/thewastes/hl_objects.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hl_weapons.o : $(CL_SRCDIR)/thewastes/hl_weapons.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/interface.o : $(CL_SRCDIR)/../common/interface.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/thewastes.o : $(CL_SRCDIR)/../dlls/thewastes.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_akimbos.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_akimbos.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_automatics.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_automatics.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_explosives.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_explosives.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_melee.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_melee.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_shotguns.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_shotguns.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tw_sidearms.o : $(CL_SRCDIR)/../dlls/wpn_shared/tw_sidearms.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_scrollbar2.o : $(CL_SRCDIR)/../game_shared/vgui_scrollbar2.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_slider2.o : $(CL_SRCDIR)/../game_shared/vgui_slider2.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/voice_banmgr.o : $(CL_SRCDIR)/../game_shared/voice_banmgr.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/voice_status.o : $(CL_SRCDIR)/../game_shared/voice_status.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/voice_vgui_tweakdlg.o : $(CL_SRCDIR)/../game_shared/voice_vgui_tweakdlg.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ammo.o : $(CL_SRCDIR)/ammo.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ammo_secondary.o : $(CL_SRCDIR)/ammo_secondary.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ammohistory.o : $(CL_SRCDIR)/ammohistory.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/cdll_int.o : $(CL_SRCDIR)/cdll_int.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/com_weapons.o : $(CL_SRCDIR)/com_weapons.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/death.o : $(CL_SRCDIR)/death.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/demo.o : $(CL_SRCDIR)/demo.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/entity.o : $(CL_SRCDIR)/entity.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/env_fog.o : $(CL_SRCDIR)/env_fog.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ev_common.o : $(CL_SRCDIR)/ev_common.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/events.o : $(CL_SRCDIR)/events.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/flashlight.o : $(CL_SRCDIR)/flashlight.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/GameStudioModelRenderer.o : $(CL_SRCDIR)/GameStudioModelRenderer.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/geiger.o : $(CL_SRCDIR)/geiger.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/health.o : $(CL_SRCDIR)/health.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud.o : $(CL_SRCDIR)/hud.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_msg.o : $(CL_SRCDIR)/hud_msg.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_redraw.o : $(CL_SRCDIR)/hud_redraw.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_servers.o : $(CL_SRCDIR)/hud_servers.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_spectator.o : $(CL_SRCDIR)/hud_spectator.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/hud_update.o : $(CL_SRCDIR)/hud_update.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/in_camera.o : $(CL_SRCDIR)/in_camera.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/input.o : $(CL_SRCDIR)/input.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/inputw32.o : $(CL_SRCDIR)/inputw32.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/menu.o : $(CL_SRCDIR)/menu.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/message.o : $(CL_SRCDIR)/message.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/parsebsp.o : $(CL_SRCDIR)/parsebsp.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ParseBspEnt.o : $(CL_SRCDIR)/ParseBspEnt.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/parsemsg.o : $(CL_SRCDIR)/parsemsg.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/ParticleBase.o : $(CL_SRCDIR)/ParticleBase.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/pm_debug.o : $(CL_SRCDIR)/../pm_shared/pm_debug.c
$(DO_CLDLL_CC)
$(CL_OBJDIR)/pm_math.o : $(CL_SRCDIR)/../pm_shared/pm_math.c
$(DO_CLDLL_CC)
$(CL_OBJDIR)/pm_shared.o : $(CL_SRCDIR)/../pm_shared/pm_shared.c
$(DO_CLDLL_CC)
$(CL_OBJDIR)/saytext.o : $(CL_SRCDIR)/saytext.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/status_icons.o : $(CL_SRCDIR)/status_icons.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/statusbar.o : $(CL_SRCDIR)/statusbar.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/studio_util.o : $(CL_SRCDIR)/studio_util.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/studioevent.o : $(CL_SRCDIR)/studioevent.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/StudioModelRenderer.o : $(CL_SRCDIR)/StudioModelRenderer.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/text_message.o : $(CL_SRCDIR)/text_message.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/thewastes_hud.o : $(CL_SRCDIR)/thewastes_hud.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/train.o : $(CL_SRCDIR)/train.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/tri.o : $(CL_SRCDIR)/tri.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/twm.o : $(CL_SRCDIR)/twm.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/util.o : $(CL_SRCDIR)/util.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_checkbutton2.o : $(CL_SRCDIR)/../game_shared/vgui_checkbutton2.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ConsolePanel.o : $(CL_SRCDIR)/vgui_ConsolePanel.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ControlConfigPanel.o : $(CL_SRCDIR)/vgui_ControlConfigPanel.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_CustomObjects.o : $(CL_SRCDIR)/vgui_CustomObjects.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_grid.o : $(CL_SRCDIR)/../game_shared/vgui_grid.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_helpers.o : $(CL_SRCDIR)/../game_shared/vgui_helpers.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_int.o : $(CL_SRCDIR)/vgui_int.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ItemSelection.o : $(CL_SRCDIR)/vgui_ItemSelection.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_listbox.o : $(CL_SRCDIR)/../game_shared/vgui_listbox.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_loadtga.o : $(CL_SRCDIR)/../game_shared/vgui_loadtga.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_MOTDWindow.o : $(CL_SRCDIR)/vgui_MOTDWindow.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_SchemeManager.o : $(CL_SRCDIR)/vgui_SchemeManager.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ScorePanel.o : $(CL_SRCDIR)/vgui_ScorePanel.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_ServerBrowser.o : $(CL_SRCDIR)/vgui_ServerBrowser.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_teammenu.o : $(CL_SRCDIR)/vgui_teammenu.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/vgui_TheWastesViewport.o : $(CL_SRCDIR)/vgui_TheWastesViewport.cpp
$(DO_CLDLL_CXX)
$(CL_OBJDIR)/view.o : $(CL_SRCDIR)/view.cpp
$(DO_CLDLL_CXX)
#############################################################################
# SERVER GAME
#############################################################################
SVDLL_CFLAGS=\
$(SHARED_CFLAGS) \
-I../common \
-I../dlls \
-I../engine \
-I../pm_shared \
-I../game_shared
SVDLL_LDFLAGS=\
-m32 \
-shared \
-static-libgcc \
-static-libstdc++
DO_SVDLL_CC=$(CC) $(CFLAGS) $(SVDLL_CFLAGS) -o $@ -c $<
DO_SVDLL_CXX=$(CXX) $(CFLAGS) $(SVDLL_CFLAGS) -o $@ -c $<
SV_SRCDIR=../dlls
SV_OBJDIR=./sv_obj
SVDLL_OBJS = \
$(SV_OBJDIR)/animating.o \
$(SV_OBJDIR)/animation.o \
$(SV_OBJDIR)/bmodels.o \
$(SV_OBJDIR)/buttons.o \
$(SV_OBJDIR)/cbase.o \
$(SV_OBJDIR)/client.o \
$(SV_OBJDIR)/combat.o \
$(SV_OBJDIR)/doors.o \
$(SV_OBJDIR)/effects.o \
$(SV_OBJDIR)/explode.o \
$(SV_OBJDIR)/func_break.o \
$(SV_OBJDIR)/func_tank.o \
$(SV_OBJDIR)/game.o \
$(SV_OBJDIR)/game_deathmatch.o \
$(SV_OBJDIR)/game_lastmanstanding.o \
$(SV_OBJDIR)/game_singleplay.o \
$(SV_OBJDIR)/game_teamplay.o \
$(SV_OBJDIR)/gamerules.o \
$(SV_OBJDIR)/ggrenade.o \
$(SV_OBJDIR)/globals.o \
$(SV_OBJDIR)/h_ai.o \
$(SV_OBJDIR)/h_cycler.o \
$(SV_OBJDIR)/h_export.o \
$(SV_OBJDIR)/items.o \
$(SV_OBJDIR)/lights.o \
$(SV_OBJDIR)/maprules.o \
$(SV_OBJDIR)/monsters.o \
$(SV_OBJDIR)/mortar.o \
$(SV_OBJDIR)/nodes.o \
$(SV_OBJDIR)/observer.o \
$(SV_OBJDIR)/pathcorner.o \
$(SV_OBJDIR)/plane.o \
$(SV_OBJDIR)/plats.o \
$(SV_OBJDIR)/player.o \
$(SV_OBJDIR)/pm_debug.o \
$(SV_OBJDIR)/pm_math.o \
$(SV_OBJDIR)/pm_shared.o \
$(SV_OBJDIR)/schedule.o \
$(SV_OBJDIR)/scripted.o \
$(SV_OBJDIR)/skill.o \
$(SV_OBJDIR)/sound.o \
$(SV_OBJDIR)/soundent.o \
$(SV_OBJDIR)/spectator.o \
$(SV_OBJDIR)/subs.o \
$(SV_OBJDIR)/thewastes.o \
$(SV_OBJDIR)/triggers.o \
$(SV_OBJDIR)/turret.o \
$(SV_OBJDIR)/tw_akimbos.o \
$(SV_OBJDIR)/tw_automatics.o \
$(SV_OBJDIR)/tw_explosives.o \
$(SV_OBJDIR)/tw_melee.o \
$(SV_OBJDIR)/tw_shotguns.o \
$(SV_OBJDIR)/tw_sidearms.o \
$(SV_OBJDIR)/util.o \
$(SV_OBJDIR)/voice_gamemgr.o \
$(SV_OBJDIR)/weapons.o \
$(SV_OBJDIR)/world.o
thewastes.dll :
@-mkdir -p $(SV_OBJDIR)
$(MAKE) $(SVDLL_OBJS)
$(CXX) $(CFLAGS) $(SVDLL_LDFLAGS) -o $@ $(SVDLL_OBJS)
$(SV_OBJDIR)/animating.o : $(SV_SRCDIR)/animating.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/animation.o : $(SV_SRCDIR)/animation.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/bmodels.o : $(SV_SRCDIR)/bmodels.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/buttons.o : $(SV_SRCDIR)/buttons.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/cbase.o : $(SV_SRCDIR)/cbase.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/client.o : $(SV_SRCDIR)/client.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/combat.o : $(SV_SRCDIR)/combat.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/doors.o : $(SV_SRCDIR)/doors.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/effects.o : $(SV_SRCDIR)/effects.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/explode.o : $(SV_SRCDIR)/explode.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/func_break.o : $(SV_SRCDIR)/func_break.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/func_tank.o : $(SV_SRCDIR)/func_tank.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game.o : $(SV_SRCDIR)/game.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_deathmatch.o : $(SV_SRCDIR)/game_deathmatch.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_lastmanstanding.o : $(SV_SRCDIR)/game_lastmanstanding.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_singleplay.o : $(SV_SRCDIR)/game_singleplay.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/game_teamplay.o : $(SV_SRCDIR)/game_teamplay.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/gamerules.o : $(SV_SRCDIR)/gamerules.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/ggrenade.o : $(SV_SRCDIR)/ggrenade.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/globals.o : $(SV_SRCDIR)/globals.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/h_ai.o : $(SV_SRCDIR)/h_ai.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/h_cycler.o : $(SV_SRCDIR)/h_cycler.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/h_export.o : $(SV_SRCDIR)/h_export.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/items.o : $(SV_SRCDIR)/items.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/lights.o : $(SV_SRCDIR)/lights.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/maprules.o : $(SV_SRCDIR)/maprules.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/monsters.o : $(SV_SRCDIR)/monsters.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/mortar.o : $(SV_SRCDIR)/mortar.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/nodes.o : $(SV_SRCDIR)/nodes.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/observer.o : $(SV_SRCDIR)/observer.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/pathcorner.o : $(SV_SRCDIR)/pathcorner.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/plane.o : $(SV_SRCDIR)/plane.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/plats.o : $(SV_SRCDIR)/plats.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/player.o : $(SV_SRCDIR)/player.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/pm_debug.o : $(SV_SRCDIR)/../pm_shared/pm_debug.c
$(DO_SVDLL_CC)
$(SV_OBJDIR)/pm_math.o : $(SV_SRCDIR)/../pm_shared/pm_math.c
$(DO_SVDLL_CC)
$(SV_OBJDIR)/pm_shared.o : $(SV_SRCDIR)/../pm_shared/pm_shared.c
$(DO_SVDLL_CC)
$(SV_OBJDIR)/schedule.o : $(SV_SRCDIR)/schedule.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/scripted.o : $(SV_SRCDIR)/scripted.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/skill.o : $(SV_SRCDIR)/skill.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/sound.o : $(SV_SRCDIR)/sound.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/soundent.o : $(SV_SRCDIR)/soundent.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/spectator.o : $(SV_SRCDIR)/spectator.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/subs.o : $(SV_SRCDIR)/subs.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/thewastes.o : $(SV_SRCDIR)/thewastes.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/triggers.o : $(SV_SRCDIR)/triggers.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/turret.o : $(SV_SRCDIR)/turret.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_akimbos.o : $(SV_SRCDIR)/wpn_shared/tw_akimbos.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_automatics.o : $(SV_SRCDIR)/wpn_shared/tw_automatics.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_explosives.o : $(SV_SRCDIR)/wpn_shared/tw_explosives.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_melee.o : $(SV_SRCDIR)/wpn_shared/tw_melee.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_shotguns.o : $(SV_SRCDIR)/wpn_shared/tw_shotguns.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/tw_sidearms.o : $(SV_SRCDIR)/wpn_shared/tw_sidearms.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/util.o : $(SV_SRCDIR)/util.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/voice_gamemgr.o : $(SV_SRCDIR)/../game_shared/voice_gamemgr.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/weapons.o : $(SV_SRCDIR)/weapons.cpp
$(DO_SVDLL_CXX)
$(SV_OBJDIR)/world.o : $(SV_SRCDIR)/world.cpp
$(DO_SVDLL_CXX)
clean:
rm -v $(SVDLL_OBJS)
rm -v thewastes.dll

View file

@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
############################################################################### ###############################################################################
Project: "cl_dll"="..\cl_dll\cl_dll.dsp" - Package Owner=<4> Project: "cl_dll"=..\cl_dll\cl_dll.dsp - Package Owner=<4>
Package=<5> Package=<5>
{{{ {{{
@ -15,7 +15,7 @@ Package=<4>
############################################################################### ###############################################################################
Project: "hl"="..\dlls\hl.dsp" - Package Owner=<4> Project: "hl"=..\dlls\hl.dsp - Package Owner=<4>
Package=<5> Package=<5>
{{{ {{{
@ -23,9 +23,6 @@ Package=<5>
Package=<4> Package=<4>
{{{ {{{
Begin Project Dependency
Project_Dep_Name cl_dll
End Project Dependency
}}} }}}
############################################################################### ###############################################################################

236
wscript
View file

@ -1,236 +0,0 @@
#! /usr/bin/env python
# encoding: utf-8
# a1batross, mittorn, 2018
from waflib import Build, Configure, Context, Logs
import sys
import os
import re
VERSION = '2.4'
APPNAME = 'hlsdk-portable'
top = '.'
default_prefix = '/'
Context.Context.line_just = 60 # should fit for everything on 80x26
@Configure.conf
def get_taskgen_count(self):
try: idx = self.tg_idx_count
except: idx = 0 # don't set tg_idx_count to not increase counter
return idx
def options(opt):
opt.load('reconfigure compiler_optimizations xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install msdev msvs msvc subproject')
grp = opt.add_option_group('Common options')
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]')
grp.add_option('--disable-werror', action = 'store_true', dest = 'DISABLE_WERROR', default = False,
help = 'disable compilation abort on warning')
opt.add_subproject('dlls')
opt.add_subproject('cl_dll')
def configure(conf):
conf.load('fwgslib reconfigure compiler_optimizations')
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
# Force XP compatibility, all build targets should add subsystem=bld.env.MSVC_SUBSYSTEM
if conf.env.MSVC_TARGETS[0] == 'x86':
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
else:
conf.env.MSVC_SUBSYSTEM = 'WINDOWS'
# Load compilers early
conf.load('xcompile compiler_c compiler_cxx')
# HACKHACK: override msvc DEST_CPU value by something that we understand
if conf.env.DEST_CPU == 'amd64':
conf.env.DEST_CPU = 'x86_64'
if conf.env.COMPILER_CC == 'msvc':
conf.load('msvc_pdb')
conf.load('msvs msdev subproject clang_compilation_database strip_on_install enforce_pic')
enforce_pic = True # modern defaults
conf.check_pic(enforce_pic)
# We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture
# Because compatibility with original GoldSrc
if conf.env.DEST_OS in ['win32', 'linux', 'darwin'] and conf.env.DEST_CPU == 'x86_64':
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64
if conf.env.BIT32_MANDATORY:
Logs.info('WARNING: will build game for 32-bit target')
else:
conf.env.BIT32_MANDATORY = False
conf.load('force_32bit')
cflags, linkflags = conf.get_optimization_flags()
cxxflags = list(cflags) # optimization flags are common between C and C++ but we need a copy
if conf.env.COMPILER_CC != 'msvc':
cxxflags += ['-std=c++98']
# on the Switch, allow undefined symbols by default, which is needed for libsolder to work
# we'll specifically disallow them for the engine executable
# additionally, shared libs are linked without standard libs, we'll add those back in the engine wscript
if conf.env.DEST_OS == 'nswitch':
linkflags.remove('-Wl,--no-undefined')
conf.env.append_unique('LINKFLAGS_cshlib', ['-nostdlib', '-nostartfiles'])
conf.env.append_unique('LINKFLAGS_cxxshlib', ['-nostdlib', '-nostartfiles'])
# same on the vita
elif conf.env.DEST_OS == 'psvita':
conf.env.append_unique('CFLAGS_cshlib', ['-fPIC'])
conf.env.append_unique('CXXFLAGS_cxxshlib', ['-fPIC', '-fno-use-cxa-atexit'])
conf.env.append_unique('LINKFLAGS_cshlib', ['-nostdlib', '-Wl,--unresolved-symbols=ignore-all'])
conf.env.append_unique('LINKFLAGS_cxxshlib', ['-nostdlib', '-Wl,--unresolved-symbols=ignore-all'])
# check if we need to use irix linkflags
elif conf.env.DEST_OS == 'irix' and conf.env.COMPILER_CC == 'gcc':
linkflags.remove('-Wl,--no-undefined')
linkflags.append('-Wl,--unresolved-symbols=ignore-all')
# check if we're in a sgug environment
if 'sgug' in os.environ['LD_LIBRARYN32_PATH']:
linkflags.append('-lc')
conf.check_cc(cflags=cflags, linkflags=linkflags, msg='Checking for required C flags')
conf.check_cxx(cxxflags=cxxflags, linkflags=linkflags, msg='Checking for required C++ flags')
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
conf.env.append_unique('LINKFLAGS', linkflags)
if conf.env.COMPILER_CC != 'msvc' and not conf.options.DISABLE_WERROR:
opt_flags = [
# '-Wall', '-Wextra', '-Wpedantic',
'-fdiagnostics-color=always',
# stable diagnostics, forced to error, sorted
'-Werror=bool-compare',
'-Werror=bool-operation',
'-Werror=cast-align=strict',
'-Werror=duplicated-cond',
# '-Werror=format=2',
# '-Werror=implicit-fallthrough=2',
# '-Werror=logical-op',
'-Werror=packed',
'-Werror=packed-not-aligned',
'-Werror=parentheses',
'-Werror=return-type',
'-Werror=sequence-point',
'-Werror=sizeof-pointer-memaccess',
'-Werror=sizeof-array-div',
'-Werror=sizeof-pointer-div',
# '-Werror=strict-aliasing',
'-Werror=string-compare',
'-Werror=tautological-compare',
'-Werror=use-after-free=3',
'-Werror=vla',
'-Werror=write-strings',
# unstable diagnostics, may cause false positives
'-Winit-self',
'-Wmisleading-indentation',
'-Wunintialized',
# disabled, flood
# '-Wdouble-promotion',
]
opt_cflags = [
'-Werror=declaration-after-statement',
'-Werror=enum-conversion',
'-Werror=implicit-int',
'-Werror=implicit-function-declaration',
'-Werror=incompatible-pointer-types',
'-Werror=int-conversion',
'-Werror=jump-misses-init',
# '-Werror=old-style-declaration',
# '-Werror=old-style-definition',
# '-Werror=strict-prototypes',
'-fnonconst-initializers' # owcc
]
opt_cxxflags = [] # TODO:
cflags = conf.filter_cflags(opt_flags + opt_cflags, cflags)
cxxflags = conf.filter_cxxflags(opt_flags + opt_cxxflags, cxxflags)
conf.env.append_unique('CFLAGS', cflags)
conf.env.append_unique('CXXFLAGS', cxxflags)
if conf.env.DEST_OS == 'android':
# LIB_M added in xcompile!
pass
elif conf.env.DEST_OS == 'win32':
a = [ 'user32', 'winmm' ]
if conf.env.COMPILER_CC == 'msvc':
for i in a:
conf.start_msg('Checking for MSVC library')
conf.check_lib_msvc(i)
conf.end_msg(i)
else:
for i in a:
conf.check_cc(lib = i)
else:
if conf.env.GOLDSOURCE_SUPPORT:
conf.check_cc(lib='dl')
conf.check_cc(lib='m')
if conf.env.COMPILER_CC == 'msvc':
conf.define('_CRT_SECURE_NO_WARNINGS', True)
conf.define('_CRT_NONSTDC_NO_DEPRECATE', True)
elif conf.env.COMPILER_CC == 'owcc':
pass
else:
conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof'])
conf.define('stricmp', 'strcasecmp', quote=False)
conf.define('strnicmp', 'strncasecmp', quote=False)
conf.define('_snprintf', 'snprintf', quote=False)
conf.define('_vsnprintf', 'vsnprintf', quote=False)
conf.define('_LINUX', True)
conf.define('LINUX', True)
conf.msg(msg='-> processing mod options', result='...', color='BLUE')
regex = re.compile('^([A-Za-z0-9_]+)=([A-Za-z0-9_]+)\ \#\ (.*)$')
with open('mod_options.txt') as fd:
lines = fd.readlines()
for line in lines:
m = regex.match(line.strip())
if m:
p = m.groups()
conf.start_msg("* " + p[2])
if p[1] == 'ON':
conf.env[p[0]] = True
conf.define(p[0], 1)
elif p[1] == 'OFF':
conf.env[p[0]] = False
conf.undefine(p[0])
else:
conf.env[p[0]] = p[1]
conf.end_msg(p[1])
if conf.env.HLDEMO_BUILD and conf.env.OEM_BUILD:
conf.fatal('Don\'t mix Demo and OEM builds!')
# strip lib from pattern
if conf.env.DEST_OS not in ['android']:
if conf.env.cxxshlib_PATTERN.startswith('lib'):
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
conf.load('library_naming')
conf.add_subproject('dlls')
conf.add_subproject('cl_dll')
def build(bld):
if bld.is_install and not bld.options.destdir:
bld.fatal('Set the install destination directory using --destdir option')
# don't clean QtCreator files and reconfigure saved options
bld.clean_files = bld.bldnode.ant_glob('**',
excl='*.user configuration.py .lock* *conf_check_*/** config.log %s/*' % Build.CACHE_DIR,
quiet=True, generator=True)
bld.add_subproject('dlls')
bld.add_subproject('cl_dll')