mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-30 19:52:17 +01:00
Extract version info into a static library to speed up builds (bug 5990, r=ds).
This commit is contained in:
parent
373a6d617a
commit
f9d3b05fdb
@ -63,6 +63,7 @@ class MMSConfig(object):
|
||||
self.sdks = {}
|
||||
self.binaries = []
|
||||
self.generated_headers = None
|
||||
self.versionlib = None
|
||||
|
||||
def detectProductVersion(self):
|
||||
builder.AddConfigureFile('product.version')
|
||||
@ -214,6 +215,7 @@ class MMSConfig(object):
|
||||
# Finish up.
|
||||
cfg.defines += ['MMS_GENERATED_BUILD']
|
||||
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
|
||||
cfg.includes += [os.path.join(builder.sourcePath, 'versionlib')]
|
||||
cfg.cxxincludes += [os.path.join(builder.sourcePath, 'public')]
|
||||
|
||||
def HL2Compiler(self, context, sdk):
|
||||
@ -276,6 +278,7 @@ class MMSConfig(object):
|
||||
'-compatibility_version', '1.0.0',
|
||||
'-current_version', self.productVersion
|
||||
]
|
||||
binary.compiler.linkflags += [self.versionlib]
|
||||
binary.compiler.sourcedeps += MMS.generated_headers
|
||||
return binary
|
||||
|
||||
@ -354,6 +357,10 @@ MMS.generated_headers = builder.RunScript(
|
||||
'support/buildbot/Versioning',
|
||||
{ 'MMS': MMS }
|
||||
)
|
||||
MMS.versionlib = builder.RunScript(
|
||||
'versionlib/AMBuildScript',
|
||||
{ 'MMS': MMS }
|
||||
)
|
||||
|
||||
builder.RunBuildScripts(
|
||||
[
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "sh_string.h"
|
||||
#include "sh_list.h"
|
||||
#include "util.h"
|
||||
#include <versionlib.h>
|
||||
|
||||
/**
|
||||
* @brief Console Command Implementations
|
||||
@ -105,7 +106,7 @@ void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
|
||||
}
|
||||
}
|
||||
|
||||
ConVar metamod_version("metamod_version", MMS_FULL_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
|
||||
ConVar metamod_version("metamod_version", METAMOD_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
|
||||
#ifdef OS_WIN32
|
||||
ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
|
||||
ConVar mm_basedir("mm_basedir", "addons\\metamod", FCVAR_SPONLY, "Metamod:Source base folder");
|
||||
@ -140,8 +141,8 @@ CON_COMMAND(meta, "Metamod:Source Menu")
|
||||
|
||||
return;
|
||||
} else if (strcmp(command, "version") == 0) {
|
||||
CONMSG("Metamod:Source version %s\n", MMS_FULL_VERSION);
|
||||
CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
|
||||
CONMSG("Metamod:Source version %s\n", METAMOD_VERSION);
|
||||
CONMSG("Build ID: %s\n", METAMOD_BUILD_ID);
|
||||
if (g_GameDll.loaded)
|
||||
{
|
||||
CONMSG("Loaded As: GameDLL (gameinfo.txt)\n");
|
||||
@ -644,7 +645,7 @@ void ClientCommand_handler(edict_t *client)
|
||||
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
} else if(strcmp(subcmd, "version") == 0) {
|
||||
CLIENT_CONMSG(client, "Metamod:Source version %s\n", MMS_FULL_VERSION);
|
||||
CLIENT_CONMSG(client, "Metamod:Source version %s\n", METAMOD_VERSION);
|
||||
CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
|
||||
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
|
||||
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SourceHook.GetIfaceVersion(), g_SourceHook.GetImplVersion());
|
||||
|
@ -475,7 +475,7 @@ int LoadPluginsFromFile(const char *filepath, int &skipped)
|
||||
}
|
||||
|
||||
char buffer[255], error[255], full_path[PATH_SIZE];
|
||||
const char *ptr, *ext, *file;
|
||||
const char *file;
|
||||
size_t length;
|
||||
while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "ISmmAPI.h"
|
||||
#include "CPlugin.h"
|
||||
#include "oslink.h"
|
||||
#include <metamod_version.h>
|
||||
#include "loader_bridge.h"
|
||||
|
||||
/**
|
||||
|
@ -28,13 +28,15 @@
|
||||
#include "concommands.h"
|
||||
#include "util.h"
|
||||
#include <loader_bridge.h>
|
||||
#include <sh_string.h>
|
||||
#include <versionlib.h>
|
||||
|
||||
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
|
||||
ConCommand *g_plugin_unload = NULL;
|
||||
bool g_bIsTryingToUnload;
|
||||
bool g_bIsBridgedAsVsp;
|
||||
const char *vsp_desc = "Metamod:Source " MMS_FULL_VERSION;
|
||||
SourceHook::String vsp_desc("Metamod:Source");
|
||||
|
||||
void InterceptPluginUnloads()
|
||||
{
|
||||
@ -54,6 +56,9 @@ class VspBridge : public IVspBridge
|
||||
|
||||
if (!g_GameDll.loaded)
|
||||
{
|
||||
vsp_desc.append(" ");
|
||||
vsp_desc.append(METAMOD_VERSION);
|
||||
|
||||
CreateInterfaceFn engineFactory = (CreateInterfaceFn)info->engineFactory;
|
||||
CreateInterfaceFn gsFactory = (CreateInterfaceFn)info->gsFactory;
|
||||
|
||||
@ -68,7 +73,8 @@ class VspBridge : public IVspBridge
|
||||
}
|
||||
else
|
||||
{
|
||||
vsp_desc = "Metamod:Source Interface " MMS_FULL_VERSION;
|
||||
vsp_desc.append(" Interface ");
|
||||
vsp_desc.append(METAMOD_VERSION);
|
||||
}
|
||||
|
||||
ConCommandBase *pBase = g_Engine.icvar->GetCommands();
|
||||
@ -119,7 +125,7 @@ class VspBridge : public IVspBridge
|
||||
|
||||
virtual const char *GetDescription()
|
||||
{
|
||||
return vsp_desc;
|
||||
return vsp_desc.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "metamod.h"
|
||||
#include <interface.h>
|
||||
#include <eiface.h>
|
||||
#include <versionlib.h>
|
||||
#include "metamod_provider.h"
|
||||
#include "metamod_plugins.h"
|
||||
#include "metamod_util.h"
|
||||
@ -430,11 +431,11 @@ mm_StartupMetamod(bool is_vsp_load)
|
||||
UTIL_Format(buffer,
|
||||
sizeof(buffer),
|
||||
"%s%s",
|
||||
MMS_FULL_VERSION,
|
||||
METAMOD_VERSION,
|
||||
is_vsp_load ? "V" : "");
|
||||
|
||||
metamod_version = provider->CreateConVar("metamod_version",
|
||||
MMS_FULL_VERSION,
|
||||
METAMOD_VERSION,
|
||||
"Metamod:Source Version",
|
||||
ConVarFlag_Notify|ConVarFlag_SpOnly);
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <sourcehook/sourcehook.h>
|
||||
#include <ISmmPlugin.h>
|
||||
#include "metamod_provider.h"
|
||||
#include <metamod_version.h>
|
||||
|
||||
using namespace SourceMM;
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include "metamod_oslink.h"
|
||||
#include <ctype.h>
|
||||
#include <versionlib.h>
|
||||
#include "metamod.h"
|
||||
#include "metamod_util.h"
|
||||
#include "metamod_console.h"
|
||||
@ -68,8 +69,8 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
|
||||
}
|
||||
else if (strcmp(command, "version") == 0)
|
||||
{
|
||||
CONMSG("Metamod:Source version %s\n", MMS_FULL_VERSION);
|
||||
CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
|
||||
CONMSG("Metamod:Source version %s\n", METAMOD_VERSION);
|
||||
CONMSG("Build ID: %s\n", METAMOD_BUILD_ID);
|
||||
|
||||
if (g_Metamod.IsLoadedAsGameDLL())
|
||||
{
|
||||
@ -699,7 +700,7 @@ bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)
|
||||
}
|
||||
else if(strcmp(subcmd, "version") == 0)
|
||||
{
|
||||
CLIENT_CONMSG(client, "Metamod:Source version %s\n", MMS_FULL_VERSION);
|
||||
CLIENT_CONMSG(client, "Metamod:Source version %s\n", METAMOD_VERSION);
|
||||
CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
|
||||
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
|
||||
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <iplayerinfo.h>
|
||||
#include <assert.h>
|
||||
#include <loader_bridge.h>
|
||||
#include <versionlib.h>
|
||||
#include <sh_string.h>
|
||||
#include "provider/provider_ep2.h"
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
@ -42,7 +44,7 @@ SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
|
||||
ConCommand *g_plugin_unload = NULL;
|
||||
bool g_bIsTryingToUnload;
|
||||
const char *vsp_desc = "Metamod:Source " MMS_FULL_VERSION;
|
||||
SourceHook::String vsp_desc("Metamod:Source");
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void InterceptPluginUnloads(const CCommandContext &context, const CCommand &args)
|
||||
@ -73,6 +75,9 @@ public:
|
||||
{
|
||||
if (!g_Metamod.IsLoadedAsGameDLL())
|
||||
{
|
||||
vsp_desc.append(" ");
|
||||
vsp_desc.append(METAMOD_VERSION);
|
||||
|
||||
CGlobalVars *pGlobals;
|
||||
IPlayerInfoManager *playerInfoManager;
|
||||
|
||||
@ -126,7 +131,9 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
vsp_desc = "Metamod:Source Interface " MMS_FULL_VERSION;
|
||||
vsp_desc.append(" Interface ");
|
||||
vsp_desc.append(METAMOD_VERSION);
|
||||
|
||||
g_Metamod.NotifyVSPListening(info->vsp_callbacks, info->vsp_version);
|
||||
}
|
||||
|
||||
@ -175,7 +182,7 @@ public:
|
||||
|
||||
virtual const char *GetDescription()
|
||||
{
|
||||
return vsp_desc;
|
||||
return vsp_desc.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
11
versionlib/AMBuildScript
Normal file
11
versionlib/AMBuildScript
Normal file
@ -0,0 +1,11 @@
|
||||
# vim: sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
|
||||
lib = builder.compiler.StaticLibrary("version")
|
||||
lib.compiler.sourcedeps += MMS.generated_headers
|
||||
lib.sources += [
|
||||
'versionlib.cpp'
|
||||
]
|
||||
cmd = builder.Add(lib)
|
||||
|
||||
rvalue = cmd.binary
|
||||
|
31
versionlib/versionlib.cpp
Normal file
31
versionlib/versionlib.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* ======================================================
|
||||
* Metamod:Source
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC and authors.
|
||||
* All rights reserved.
|
||||
* ======================================================
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include <metamod_version.h>
|
||||
#include <versionlib.h>
|
||||
|
||||
const char *METAMOD_BUILD_ID = MMS_BUILD_UNIQUEID;
|
||||
const char *METAMOD_VERSION = MMS_FULL_VERSION;
|
||||
|
31
versionlib/versionlib.h
Normal file
31
versionlib/versionlib.h
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* ======================================================
|
||||
* Metamod:Source
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC and authors.
|
||||
* All rights reserved.
|
||||
* ======================================================
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#ifndef _INCLUDE_METAMOD_VERSIONLIB_H_
|
||||
#define _INCLUDE_METAMOD_VERSIONLIB_H_
|
||||
|
||||
extern "C" const char *METAMOD_BUILD_ID;
|
||||
extern "C" const char *METAMOD_VERSION;
|
||||
|
||||
#endif // _INCLUDE_METAMOD_VERSIONLIB_H_
|
Loading…
x
Reference in New Issue
Block a user