Tweak build scripts so the vs build frontend will work.

This commit is contained in:
David Anderson 2014-08-02 12:29:53 -07:00
parent 5ddd37eb77
commit 6bf21c5687
3 changed files with 31 additions and 16 deletions

View File

@ -13,10 +13,15 @@ class AMXXConfig(object):
self.metamod_path = None self.metamod_path = None
self.hlsdk_path = None self.hlsdk_path = None
self.mysql_path = None self.mysql_path = None
self.generated_headers = None self.generated_headers = []
self.csx_app = None self.csx_app = None
self.stdcxx_path = None self.stdcxx_path = None
def use_auto_versioning(self):
if builder.backend != 'amb2':
return False
return not getattr(builder.options, 'disable_auto_versioning', False)
def detectProductVersion(self): def detectProductVersion(self):
builder.AddConfigureFile('product.version') builder.AddConfigureFile('product.version')
builder.AddConfigureFile('.git/HEAD') builder.AddConfigureFile('.git/HEAD')
@ -235,9 +240,10 @@ class AMXXConfig(object):
cfg.defines += [ cfg.defines += [
'AMX_NOPROPLIST', 'AMX_NOPROPLIST',
'PAWN_CELL_SIZE=32', 'PAWN_CELL_SIZE=32',
'AMBUILD',
] ]
if self.use_auto_versioning():
cfg.defines += ['AMBUILD']
cfg.includes += [os.path.join(builder.buildPath, 'includes')] cfg.includes += [os.path.join(builder.buildPath, 'includes')]
cfg.includes += [os.path.join(builder.sourcePath, 'public')] cfg.includes += [os.path.join(builder.sourcePath, 'public')]
cfg.includes += [os.path.join(builder.sourcePath, 'public', 'amtl')] cfg.includes += [os.path.join(builder.sourcePath, 'public', 'amtl')]
@ -267,15 +273,18 @@ class AMXXConfig(object):
if builder.target_platform == 'windows': if builder.target_platform == 'windows':
binary.compiler.rcdefines += [ binary.compiler.rcdefines += [
'BINARY_NAME="{0}"'.format(binary.outputFile), 'BINARY_NAME="{0}"'.format(binary.outputFile),
'AMBUILD',
'RC_COMPILE', 'RC_COMPILE',
] ]
if self.use_auto_versioning():
binary.compiler.rcdefines += ['AMBUILD']
elif builder.target_platform == 'mac': elif builder.target_platform == 'mac':
binary.compiler.postlink += [ binary.compiler.postlink += [
'-compatibility_version', '1.0.0', '-compatibility_version', '1.0.0',
'-current_version', self.productVersion '-current_version', self.productVersion
] ]
#binary.compiler.linkflags += [self.versionlib] if self.use_auto_versioning():
binary.compiler.rcdefines += ['AMBUILD']
binary.compiler.sourcedeps += AMXX.generated_headers binary.compiler.sourcedeps += AMXX.generated_headers
return binary return binary
@ -341,10 +350,11 @@ AMXX.detectHlsdk()
AMXX.detectMysql() AMXX.detectMysql()
AMXX.configure() AMXX.configure()
AMXX.generated_headers = builder.RunScript( if AMXX.use_auto_versioning():
AMXX.generated_headers = builder.RunScript(
'support/Versioning', 'support/Versioning',
{ 'AMXX': AMXX } { 'AMXX': AMXX }
) )
builder.RunBuildScripts( builder.RunBuildScripts(
[ [
@ -369,16 +379,19 @@ builder.RunBuildScripts(
'dlls/tfcx/AMBuilder', 'dlls/tfcx/AMBuilder',
'dlls/ts/tsfun/AMBuilder', 'dlls/ts/tsfun/AMBuilder',
'dlls/ts/tsx/AMBuilder', 'dlls/ts/tsx/AMBuilder',
'plugins/AMBuilder',
], ],
{ { 'AMXX': AMXX }
'AMXX': AMXX
}
) )
# The csstats.dat reader is Windows-only. # The csstats.dat reader is Windows-only.
if builder.target_platform == 'windows': if builder.target_platform == 'windows':
builder.RunScript('dlls/cstrike/csx/WinCSX/AMBuilder', { 'AMXX': AMXX }) builder.RunScript('dlls/cstrike/csx/WinCSX/AMBuilder', { 'AMXX': AMXX })
# Finally, do packaging. if builder.backend == 'amb2':
builder.RunScript('support/PackageScript', { 'AMXX': AMXX }) builder.RunBuildScripts([
'plugins/AMBuilder',
'support/PackageScript',
],
{ 'AMXX': AMXX }
)

View File

@ -7,7 +7,7 @@ binary.compiler.defines += [
'AMX_ANSIONLY', 'AMX_ANSIONLY',
] ]
if builder.target_platform != 'windows': if builder.compiler.like('gcc'):
binary.compiler.cxxflags.remove('-fno-exceptions') binary.compiler.cxxflags.remove('-fno-exceptions')
if builder.target_platform == 'linux': if builder.target_platform == 'linux':

View File

@ -28,4 +28,6 @@ run.options.add_option('--hlsdk', type='string', dest='hlsdk_path', default='',
help='Path to the HLSDK') help='Path to the HLSDK')
run.options.add_option('--mysql', type='string', dest='mysql_path', default='', run.options.add_option('--mysql', type='string', dest='mysql_path', default='',
help='Path to MySQL') help='Path to MySQL')
run.options.add_option('--disable-auto-versioning', action='store_true', dest='disable_auto_versioning',
default=False, help='Disable the auto versioning script')
run.Configure() run.Configure()