Merge pull request #98 from alliedmodders/vsgen

Tweak build scripts so the vs build frontend will work.
This commit is contained in:
Vincent Herbet 2014-08-02 22:15:24 +02:00
commit 26d1449ac3
3 changed files with 31 additions and 16 deletions

View File

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

View File

@ -7,7 +7,7 @@ binary.compiler.defines += [
'AMX_ANSIONLY',
]
if builder.target_platform != 'windows':
if builder.compiler.like('gcc'):
binary.compiler.cxxflags.remove('-fno-exceptions')
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')
run.options.add_option('--mysql', type='string', dest='mysql_path', default='',
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()