2016-02-29 09:59:09 +01:00
|
|
|
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
|
|
|
import os, sys
|
|
|
|
|
|
|
|
projectName = 'sourcetvmanager'
|
|
|
|
|
|
|
|
# smsdk_ext.cpp will be automatically added later
|
|
|
|
sourceFiles = [
|
|
|
|
'extension.cpp',
|
2016-11-14 08:16:39 +01:00
|
|
|
'commonhooks.cpp',
|
2016-02-29 09:59:09 +01:00
|
|
|
'natives.cpp',
|
2016-03-03 01:12:16 +01:00
|
|
|
'forwards.cpp',
|
2016-03-06 14:09:10 +01:00
|
|
|
'hltvserverwrapper.cpp',
|
2016-03-03 02:47:06 +01:00
|
|
|
'hltvdirectorwrapper.cpp',
|
2016-11-14 08:16:39 +01:00
|
|
|
'hltvclientwrapper.cpp',
|
|
|
|
os.path.join(Extension.sm_root, 'public', 'CDetour', 'detours.cpp'),
|
2018-02-06 15:53:04 +01:00
|
|
|
os.path.join(Extension.sm_root, 'public', 'asm', 'asm.c'),
|
|
|
|
# SM 1.10+ compilation changes
|
2019-09-25 21:11:59 +02:00
|
|
|
os.path.join(Extension.sm_root, 'public', 'libudis86', 'decode.c'),
|
|
|
|
os.path.join(Extension.sm_root, 'public', 'libudis86', 'itab.c'),
|
|
|
|
os.path.join(Extension.sm_root, 'public', 'libudis86', 'syn-att.c'),
|
|
|
|
os.path.join(Extension.sm_root, 'public', 'libudis86', 'syn-intel.c'),
|
|
|
|
os.path.join(Extension.sm_root, 'public', 'libudis86', 'syn.c'),
|
|
|
|
os.path.join(Extension.sm_root, 'public', 'libudis86', 'udis86.c')
|
2016-02-29 09:59:09 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
###############
|
|
|
|
# Make sure to edit PackageScript, which copies your files to their appropriate locations
|
|
|
|
# Simple extensions do not need to modify past this point.
|
|
|
|
|
|
|
|
project = Extension.HL2Project(builder, projectName + '.ext')
|
|
|
|
|
|
|
|
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
|
|
|
|
# Use the copy included in the project
|
|
|
|
project.sources += [os.path.join('sdk', 'smsdk_ext.cpp')]
|
|
|
|
else:
|
|
|
|
# Use the copy included with SM 1.6 and newer
|
|
|
|
project.sources += [os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')]
|
|
|
|
|
|
|
|
project.sources += sourceFiles
|
2018-02-06 15:53:04 +01:00
|
|
|
|
|
|
|
project.compiler.defines += ['HAVE_STRING_H'];
|
2016-02-29 09:59:09 +01:00
|
|
|
|
2016-12-05 05:41:07 +01:00
|
|
|
for sdk_name in ['css', 'tf2', 'dods', 'hl2dm', 'csgo', 'l4d', 'l4d2']:
|
2016-02-29 09:59:09 +01:00
|
|
|
if sdk_name not in Extension.sdks:
|
|
|
|
continue
|
|
|
|
sdk = Extension.sdks[sdk_name]
|
|
|
|
|
|
|
|
binary = Extension.HL2Config(project, projectName + '.ext.' + sdk.ext, sdk)
|
2016-03-03 01:12:16 +01:00
|
|
|
compiler = binary.compiler
|
|
|
|
|
|
|
|
if sdk.name == 'csgo':
|
|
|
|
compiler.cxxincludes += [
|
|
|
|
os.path.join(sdk.path, 'common', 'protobuf-2.5.0', 'src'),
|
|
|
|
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
|
|
|
|
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
|
|
|
|
]
|
|
|
|
|
|
|
|
if builder.target_platform == 'linux':
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
|
|
|
|
elif builder.target_platform == 'mac':
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
|
|
|
|
elif builder.target_platform == 'windows':
|
|
|
|
msvc_ver = compiler.version
|
|
|
|
vs_year = ''
|
|
|
|
if msvc_ver == 1800:
|
|
|
|
vs_year = '2013'
|
2018-02-06 15:53:04 +01:00
|
|
|
elif 1900 <= msvc_ver < 2000:
|
2017-07-11 14:00:53 +02:00
|
|
|
vs_year = '2015'
|
2016-03-03 01:12:16 +01:00
|
|
|
else:
|
|
|
|
raise Exception('Cannot find libprotobuf for MSVC version "' + str(compiler.version) + '"')
|
|
|
|
|
|
|
|
if 'DEBUG' in compiler.defines:
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'debug', 'vs' + vs_year, 'libprotobuf.lib')
|
|
|
|
else:
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs' + vs_year, 'libprotobuf.lib')
|
|
|
|
compiler.linkflags.insert(0, binary.Dep(lib_path))
|
|
|
|
|
|
|
|
binary.sources += [
|
|
|
|
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
|
|
|
|
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
|
|
|
|
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
|
|
|
|
]
|
2016-02-29 09:59:09 +01:00
|
|
|
|
|
|
|
Extension.extensions = builder.Add(project)
|