mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-07 18:38:30 +00:00
Extract version info into a static library to speed up builds (bug 5990, r=ds).
This commit is contained in:
parent
776a99071e
commit
e936018602
@ -63,6 +63,7 @@ class MMSConfig(object):
|
|||||||
self.sdks = {}
|
self.sdks = {}
|
||||||
self.binaries = []
|
self.binaries = []
|
||||||
self.generated_headers = None
|
self.generated_headers = None
|
||||||
|
self.versionlib = None
|
||||||
|
|
||||||
def detectProductVersion(self):
|
def detectProductVersion(self):
|
||||||
builder.AddConfigureFile('product.version')
|
builder.AddConfigureFile('product.version')
|
||||||
@ -214,6 +215,7 @@ class MMSConfig(object):
|
|||||||
# Finish up.
|
# Finish up.
|
||||||
cfg.defines += ['MMS_GENERATED_BUILD']
|
cfg.defines += ['MMS_GENERATED_BUILD']
|
||||||
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
|
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
|
||||||
|
cfg.includes += [os.path.join(builder.sourcePath, 'versionlib')]
|
||||||
cfg.cxxincludes += [os.path.join(builder.sourcePath, 'public')]
|
cfg.cxxincludes += [os.path.join(builder.sourcePath, 'public')]
|
||||||
|
|
||||||
def HL2Compiler(self, context, sdk):
|
def HL2Compiler(self, context, sdk):
|
||||||
@ -276,6 +278,7 @@ class MMSConfig(object):
|
|||||||
'-compatibility_version', '1.0.0',
|
'-compatibility_version', '1.0.0',
|
||||||
'-current_version', self.productVersion
|
'-current_version', self.productVersion
|
||||||
]
|
]
|
||||||
|
binary.compiler.linkflags += [self.versionlib]
|
||||||
binary.compiler.sourcedeps += MMS.generated_headers
|
binary.compiler.sourcedeps += MMS.generated_headers
|
||||||
return binary
|
return binary
|
||||||
|
|
||||||
@ -354,6 +357,10 @@ MMS.generated_headers = builder.RunScript(
|
|||||||
'support/buildbot/Versioning',
|
'support/buildbot/Versioning',
|
||||||
{ 'MMS': MMS }
|
{ 'MMS': MMS }
|
||||||
)
|
)
|
||||||
|
MMS.versionlib = builder.RunScript(
|
||||||
|
'versionlib/AMBuildScript',
|
||||||
|
{ 'MMS': MMS }
|
||||||
|
)
|
||||||
|
|
||||||
builder.RunBuildScripts(
|
builder.RunBuildScripts(
|
||||||
[
|
[
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
#include "sh_string.h"
|
#include "sh_string.h"
|
||||||
#include "sh_list.h"
|
#include "sh_list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include <versionlib.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Console Command Implementations
|
* @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
|
#ifdef OS_WIN32
|
||||||
ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
|
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");
|
ConVar mm_basedir("mm_basedir", "addons\\metamod", FCVAR_SPONLY, "Metamod:Source base folder");
|
||||||
@ -140,8 +141,8 @@ CON_COMMAND(meta, "Metamod:Source Menu")
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(command, "version") == 0) {
|
} else if (strcmp(command, "version") == 0) {
|
||||||
CONMSG("Metamod:Source version %s\n", MMS_FULL_VERSION);
|
CONMSG("Metamod:Source version %s\n", METAMOD_VERSION);
|
||||||
CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
|
CONMSG("Build ID: %s\n", METAMOD_BUILD_ID);
|
||||||
if (g_GameDll.loaded)
|
if (g_GameDll.loaded)
|
||||||
{
|
{
|
||||||
CONMSG("Loaded As: GameDLL (gameinfo.txt)\n");
|
CONMSG("Loaded As: GameDLL (gameinfo.txt)\n");
|
||||||
@ -644,7 +645,7 @@ void ClientCommand_handler(edict_t *client)
|
|||||||
|
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if(strcmp(subcmd, "version") == 0) {
|
} 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, "Compiled on: %s\n", SOURCEMM_DATE);
|
||||||
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
|
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());
|
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];
|
char buffer[255], error[255], full_path[PATH_SIZE];
|
||||||
const char *ptr, *ext, *file;
|
const char *file;
|
||||||
size_t length;
|
size_t length;
|
||||||
while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
|
while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,7 +23,6 @@
|
|||||||
#include "ISmmAPI.h"
|
#include "ISmmAPI.h"
|
||||||
#include "CPlugin.h"
|
#include "CPlugin.h"
|
||||||
#include "oslink.h"
|
#include "oslink.h"
|
||||||
#include <metamod_version.h>
|
|
||||||
#include "loader_bridge.h"
|
#include "loader_bridge.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -28,13 +28,15 @@
|
|||||||
#include "concommands.h"
|
#include "concommands.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <loader_bridge.h>
|
#include <loader_bridge.h>
|
||||||
|
#include <sh_string.h>
|
||||||
|
#include <versionlib.h>
|
||||||
|
|
||||||
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
|
|
||||||
ConCommand *g_plugin_unload = NULL;
|
ConCommand *g_plugin_unload = NULL;
|
||||||
bool g_bIsTryingToUnload;
|
bool g_bIsTryingToUnload;
|
||||||
bool g_bIsBridgedAsVsp;
|
bool g_bIsBridgedAsVsp;
|
||||||
const char *vsp_desc = "Metamod:Source " MMS_FULL_VERSION;
|
SourceHook::String vsp_desc("Metamod:Source");
|
||||||
|
|
||||||
void InterceptPluginUnloads()
|
void InterceptPluginUnloads()
|
||||||
{
|
{
|
||||||
@ -54,6 +56,9 @@ class VspBridge : public IVspBridge
|
|||||||
|
|
||||||
if (!g_GameDll.loaded)
|
if (!g_GameDll.loaded)
|
||||||
{
|
{
|
||||||
|
vsp_desc.append(" ");
|
||||||
|
vsp_desc.append(METAMOD_VERSION);
|
||||||
|
|
||||||
CreateInterfaceFn engineFactory = (CreateInterfaceFn)info->engineFactory;
|
CreateInterfaceFn engineFactory = (CreateInterfaceFn)info->engineFactory;
|
||||||
CreateInterfaceFn gsFactory = (CreateInterfaceFn)info->gsFactory;
|
CreateInterfaceFn gsFactory = (CreateInterfaceFn)info->gsFactory;
|
||||||
|
|
||||||
@ -68,7 +73,8 @@ class VspBridge : public IVspBridge
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vsp_desc = "Metamod:Source Interface " MMS_FULL_VERSION;
|
vsp_desc.append(" Interface ");
|
||||||
|
vsp_desc.append(METAMOD_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConCommandBase *pBase = g_Engine.icvar->GetCommands();
|
ConCommandBase *pBase = g_Engine.icvar->GetCommands();
|
||||||
@ -119,7 +125,7 @@ class VspBridge : public IVspBridge
|
|||||||
|
|
||||||
virtual const char *GetDescription()
|
virtual const char *GetDescription()
|
||||||
{
|
{
|
||||||
return vsp_desc;
|
return vsp_desc.c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
#include "metamod.h"
|
#include "metamod.h"
|
||||||
#include <interface.h>
|
#include <interface.h>
|
||||||
#include <eiface.h>
|
#include <eiface.h>
|
||||||
|
#include <versionlib.h>
|
||||||
#include "metamod_provider.h"
|
#include "metamod_provider.h"
|
||||||
#include "metamod_plugins.h"
|
#include "metamod_plugins.h"
|
||||||
#include "metamod_util.h"
|
#include "metamod_util.h"
|
||||||
@ -430,11 +431,11 @@ mm_StartupMetamod(bool is_vsp_load)
|
|||||||
UTIL_Format(buffer,
|
UTIL_Format(buffer,
|
||||||
sizeof(buffer),
|
sizeof(buffer),
|
||||||
"%s%s",
|
"%s%s",
|
||||||
MMS_FULL_VERSION,
|
METAMOD_VERSION,
|
||||||
is_vsp_load ? "V" : "");
|
is_vsp_load ? "V" : "");
|
||||||
|
|
||||||
metamod_version = provider->CreateConVar("metamod_version",
|
metamod_version = provider->CreateConVar("metamod_version",
|
||||||
MMS_FULL_VERSION,
|
METAMOD_VERSION,
|
||||||
"Metamod:Source Version",
|
"Metamod:Source Version",
|
||||||
ConVarFlag_Notify|ConVarFlag_SpOnly);
|
ConVarFlag_Notify|ConVarFlag_SpOnly);
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@
|
|||||||
#include <sourcehook/sourcehook.h>
|
#include <sourcehook/sourcehook.h>
|
||||||
#include <ISmmPlugin.h>
|
#include <ISmmPlugin.h>
|
||||||
#include "metamod_provider.h"
|
#include "metamod_provider.h"
|
||||||
#include <metamod_version.h>
|
|
||||||
|
|
||||||
using namespace SourceMM;
|
using namespace SourceMM;
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "metamod_oslink.h"
|
#include "metamod_oslink.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <versionlib.h>
|
||||||
#include "metamod.h"
|
#include "metamod.h"
|
||||||
#include "metamod_util.h"
|
#include "metamod_util.h"
|
||||||
#include "metamod_console.h"
|
#include "metamod_console.h"
|
||||||
@ -68,8 +69,8 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
|
|||||||
}
|
}
|
||||||
else if (strcmp(command, "version") == 0)
|
else if (strcmp(command, "version") == 0)
|
||||||
{
|
{
|
||||||
CONMSG("Metamod:Source version %s\n", MMS_FULL_VERSION);
|
CONMSG("Metamod:Source version %s\n", METAMOD_VERSION);
|
||||||
CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
|
CONMSG("Build ID: %s\n", METAMOD_BUILD_ID);
|
||||||
|
|
||||||
if (g_Metamod.IsLoadedAsGameDLL())
|
if (g_Metamod.IsLoadedAsGameDLL())
|
||||||
{
|
{
|
||||||
@ -699,7 +700,7 @@ bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)
|
|||||||
}
|
}
|
||||||
else if(strcmp(subcmd, "version") == 0)
|
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, "Compiled on: %s\n", SOURCEMM_DATE);
|
||||||
CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
|
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());
|
CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
|
||||||
|
|||||||
@ -30,6 +30,8 @@
|
|||||||
#include <iplayerinfo.h>
|
#include <iplayerinfo.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <loader_bridge.h>
|
#include <loader_bridge.h>
|
||||||
|
#include <versionlib.h>
|
||||||
|
#include <sh_string.h>
|
||||||
#include "provider/provider_ep2.h"
|
#include "provider/provider_ep2.h"
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_DOTA
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
@ -42,7 +44,7 @@ SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
|||||||
|
|
||||||
ConCommand *g_plugin_unload = NULL;
|
ConCommand *g_plugin_unload = NULL;
|
||||||
bool g_bIsTryingToUnload;
|
bool g_bIsTryingToUnload;
|
||||||
const char *vsp_desc = "Metamod:Source " MMS_FULL_VERSION;
|
SourceHook::String vsp_desc("Metamod:Source");
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_DOTA
|
#if SOURCE_ENGINE == SE_DOTA
|
||||||
void InterceptPluginUnloads(const CCommandContext &context, const CCommand &args)
|
void InterceptPluginUnloads(const CCommandContext &context, const CCommand &args)
|
||||||
@ -73,6 +75,9 @@ public:
|
|||||||
{
|
{
|
||||||
if (!g_Metamod.IsLoadedAsGameDLL())
|
if (!g_Metamod.IsLoadedAsGameDLL())
|
||||||
{
|
{
|
||||||
|
vsp_desc.append(" ");
|
||||||
|
vsp_desc.append(METAMOD_VERSION);
|
||||||
|
|
||||||
CGlobalVars *pGlobals;
|
CGlobalVars *pGlobals;
|
||||||
IPlayerInfoManager *playerInfoManager;
|
IPlayerInfoManager *playerInfoManager;
|
||||||
|
|
||||||
@ -126,7 +131,9 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
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);
|
g_Metamod.NotifyVSPListening(info->vsp_callbacks, info->vsp_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +182,7 @@ public:
|
|||||||
|
|
||||||
virtual const char *GetDescription()
|
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…
Reference in New Issue
Block a user