2018-01-28 12:39:23 +01:00
|
|
|
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
2009-08-30 09:46:56 +02:00
|
|
|
import os
|
|
|
|
|
2014-06-01 04:56:42 +02:00
|
|
|
project = SM.HL2Project(builder, 'sourcemod')
|
|
|
|
project.sources += [
|
|
|
|
'MenuStyle_Valve.cpp',
|
|
|
|
'logic_bridge.cpp',
|
|
|
|
'smn_entities.cpp',
|
|
|
|
'sm_stringutil.cpp',
|
|
|
|
'MenuVoting.cpp',
|
|
|
|
'smn_events.cpp',
|
|
|
|
'frame_hooks.cpp',
|
|
|
|
'smn_nextmap.cpp',
|
|
|
|
'sourcemm_api.cpp',
|
|
|
|
'ChatTriggers.cpp',
|
|
|
|
'smn_player.cpp',
|
|
|
|
'sourcemod.cpp',
|
|
|
|
'concmd_cleaner.cpp',
|
|
|
|
'HalfLife2.cpp',
|
|
|
|
'NextMap.cpp',
|
|
|
|
'ConCmdManager.cpp',
|
|
|
|
'ConVarManager.cpp',
|
|
|
|
'PlayerManager.cpp',
|
|
|
|
'TimerSys.cpp',
|
|
|
|
'CoreConfig.cpp',
|
|
|
|
'Logger.cpp',
|
|
|
|
'smn_halflife.cpp',
|
|
|
|
'smn_console.cpp',
|
|
|
|
'UserMessages.cpp',
|
|
|
|
'MenuManager.cpp',
|
|
|
|
'smn_hudtext.cpp',
|
|
|
|
'smn_usermsgs.cpp',
|
|
|
|
'MenuStyle_Base.cpp',
|
|
|
|
'smn_keyvalues.cpp',
|
|
|
|
'smn_vector.cpp',
|
|
|
|
'EventManager.cpp',
|
|
|
|
'MenuStyle_Radio.cpp',
|
|
|
|
'sm_autonatives.cpp',
|
2014-06-24 10:04:13 +02:00
|
|
|
'ConsoleDetours.cpp',
|
|
|
|
'vprof_tool.cpp',
|
2014-10-07 23:16:02 +02:00
|
|
|
'smn_commandline.cpp',
|
2015-08-30 22:59:25 +02:00
|
|
|
'GameHooks.cpp',
|
2014-06-01 04:56:42 +02:00
|
|
|
]
|
|
|
|
|
2013-12-30 23:50:56 +01:00
|
|
|
for sdk_name in SM.sdks:
|
|
|
|
sdk = SM.sdks[sdk_name]
|
2017-12-20 08:56:23 +01:00
|
|
|
for arch in SM.archs:
|
|
|
|
if not arch in sdk.platformSpec[builder.target.platform]:
|
|
|
|
continue
|
2010-05-13 11:18:58 +02:00
|
|
|
|
2017-12-20 08:56:23 +01:00
|
|
|
binary_name = 'sourcemod.' + sdk.ext
|
2009-08-30 09:46:56 +02:00
|
|
|
|
2017-12-20 08:56:23 +01:00
|
|
|
binary = SM.HL2Config(project, binary_name, sdk, arch)
|
|
|
|
compiler = binary.compiler
|
2015-08-31 06:27:32 +02:00
|
|
|
|
2013-12-30 23:50:56 +01:00
|
|
|
compiler.cxxincludes += [
|
2017-12-20 08:56:23 +01:00
|
|
|
builder.sourcePath
|
2013-12-30 23:50:56 +01:00
|
|
|
]
|
2009-08-30 09:46:56 +02:00
|
|
|
|
2017-12-20 08:56:23 +01:00
|
|
|
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')
|
|
|
|
]
|
2013-01-23 03:43:12 +01:00
|
|
|
|
2018-05-06 18:59:33 +02:00
|
|
|
if compiler.like('msvc'):
|
2018-05-22 01:54:12 +02:00
|
|
|
compiler.defines += ['_ALLOW_KEYWORD_MACROS']
|
2017-10-02 14:18:57 +02:00
|
|
|
if builder.target.platform == 'linux':
|
2017-12-20 08:56:23 +01:00
|
|
|
compiler.postlink += ['-lpthread', '-lrt']
|
2014-03-01 02:44:10 +01:00
|
|
|
|
2017-12-20 08:56:23 +01:00
|
|
|
if sdk.name == 'csgo':
|
|
|
|
if builder.target.platform == 'linux':
|
|
|
|
if arch == 'x86':
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
|
|
|
|
elif arch == 'x64':
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'linux64', 'release', 'libprotobuf.a')
|
|
|
|
compiler.linkflags += ['-Wl,--exclude-libs=libprotobuf.a']
|
|
|
|
elif builder.target.platform == 'mac':
|
|
|
|
if arch == 'x86':
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
|
|
|
|
elif arch == 'x64':
|
|
|
|
lib_path = os.path.join(sdk.path, 'lib', 'osx64', 'release', 'libprotobuf.a')
|
|
|
|
elif builder.target.platform == 'windows':
|
|
|
|
msvc_ver = compiler.version
|
|
|
|
vs_year = ''
|
2019-11-16 01:40:39 +01:00
|
|
|
if 1900 <= msvc_ver < 2000:
|
2017-12-20 08:56:23 +01:00
|
|
|
vs_year = '2015'
|
|
|
|
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))
|
2013-12-30 23:50:56 +01:00
|
|
|
|
2017-12-20 08:56:23 +01:00
|
|
|
if sdk.name == 'csgo':
|
|
|
|
binary.sources += ['smn_protobuf.cpp']
|
|
|
|
else:
|
|
|
|
binary.sources += ['smn_bitbuffer.cpp']
|
2013-08-21 09:01:28 +02:00
|
|
|
|
2017-12-20 08:56:23 +01:00
|
|
|
if sdk.name == 'csgo':
|
|
|
|
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'),
|
|
|
|
]
|
2013-01-23 03:43:12 +01:00
|
|
|
|
2014-06-01 04:56:42 +02:00
|
|
|
SM.binaries += builder.Add(project)
|
2012-04-14 02:12:24 +02:00
|
|
|
|