sourcemod/extensions/cstrike/AMBuilder
Benoist e07c120cab
CDetour safetyhook (#2162)
* Add safetyhook, remove libudis86

Co-authored-by: bottiger1 <55270538+bottiger1@users.noreply.github.com>

* Add modified CDetour

Co-authored-by: bottiger1 <55270538+bottiger1@users.noreply.github.com>

* Add CDetour [Safetyhook] to build script

* Re-enable loader/core/corelogic, and fix new C++20 error

* Reenable all extensions (except dhooks)

* Make cstrike compile against new CDetour

* Remove unused variable in sdktools output?

* Make sdktools compile against new cdetour

* Downgrade to C++17

* remove auto

* fix compilation on linux

* Re-enable dhooks

* Re-authorise old compilers

* Fix invalid downgrade of std::optional

* readd libudis86 for dhooks only

---------

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
Co-authored-by: bottiger1 <55270538+bottiger1@users.noreply.github.com>
2024-05-21 01:53:44 +00:00

64 lines
2.0 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'
]
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['platforms'][cxx.target.platform]:
continue
cxx.defines += ['HAVE_STRING_H']
binary = SM.HL2ExtConfig(project, builder, cxx, 'game.cstrike.ext.' + sdk['extension'], sdk)
SM.AddCDetour(binary)
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)