Don't require the hl2sdk to build.

This commit is contained in:
Asher Baker
2013-05-17 05:24:31 +01:00
parent 27dcd22166
commit d736010d3b
6 changed files with 35 additions and 244 deletions
+20 -16
View File
@@ -4,23 +4,24 @@ import ambuild.osutil as osutil
from ambuild.command import SymlinkCommand
from ambuild.command import ShellCommand
def BuildBreakpad():
breakpad = AMBuild.AddJob('google-breakpad')
def BuildEverything():
if AMBuild.target['platform'] not in ['linux']:
return
BuildBreakpad()
BuildExtension();
def BuildBreakpad():
breakpad = AMBuild.AddJob('google-breakpad')
if osutil.FileExists(os.path.join(AMBuild.outputFolder, 'google-breakpad', 'src', 'client', 'linux', 'libbreakpad_client.a')):
return
breakpad.AddCommand(ShellCommand('CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS=-m32 ' + os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'configure')))
breakpad.AddCommand(ShellCommand('make src/client/linux/libbreakpad_client.a'))
BuildBreakpad()
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
if AMBuild.target['platform'] not in sdk['platform']:
continue
compiler = SM.DefaultHL2Compiler('extension', i)
def BuildExtension():
compiler = SM.DefaultCompiler()
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension', 'sdk'))
@@ -31,16 +32,18 @@ for i in SM.sdkInfo:
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'google-breakpad', 'src'))
name = 'accelerator.ext.' + sdk['ext']
compiler['POSTLINKFLAGS'].append('-lstdc++')
compiler['POSTLINKFLAGS'].append('-pthread')
name = 'accelerator.ext'
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
binary.AddSourceFiles('extension', [
'extension.cpp',
'MemoryDownloader.cpp',
'sdk/smsdk_ext.cpp'
])
SM.PostSetupHL2Job(extension, binary, i)
])
link = os.path.join(AMBuild.outputFolder, extension.workFolder, 'libbreakpad_client.a')
target = os.path.join(AMBuild.outputFolder, 'google-breakpad', 'src', 'client', 'linux', 'libbreakpad_client.a')
@@ -48,10 +51,11 @@ for i in SM.sdkInfo:
os.lstat(link)
except:
extension.AddCommand(SymlinkCommand(link, target))
binary.AddObjectFiles(['libbreakpad_client.a'])
binary.AddObjectFiles(['libbreakpad_client.a'])
SM.AutoVersion('extension', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
BuildEverything()
+4 -27
View File
@@ -34,8 +34,6 @@ SMEXT_LINK(&g_accelerator);
IWebternet *webternet;
static IThreadHandle *uploadThread;
ConVar acceleratorVersion("accelerator_version", SMEXT_CONF_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, SMEXT_CONF_DESCRIPTION " Version");
char buffer[255];
google_breakpad::ExceptionHandler *handler = NULL;
@@ -101,10 +99,10 @@ void UploadCrashDump(const char *path)
if (!xfer->PostAndDownload("http://crash.limetech.org/submit", form, &data, NULL))
{
META_CONPRINTF(">>> UPLOAD FAILED\n");
printf(">>> UPLOAD FAILED\n");
} else {
META_CONPRINTF(">>> UPLOADED CRASH DUMP");
META_CONPRINTF("%s", data.GetBuffer());
printf(">>> UPLOADED CRASH DUMP");
printf("%s", data.GetBuffer());
}
}
@@ -120,7 +118,7 @@ void Accelerator::OnCoreMapStart(edict_t *pEdictList, int edictCount, int client
if (dump->d_type == DT_DIR)
continue;
META_CONPRINTF(">>> UPLOADING %s\n", dump->d_name);
printf(">>> UPLOADING %s\n", dump->d_name);
g_pSM->Format(path, sizeof(path), "%s/%s", buffer, dump->d_name);
@@ -150,29 +148,8 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late)
return true;
}
bool Accelerator::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
GET_V_IFACE_CURRENT(GetEngineFactory, g_pCVar, ICvar, CVAR_INTERFACE_VERSION);
ConVar_Register(0, this);
return true;
}
void Accelerator::SDK_OnUnload()
{
g_pSM->RemoveGameFrameHook(OnGameFrame);
}
bool Accelerator::SDK_OnMetamodUnload(char *error, size_t maxlen)
{
return true;
}
bool Accelerator::RegisterConCommandBase(ConCommandBase *pCommand)
{
META_REGCVAR(pCommand);
return true;
}
+5 -7
View File
@@ -1,7 +1,7 @@
/**
* =============================================================================
* TF2 Items Extension
* Copyright (C) 2009-2010 AzuiSleet, Asher Baker (asherkin). All rights reserved.
* Accelerator Extension
* Copyright (C) 2009-2010 Asher Baker (asherkin). All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -32,7 +32,7 @@
* @brief Sample implementation of the SDK Extension.
* Note: Uncomment one of the pre-defined virtual functions in order to use it.
*/
class Accelerator : public SDKExtension, public IConCommandBaseAccessor
class Accelerator : public SDKExtension
{
public:
/**
@@ -73,7 +73,7 @@ public:
* @param late Whether or not Metamod considers this a late load.
* @return True to succeed, false to fail.
*/
virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);
//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);
/**
* @brief Called when Metamod is detaching, after the extension version is called.
@@ -83,7 +83,7 @@ public:
* @param maxlength Maximum size of error buffer.
* @return True to succeed, false to fail.
*/
virtual bool SDK_OnMetamodUnload(char *error, size_t maxlen);
//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlen);
/**
* @brief Called when Metamod's pause state is changing.
@@ -97,8 +97,6 @@ public:
//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlen);
#endif
virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
public: //IConCommandBaseAccessor
bool RegisterConCommandBase(ConCommandBase *pCommand);
};
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
+3 -3
View File
@@ -1,6 +1,6 @@
/**
* =============================================================================
* connect Extension
* Accelerator Extension
* Copyright (C) 2011 Asher Baker (asherkin). All rights reserved.
* =============================================================================
*
@@ -55,7 +55,7 @@
* @brief Sets whether or not this plugin required Metamod.
* NOTE: Uncomment to enable, comment to disable.
*/
#define SMEXT_CONF_METAMOD
//#define SMEXT_CONF_METAMOD
/** Enable interfaces you want to use here by uncommenting lines */
//#define SMEXT_ENABLE_FORWARDSYS
@@ -67,7 +67,7 @@
//#define SMEXT_ENABLE_GAMEHELPERS
//#define SMEXT_ENABLE_TIMERSYS
#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_LIBSYS
#define SMEXT_ENABLE_LIBSYS
//#define SMEXT_ENABLE_MENUS
//#define SMEXT_ENABLE_ADTFACTORY
//#define SMEXT_ENABLE_PLUGINSYS