fix: only compile protobuf for csgo

This commit is contained in:
maxime1907 2022-07-18 18:40:44 +02:00
parent 0297aa0359
commit a02cb7e1d3
5 changed files with 27 additions and 23 deletions

View File

@ -1,6 +1,7 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
import traceback
import subprocess
class SDK(object):
def __init__(self, sdk, ext, aDef, name, platform, dir):
@ -184,6 +185,13 @@ class ExtensionConfig(object):
raise Exception('Could not find a source copy of Metamod:Source')
self.mms_root = Normalize(self.mms_root)
# Run protobuf compilation and copy files to corresponding folders
if 'csgo' in self.sdks:
os.chdir("../pb/")
os.chmod('./build_protobuf.sh', 0o755)
subprocess.call("./build_protobuf.sh")
def configure(self):
if not set(self.target_archs).issubset(['x86', 'x86_64']):
raise Exception('Unknown target architecture: {0}'.format(self.target_archs))
@ -207,7 +215,7 @@ class ExtensionConfig(object):
elif cxx.family == 'msvc':
self.configure_msvc(cxx)
# Optimizaiton
# Optimization
if builder.options.opt == '1':
cxx.defines += ['NDEBUG']

View File

@ -23,24 +23,9 @@ for cxx in builder.targets:
binary.compiler.cflags += ['-Wno-deprecated-declarations']
binary.compiler.postlink += ['-framework', 'CoreServices']
# if cxx.family == 'gcc' or cxx.family == 'clang':
# binary.compiler.cxxflags += ['-fno-rtti']
# elif cxx.family == 'msvc':
# binary.compiler.cxxflags += ['/GR-']
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'pb', 'include'),
]
binary.compiler.postlink += [
'-L' + os.path.join(builder.sourcePath, 'pb', 'lib'),
'-lprotobuf'
]
binary.sources += [
'extension.cpp',
'ringbuffer.cpp',
os.path.join(builder.sourcePath, 'pb', 'csgo', 'netmessages.pb.cc'),
# os.path.join(builder.sourcePath, 'pb', 'google', 'protobuf', 'descriptor.pb.cc'),
os.path.join(SM.sm_root, 'extensions', 'sm-ext-common', 'mathstubs.c'),
os.path.join(SM.sm_root, 'public', 'smsdk_ext.cpp'),
os.path.join(SM.sm_root, 'public', 'CDetour', 'detours.cpp'),
@ -53,6 +38,19 @@ for cxx in builder.targets:
os.path.join(SM.sm_root, 'public', 'libudis86', 'udis86.c'),
]
if sdk.name in ['csgo']:
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'pb', 'include'),
]
binary.compiler.postlink += [
'-L' + os.path.join(builder.sourcePath, 'pb', 'lib'),
'-lprotobuf'
]
binary.sources += [
os.path.join(builder.sourcePath, 'pb', 'csgo', 'netmessages.pb.cc'),
]
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'celt')
]

View File

@ -1,7 +1,5 @@
# vim: set ts=2 sw=2 tw=99 noet:
import sys
import os
import subprocess
try:
from ambuild2 import run, util
except:
@ -39,8 +37,3 @@ parser.options.add_argument('--targets', type=str, dest='targets', default=None,
help="Override the target architecture (use commas to separate multiple targets).")
parser.Configure()
# Run protobuf compilation and copy files to corresponding folders
os.chdir("../pb/")
os.chmod('./build_protobuf.sh', 0o755)
subprocess.call("./build_protobuf.sh")

View File

@ -153,6 +153,7 @@ std::string hex_to_string(const std::string& input)
return output;
}
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_INSURGENCY
void PrintCCLCMsg_VoiceData(const char *funcName, int client, const CCLCMsg_VoiceData &msg, bool drop)
{
g_pSM->LogMessage(myself, "===START=======%s=============", funcName);
@ -193,6 +194,7 @@ DETOUR_DECL_STATIC3(SV_BroadcastVoiceData_CSGO, int, IClient *, pClient, const C
// bool CGameClient::CLCMsg_VoiceData( const CCLCMsg_VoiceData& msg ) so wtf ???
return 1;
}
#endif
DETOUR_DECL_STATIC4(SV_BroadcastVoiceData, void, IClient *, pClient, int, nBytes, char *, data, int64, xuid)
{

View File

@ -36,7 +36,10 @@
#include "smsdk_ext.h"
#include "celt_header.h"
#include "ringbuffer.h"
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_INSURGENCY
#include "pb/csgo/netmessages.pb.h"
#endif
/**
* @file extension.h