Port build scripts to the new project API.
This commit is contained in:
+44
-34
@@ -75,6 +75,13 @@ class SMConfig(object):
|
||||
def use_auto_versioning(self):
|
||||
return builder.backend == 'amb2'
|
||||
|
||||
def tag(self, name):
|
||||
if builder.options.debug == '1':
|
||||
tag = 'Debug'
|
||||
else:
|
||||
tag = 'Release'
|
||||
return '{0} - {1}'.format(tag, name)
|
||||
|
||||
def detectProductVersion(self):
|
||||
builder.AddConfigureFile('product.version')
|
||||
|
||||
@@ -284,34 +291,26 @@ class SMConfig(object):
|
||||
]
|
||||
if self.use_auto_versioning():
|
||||
binary.compiler.rcdefines += ['SM_GENERATED_BUILD']
|
||||
elif builder.target_platform == 'mac':
|
||||
if binary.type == 'library':
|
||||
binary.compiler.postlink += [
|
||||
'-compatibility_version', '1.0.0',
|
||||
'-current_version', self.productVersion
|
||||
]
|
||||
if self.use_auto_versioning():
|
||||
binary.compiler.linkflags += [self.versionlib]
|
||||
binary.compiler.sourcedeps += SM.generated_headers
|
||||
return binary
|
||||
|
||||
def LibraryBuilder(self, compiler, name):
|
||||
binary = compiler.Library(name)
|
||||
if builder.target_platform == 'mac':
|
||||
binary.compiler.postlink += [
|
||||
'-compatibility_version', '1.0.0',
|
||||
'-current_version', self.productVersion
|
||||
]
|
||||
return self.AddVersioning(binary)
|
||||
|
||||
def ProgramBuilder(self, compiler, name):
|
||||
binary = compiler.Program(name)
|
||||
return self.AddVersioning(binary)
|
||||
|
||||
def Library(self, context, name):
|
||||
compiler = context.compiler.clone()
|
||||
return self.LibraryBuilder(compiler, name)
|
||||
binary = context.compiler.Library(name)
|
||||
return self.AddVersioning(binary)
|
||||
|
||||
def Program(self, context, name):
|
||||
compiler = context.compiler.clone()
|
||||
return self.ProgramBuilder(compiler, name)
|
||||
binary = context.compiler.Program(name)
|
||||
return self.AddVersioning(binary)
|
||||
|
||||
def ExtCompiler(self, context):
|
||||
compiler = context.compiler.clone()
|
||||
def ConfigureForExtension(self, context, compiler):
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(context.currentSourcePath),
|
||||
os.path.join(context.currentSourcePath, 'sdk'),
|
||||
@@ -322,8 +321,13 @@ class SMConfig(object):
|
||||
]
|
||||
return compiler
|
||||
|
||||
def HL2Compiler(self, context, sdk):
|
||||
compiler = self.ExtCompiler(context)
|
||||
def ExtLibrary(self, context, name):
|
||||
binary = context.compiler.Library(name)
|
||||
self.ConfigureForExtension(context, binary.compiler)
|
||||
return self.AddVersioning(binary)
|
||||
|
||||
def ConfigureForHL2(self, binary, sdk):
|
||||
compiler = binary.compiler
|
||||
|
||||
if sdk.name == 'episode1':
|
||||
mms_path = os.path.join(self.mms_root, 'core-legacy')
|
||||
@@ -337,6 +341,7 @@ class SMConfig(object):
|
||||
|
||||
defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
|
||||
compiler.defines += defines
|
||||
|
||||
paths = [
|
||||
['public'],
|
||||
['public', 'engine'],
|
||||
@@ -380,15 +385,6 @@ class SMConfig(object):
|
||||
for path in paths:
|
||||
compiler.cxxincludes += [os.path.join(sdk.path, *path)]
|
||||
|
||||
return compiler
|
||||
|
||||
def ExtLibrary(self, context, name):
|
||||
compiler = self.ExtCompiler(context)
|
||||
return self.LibraryBuilder(compiler, name)
|
||||
|
||||
def HL2Library(self, context, name, sdk):
|
||||
compiler = self.HL2Compiler(context, sdk)
|
||||
|
||||
if builder.target_platform == 'linux':
|
||||
if sdk.name == 'episode1':
|
||||
lib_folder = os.path.join(sdk.path, 'linux_sdk')
|
||||
@@ -417,7 +413,7 @@ class SMConfig(object):
|
||||
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
|
||||
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
|
||||
|
||||
binary = self.LibraryBuilder(compiler, name)
|
||||
self.AddVersioning(binary)
|
||||
|
||||
dynamic_libs = []
|
||||
if builder.target_platform == 'linux':
|
||||
@@ -429,7 +425,7 @@ class SMConfig(object):
|
||||
else:
|
||||
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
|
||||
elif builder.target_platform == 'mac':
|
||||
binary.compiler.linkflags.append('-liconv')
|
||||
compiler.linkflags.append('-liconv')
|
||||
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
|
||||
elif builder.target_platform == 'windows':
|
||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||
@@ -437,7 +433,7 @@ class SMConfig(object):
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
|
||||
binary.compiler.linkflags.append(binary.Dep(lib_path))
|
||||
compiler.linkflags.append(compiler.Dep(lib_path))
|
||||
|
||||
for library in dynamic_libs:
|
||||
source_path = os.path.join(lib_folder, library)
|
||||
@@ -450,10 +446,24 @@ class SMConfig(object):
|
||||
return link
|
||||
|
||||
linker = make_linker(source_path, output_path)
|
||||
binary.compiler.linkflags[0:0] = [binary.Dep(library, linker)]
|
||||
compiler.linkflags[0:0] = [compiler.Dep(library, linker)]
|
||||
|
||||
return binary
|
||||
|
||||
def HL2Library(self, context, name, sdk):
|
||||
binary = context.compiler.Library(name)
|
||||
self.ConfigureForExtension(context, binary.compiler)
|
||||
return self.ConfigureForHL2(binary, sdk)
|
||||
|
||||
def HL2Project(self, context, name):
|
||||
project = context.compiler.LibraryProject(name)
|
||||
self.ConfigureForExtension(context, project.compiler)
|
||||
return project
|
||||
|
||||
def HL2Config(self, project, name, sdk):
|
||||
binary = project.Configure(name, sdk.name)
|
||||
return self.ConfigureForHL2(binary, sdk)
|
||||
|
||||
SM = SMConfig()
|
||||
SM.detectProductVersion()
|
||||
SM.detectSDKs()
|
||||
|
||||
Reference in New Issue
Block a user