2009-08-30 09:46:56 +02:00
|
|
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
|
|
|
import os
|
2013-01-23 03:43:12 +01:00
|
|
|
from ambuild.command import SymlinkCommand
|
2009-08-30 09:46:56 +02:00
|
|
|
|
|
|
|
for i in SM.sdkInfo:
|
|
|
|
sdk = SM.sdkInfo[i]
|
2010-05-13 11:18:58 +02:00
|
|
|
if AMBuild.target['platform'] not in sdk['platform']:
|
|
|
|
continue
|
|
|
|
|
2009-08-30 09:46:56 +02:00
|
|
|
name = 'sourcemod.' + sdk['ext']
|
|
|
|
|
|
|
|
compiler = SM.DefaultHL2Compiler('core', i)
|
|
|
|
|
2013-01-23 03:43:12 +01:00
|
|
|
if i == 'csgo':
|
2013-01-23 04:17:24 +01:00
|
|
|
# Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
|
|
|
|
if isinstance(compiler.cxx, Cpp.CompatGCC):
|
|
|
|
compiler.AddToListVar('CFLAGS', '-Wno-sign-compare')
|
2013-01-23 03:43:12 +01:00
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.3.0', 'src'))
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'csgo', 'protobuf'))
|
2013-03-19 16:22:31 +01:00
|
|
|
elif i == 'dota':
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.4.1', 'src'))
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'protobuf'))
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'dota', 'protobuf'))
|
2013-01-23 03:43:12 +01:00
|
|
|
|
2009-08-30 09:46:56 +02:00
|
|
|
extension = AMBuild.AddJob(name)
|
|
|
|
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
|
|
|
|
SM.PreSetupHL2Job(extension, binary, i)
|
2013-01-23 03:43:12 +01:00
|
|
|
|
2013-03-19 16:22:31 +01:00
|
|
|
if i in ['csgo', 'dota']:
|
2013-01-23 03:43:12 +01:00
|
|
|
if AMBuild.target['platform'] == 'linux':
|
|
|
|
link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
|
|
|
|
target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'linux32', 'release'), 'libprotobuf.a')
|
|
|
|
try:
|
|
|
|
os.lstat(link)
|
|
|
|
except:
|
|
|
|
extension.AddCommand(SymlinkCommand(link, target))
|
|
|
|
elif AMBuild.target['platform'] == 'darwin':
|
|
|
|
link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
|
|
|
|
target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'osx32', 'release'), 'libprotobuf.a')
|
|
|
|
try:
|
|
|
|
os.lstat(link)
|
|
|
|
except:
|
|
|
|
extension.AddCommand(SymlinkCommand(link, target))
|
|
|
|
elif AMBuild.target['platform'] == 'windows':
|
|
|
|
libPath = os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'win32', 'release', 'vs2010', 'libprotobuf.lib')
|
|
|
|
binary.RebuildIfNewer(libPath)
|
|
|
|
binary['POSTLINKFLAGS'].append(libPath)
|
|
|
|
|
2009-08-30 09:46:56 +02:00
|
|
|
files = [
|
|
|
|
'AdminCache.cpp',
|
|
|
|
'MenuStyle_Valve.cpp',
|
|
|
|
'logic_bridge.cpp',
|
|
|
|
'smn_entities.cpp',
|
|
|
|
'sm_stringutil.cpp',
|
|
|
|
'ADTFactory.cpp',
|
|
|
|
'ForwardSys.cpp',
|
|
|
|
'MenuVoting.cpp',
|
|
|
|
'smn_events.cpp',
|
|
|
|
'smn_menus.cpp',
|
|
|
|
'sm_trie.cpp',
|
|
|
|
'CDataPack.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',
|
|
|
|
'LibrarySys.cpp',
|
|
|
|
'PlayerManager.cpp',
|
|
|
|
'TimerSys.cpp',
|
|
|
|
'CoreConfig.cpp',
|
|
|
|
'Logger.cpp',
|
|
|
|
'smn_halflife.cpp',
|
|
|
|
'smn_console.cpp',
|
|
|
|
'UserMessages.cpp',
|
|
|
|
'Database.cpp',
|
|
|
|
'MenuManager.cpp',
|
|
|
|
'smn_core.cpp',
|
|
|
|
'smn_hudtext.cpp',
|
|
|
|
'smn_usermsgs.cpp',
|
|
|
|
'MenuStyle_Base.cpp',
|
|
|
|
'smn_database.cpp',
|
|
|
|
'smn_keyvalues.cpp',
|
|
|
|
'smn_vector.cpp',
|
|
|
|
'EventManager.cpp',
|
|
|
|
'MenuStyle_Radio.cpp',
|
|
|
|
'sm_autonatives.cpp',
|
|
|
|
'sm_srvcmds.cpp',
|
2009-09-26 23:12:23 +02:00
|
|
|
'ConsoleDetours.cpp'
|
2009-08-30 09:46:56 +02:00
|
|
|
]
|
2013-01-23 03:43:12 +01:00
|
|
|
|
2013-03-19 16:22:31 +01:00
|
|
|
if i in ['csgo', 'dota']:
|
2013-01-23 03:43:12 +01:00
|
|
|
files.append('smn_protobuf.cpp')
|
|
|
|
else:
|
|
|
|
files.append('smn_bitbuffer.cpp')
|
|
|
|
|
2009-08-30 09:46:56 +02:00
|
|
|
binary.AddSourceFiles('core', files)
|
2013-01-23 03:43:12 +01:00
|
|
|
|
|
|
|
if i == 'csgo':
|
|
|
|
files = [
|
|
|
|
os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
|
|
|
|
]
|
|
|
|
binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
|
2013-03-19 16:22:31 +01:00
|
|
|
elif i == 'dota':
|
|
|
|
files = [
|
|
|
|
os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
|
|
|
|
os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
|
|
|
|
]
|
|
|
|
binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
|
2013-01-23 03:43:12 +01:00
|
|
|
|
2009-08-30 09:46:56 +02:00
|
|
|
SM.PostSetupHL2Job(extension, binary, i)
|
2013-01-23 04:47:35 +01:00
|
|
|
|
2013-03-19 16:22:31 +01:00
|
|
|
if i in ['csgo', 'dota']:
|
2013-01-23 04:47:35 +01:00
|
|
|
if AMBuild.target['platform'] in ['linux', 'darwin']:
|
|
|
|
binary.AddObjectFiles(['libprotobuf.a'])
|
|
|
|
|
2009-08-30 09:46:56 +02:00
|
|
|
SM.AutoVersion('core', binary)
|
2013-03-17 22:00:28 +01:00
|
|
|
SM.ExtractDebugInfo(extension, binary)
|
2009-08-30 09:46:56 +02:00
|
|
|
binary.SendToJob()
|
2012-04-14 02:12:24 +02:00
|
|
|
|