# vim: set ts=2 sw=2 tw=99 noet ft=python: 
import os

for i in SM.sdkInfo:
	sdk = SM.sdkInfo[i]
	if AMBuild.target['platform'] not in sdk['platform']:
		continue

	compiler = SM.DefaultHL2Compiler('extension', i)
	
	compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension'))
	compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension', 'sdk'))
	
	compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD14'], 'public'))
	compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD14'], 'public', 'sourcepawn'))

	if compiler.cc.name == 'gcc':
		compiler['CFLAGS'].append('-Wno-parentheses')

	if i != 'ep1':
		compiler['CDEFINES'].append('HOOKING_ENABLED')

	name = 'tf2items.ext.' + sdk['ext']
	extension = AMBuild.AddJob(name)
	binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
	SM.PreSetupHL2Job(extension, binary, i)

	binary.AddSourceFiles(os.path.join('extension', 'sdk'), ['smsdk_ext.cpp'])
	binary.AddSourceFiles('extension', ['extension.cpp'])
	
	SM.PostSetupHL2Job(extension, binary, i)
	SM.AutoVersion('extension', binary)
	SM.ExtractDebugInfo(extension, binary)
	binary.SendToJob()
