1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-26 19:54:14 +01:00

Port S1 tf2/css/dods/hl2dm build fixes from master

(cherry picked from commit e5de18eadd1280502adbeb62edf251c1e0f429c2)
This commit is contained in:
Nicholas Hastings 2025-02-19 21:55:25 -05:00
parent 3e75d43499
commit 52c441eeb2
8 changed files with 50 additions and 11 deletions

View File

@ -191,6 +191,7 @@ class MMSConfig(object):
'-Wall', '-Wall',
'-Werror', '-Werror',
'-Wno-uninitialized', '-Wno-uninitialized',
'-Wno-sign-compare',
'-Wno-unused', '-Wno-unused',
'-Wno-switch', '-Wno-switch',
'-Wno-unknown-pragmas', '-Wno-unknown-pragmas',
@ -209,6 +210,7 @@ class MMSConfig(object):
'-fno-threadsafe-statics', '-fno-threadsafe-statics',
'-Wno-non-virtual-dtor', '-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual', '-Wno-overloaded-virtual',
'-Wno-register',
] ]
if (cxx.version >= 'gcc-4.7' or cxx.family == 'clang'): if (cxx.version >= 'gcc-4.7' or cxx.family == 'clang'):
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor'] cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
@ -284,7 +286,7 @@ class MMSConfig(object):
# Platform-specifics # Platform-specifics
if cxx.target.platform == 'linux': if cxx.target.platform == 'linux':
cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64'] cxx.defines += ['LINUX', '_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
if cxx.family == 'gcc': if cxx.family == 'gcc':
cxx.linkflags += ['-static-libgcc'] cxx.linkflags += ['-static-libgcc']
elif cxx.family == 'clang': elif cxx.family == 'clang':

View File

@ -8,8 +8,6 @@ for sdk_name in MMS.sdks:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]: if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue continue
name = 'metamod.' + sdk.ext
binary = MMS.HL2Library(builder, cxx, name, sdk)
binary.sources += [ binary.sources += [
'metamod.cpp', 'metamod.cpp',
@ -28,6 +26,8 @@ for sdk_name in MMS.sdks:
'vsp_bridge.cpp' 'vsp_bridge.cpp'
] ]
binary.compiler.defines += ['_ALLOW_KEYWORD_MACROS']
# Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?" # Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?"
if binary.compiler.target.arch == 'x86': if binary.compiler.target.arch == 'x86':
binary.sources += ['sourcehook/sourcehook_hookmangen.cpp'] binary.sources += ['sourcehook/sourcehook_hookmangen.cpp']

36
core/metamod_convar.h Normal file
View File

@ -0,0 +1,36 @@
/**
* vim: set ts=4 :
* ======================================================
* Metamod:Source
* Copyright (C) 2004-2025 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.
*
* Version: $Id$
*/
#pragma once
#define protected public
#define private public
#include <convar.h>
#undef protected
#undef private

View File

@ -35,7 +35,6 @@
#include <interface.h> #include <interface.h>
#include <eiface.h> #include <eiface.h>
#include <convar.h>
#include <sh_list.h> #include <sh_list.h>
#include <sh_string.h> #include <sh_string.h>
#include <IPluginManager.h> #include <IPluginManager.h>

View File

@ -42,7 +42,7 @@ bool SMConVarAccessor::RegisterConCommandBase(ConCommandBase *pCommand)
{ {
m_RegisteredCommands.push_back(pCommand); m_RegisteredCommands.push_back(pCommand);
#if SOURCE_ENGINE < SE_ALIENSWARM #if SOURCE_ENGINE < SE_ALIENSWARM
pCommand->SetNext(NULL); pCommand->m_pNext = NULL;
#endif #endif
icvar->RegisterConCommand(pCommand); icvar->RegisterConCommand(pCommand);
@ -52,7 +52,7 @@ bool SMConVarAccessor::RegisterConCommandBase(ConCommandBase *pCommand)
bool SMConVarAccessor::Register(ConCommandBase *pCommand) bool SMConVarAccessor::Register(ConCommandBase *pCommand)
{ {
#if SOURCE_ENGINE < SE_ALIENSWARM #if SOURCE_ENGINE < SE_ALIENSWARM
pCommand->SetNext(NULL); pCommand->m_pNext = NULL;
#endif #endif
icvar->RegisterConCommand(pCommand); icvar->RegisterConCommand(pCommand);
@ -163,7 +163,7 @@ void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
if (pCur == pCommand) if (pCur == pCommand)
{ {
*m_TopConCommandBase = const_cast<ConCommandBase *>(pCommand->GetNext()); *m_TopConCommandBase = const_cast<ConCommandBase *>(pCommand->GetNext());
pCommand->SetNext(NULL); pCommand->m_pNext = NULL;
return; return;
} }
@ -174,8 +174,8 @@ void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
{ {
if (pCur == pCommand) if (pCur == pCommand)
{ {
pPrev->SetNext(const_cast<ConCommandBase *>(pCommand->GetNext())); pPrev->m_pNext = const_cast<ConCommandBase *>(pCommand->GetNext());
pCommand->SetNext(NULL); pCommand->m_pNext = NULL;
} }
pPrev = pCur; pPrev = pCur;

View File

@ -29,7 +29,7 @@
#define _INCLUDE_CONSOLE_MMS_H_ #define _INCLUDE_CONSOLE_MMS_H_
#include <interface.h> #include <interface.h>
#include "convar.h" #include "../metamod_convar.h"
#include <eiface.h> #include <eiface.h>
#include <sh_list.h> #include <sh_list.h>

View File

@ -26,6 +26,8 @@
#ifndef _INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_ #ifndef _INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_
#define _INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_ #define _INCLUDE_METAMOD_SOURCE_BASE_PROVIDER_H_
#include "../metamod_convar.h"
#if defined _DEBUG #if defined _DEBUG
#define DEBUG2 #define DEBUG2
#undef _DEBUG #undef _DEBUG

View File

@ -51,7 +51,7 @@ def output_version_header():
with open(os.path.join(SourceFolder, 'product.version')) as fp: with open(os.path.join(SourceFolder, 'product.version')) as fp:
contents = fp.read() contents = fp.read()
m = re.match('(\d+)\.(\d+)\.(\d+)-?(.*)', contents) m = re.match(r'(\d+)\.(\d+)\.(\d+)-?(.*)', contents)
if m == None: if m == None:
raise Exception('Could not detremine product version') raise Exception('Could not detremine product version')
major, minor, release, tag = m.groups() major, minor, release, tag = m.groups()