sourcemod/extensions/cstrike/AMBuilder
Nicholas Hastings ae485c3115
Add A2S_Rules fix for CS:GO to CStrike extension. (#614)
* Add A2S_Rules fix for CS:GO to CStrike extension.

* Dont force set the cvar. Add checks before patching.

* Remove incorrect and useless check.

* Remove checking value as it is in the signature.

* Update build script changes to AMBuild 2.1 API to fix build.

* Fix bad check and ConVarRef being resolved too early.

* Whoops. This line is kinda important. Got nuked when refactoring.

* Remove unused variable.

* Updatet gamedata.

* Switch to "Addresses" gamedata lookup

* Add linux64 gamedata

* Fix mac build

Co-authored-by: Ruben Gonzalez <drifter01620@gmail.com>
Co-authored-by: Peace-Maker <peace-maker@wcfan.de>
2021-03-08 22:42:32 +00:00

70 lines
2.2 KiB
Python

# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
project = builder.LibraryProject('game.cstrike.ext')
project.sources += [
'extension.cpp',
'natives.cpp',
'RegNatives.cpp',
'timeleft.cpp',
'forwards.cpp',
'util_cstrike.cpp',
'../../public/smsdk_ext.cpp',
'../../public/CDetour/detours.cpp',
'../../public/asm/asm.c',
'../../public/libudis86/decode.c',
'../../public/libudis86/itab.c',
'../../public/libudis86/syn-att.c',
'../../public/libudis86/syn-intel.c',
'../../public/libudis86/syn.c',
'../../public/libudis86/udis86.c',
]
for sdk_name in ['css', 'csgo']:
if sdk_name not in SM.sdks:
continue
sdk = SM.sdks[sdk_name]
if sdk_name == 'csgo':
project.sources += ['rulesfix.cpp']
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
cxx.defines += ['HAVE_STRING_H']
binary = SM.HL2ExtConfig(project, builder, cxx, 'game.cstrike.ext.' + sdk.ext, sdk)
if sdk_name == 'csgo':
compiler = binary.compiler
compiler.cxxincludes += [os.path.join(sdk.path, 'public', 'steam')]
compiler.defines += ['VERSION_SAFE_STEAM_API_INTERFACES']
library_name = ''
if cxx.target.platform == 'windows':
compiler.linkflags += [os.path.join(sdk.path, 'lib', 'public', 'steam_api.lib')]
elif cxx.target.platform == 'linux':
library_name = 'libsteam_api.so'
if cxx.target.arch == 'x86_64':
source_path = os.path.join(sdk.path, 'lib', 'linux64')
else:
source_path = os.path.join(sdk.path, 'lib', 'linux')
elif cxx.target.platform == 'mac':
library_name = 'libsteam_api.dylib'
if cxx.target.arch == 'x86_64':
source_path = os.path.join(sdk.path, 'lib', 'osx64')
else:
source_path = os.path.join(sdk.path, 'lib', 'mac')
if library_name:
source_path = os.path.join(source_path, library_name)
output_path = os.path.join(binary.localFolder, library_name)
# Ensure the output path exists.
builder.AddFolder(binary.localFolder)
output = builder.AddSymlink(source_path, output_path)
compiler.weaklinkdeps += [output]
compiler.linkflags[0:0] = [library_name]
SM.extensions += builder.Add(project)