sourcemod/core/AMBuilder

125 lines
3.7 KiB
Plaintext
Raw Normal View History

2009-08-30 09:46:56 +02:00
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
from ambuild.command import SymlinkCommand
2009-08-30 09:46:56 +02:00
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
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)
if i == 'csgo':
# 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')
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'))
2009-08-30 09:46:56 +02:00
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
if i == 'csgo':
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',
'ExtensionSys.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',
'NativeInvoker.cpp',
'smn_fakenatives.cpp',
'smn_nextmap.cpp',
'sourcemm_api.cpp',
'ChatTriggers.cpp',
'NativeOwner.cpp',
'smn_player.cpp',
'sourcemod.cpp',
'concmd_cleaner.cpp',
'HalfLife2.cpp',
'NextMap.cpp',
'ConCmdManager.cpp',
'HandleSys.cpp',
'ConVarManager.cpp',
'LibrarySys.cpp',
'PlayerManager.cpp',
'TimerSys.cpp',
'CoreConfig.cpp',
'Logger.cpp',
'smn_halflife.cpp',
'PluginSys.cpp',
'smn_console.cpp',
'UserMessages.cpp',
'Database.cpp',
'MenuManager.cpp',
'smn_core.cpp',
'smn_hudtext.cpp',
'smn_usermsgs.cpp',
'MenuStyle_Base.cpp',
'ShareSys.cpp',
'smn_database.cpp',
'smn_keyvalues.cpp',
'smn_vector.cpp',
'EventManager.cpp',
'MenuStyle_Radio.cpp',
'sm_autonatives.cpp',
'sm_srvcmds.cpp',
'ConsoleDetours.cpp'
2009-08-30 09:46:56 +02:00
]
if i == 'csgo':
files.append('smn_protobuf.cpp')
else:
files.append('smn_bitbuffer.cpp')
2009-08-30 09:46:56 +02:00
binary.AddSourceFiles('core', files)
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)
2009-08-30 09:46:56 +02:00
SM.PostSetupHL2Job(extension, binary, i)
if i == 'csgo':
if AMBuild.target['platform'] in ['linux', 'darwin']:
binary.AddObjectFiles(['libprotobuf.a'])
2009-08-30 09:46:56 +02:00
SM.AutoVersion('core', binary)
binary.SendToJob()