74 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
 | 
						|
import os, sys
 | 
						|
 | 
						|
projectName = 'sourcetvmanager'
 | 
						|
 | 
						|
# smsdk_ext.cpp will be automatically added later
 | 
						|
sourceFiles = [
 | 
						|
  'extension.cpp',
 | 
						|
  'commonhooks.cpp',
 | 
						|
  'natives.cpp',
 | 
						|
  'forwards.cpp',
 | 
						|
  'hltvserverwrapper.cpp',
 | 
						|
  'hltvdirectorwrapper.cpp',
 | 
						|
  'hltvclientwrapper.cpp',
 | 
						|
  os.path.join(Extension.sm_root, 'public', 'CDetour', 'detours.cpp'),
 | 
						|
  os.path.join(Extension.sm_root, 'public', 'asm', 'asm.c')
 | 
						|
]
 | 
						|
 | 
						|
###############
 | 
						|
# Make sure to edit PackageScript, which copies your files to their appropriate locations
 | 
						|
# Simple extensions do not need to modify past this point.
 | 
						|
 | 
						|
project = Extension.HL2Project(builder, projectName + '.ext')
 | 
						|
 | 
						|
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
 | 
						|
  # Use the copy included in the project
 | 
						|
  project.sources += [os.path.join('sdk', 'smsdk_ext.cpp')]
 | 
						|
else:
 | 
						|
  # Use the copy included with SM 1.6 and newer
 | 
						|
  project.sources += [os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')]
 | 
						|
 | 
						|
project.sources += sourceFiles
 | 
						|
  
 | 
						|
for sdk_name in ['css', 'tf2', 'dods', 'hl2dm', 'csgo']:
 | 
						|
  if sdk_name not in Extension.sdks:
 | 
						|
    continue
 | 
						|
  sdk = Extension.sdks[sdk_name]
 | 
						|
  
 | 
						|
  binary = Extension.HL2Config(project, projectName + '.ext.' + sdk.ext, sdk)
 | 
						|
  compiler = binary.compiler
 | 
						|
  
 | 
						|
  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')
 | 
						|
    ]
 | 
						|
    
 | 
						|
    if builder.target_platform == 'linux':
 | 
						|
      lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
 | 
						|
    elif builder.target_platform == 'mac':
 | 
						|
      lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
 | 
						|
    elif builder.target_platform == 'windows':
 | 
						|
      msvc_ver = compiler.version
 | 
						|
      vs_year = ''
 | 
						|
      if msvc_ver == 1800:
 | 
						|
        vs_year = '2013'
 | 
						|
      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))
 | 
						|
    
 | 
						|
    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'),
 | 
						|
    ]
 | 
						|
 | 
						|
Extension.extensions = builder.Add(project)
 |