Add support for the preliminary IDE project file generator.

This commit is contained in:
David Anderson 2014-05-30 19:07:56 -07:00
parent 76a589f689
commit 1e6843f8db
4 changed files with 57 additions and 44 deletions

3
.gitignore vendored
View File

@ -30,3 +30,6 @@ LIB-Debug/
# AMBuild build directories # AMBuild build directories
build/ build/
obj-*/ obj-*/
*~
*.rej
*.orig

View File

@ -72,6 +72,9 @@ class SMConfig(object):
self.smx_files = {} self.smx_files = {}
self.versionlib = None self.versionlib = None
def use_auto_versioning(self):
return builder.backend == 'amb2'
def detectProductVersion(self): def detectProductVersion(self):
builder.AddConfigureFile('product.version') builder.AddConfigureFile('product.version')
@ -266,11 +269,12 @@ class SMConfig(object):
# Finish up. # Finish up.
cfg.defines += [ cfg.defines += [
'SOURCEMOD_BUILD', 'SOURCEMOD_BUILD',
'SM_GENERATED_BUILD',
'SM_USE_VERSIONLIB', 'SM_USE_VERSIONLIB',
] ]
cfg.includes += [os.path.join(builder.buildPath, 'includes')] if self.use_auto_versioning():
cfg.includes += [os.path.join(builder.sourcePath, 'versionlib')] cfg.defines += ['SM_GENERATED_BUILD']
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
cfg.includes += [os.path.join(builder.sourcePath, 'versionlib')]
def LibraryBuilder(self, compiler, name): def LibraryBuilder(self, compiler, name):
binary = compiler.Library(name) binary = compiler.Library(name)
@ -278,16 +282,18 @@ class SMConfig(object):
binary.sources += ['version.rc'] binary.sources += ['version.rc']
binary.compiler.rcdefines += [ binary.compiler.rcdefines += [
'BINARY_NAME="{0}"'.format(binary.outputFile), 'BINARY_NAME="{0}"'.format(binary.outputFile),
'SM_GENERATED_BUILD',
'RC_COMPILE', 'RC_COMPILE',
] ]
if self.use_auto_versioning():
binary.compiler.rcdefines += ['SM_GENERATED_BUILD']
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.sourcedeps += SM.generated_headers binary.compiler.linkflags += [self.versionlib]
binary.compiler.sourcedeps += SM.generated_headers
return binary return binary
def ProgramBuilder(self, compiler, name): def ProgramBuilder(self, compiler, name):
@ -296,11 +302,13 @@ class SMConfig(object):
binary.sources += ['version.rc'] binary.sources += ['version.rc']
binary.compiler.rcdefines += [ binary.compiler.rcdefines += [
'BINARY_NAME="{0}"'.format(binary.outputFile), 'BINARY_NAME="{0}"'.format(binary.outputFile),
'SM_GENERATED_BUILD',
'RC_COMPILE', 'RC_COMPILE',
] ]
binary.compiler.linkflags += [self.versionlib] if self.use_auto_versioning():
binary.compiler.sourcedeps += SM.generated_headers binary.compiler.rcdefines += ['SM_GENERATED_BUILD']
if self.use_auto_versioning():
binary.compiler.linkflags += [self.versionlib]
binary.compiler.sourcedeps += SM.generated_headers
return binary return binary
def Library(self, context, name): def Library(self, context, name):
@ -460,42 +468,44 @@ SM.detectProductVersion()
SM.detectSDKs() SM.detectSDKs()
SM.configure() SM.configure()
SM.generated_headers = builder.RunScript( if SM.use_auto_versioning():
'tools/buildbot/Versioning', SM.generated_headers = builder.RunScript(
{ 'SM': SM } 'tools/buildbot/Versioning',
) { 'SM': SM }
SM.versionlib = builder.RunScript( )
'versionlib/AMBuilder', SM.versionlib = builder.RunScript(
{ 'SM': SM } 'versionlib/AMBuilder',
) { 'SM': SM }
)
builder.RunBuildScripts( BuildScripts = [
[ 'loader/AMBuilder',
'loader/AMBuilder', 'core/AMBuilder',
'core/AMBuilder', 'core/logic/AMBuilder',
'core/logic/AMBuilder', 'extensions/bintools/AMBuilder',
'extensions/bintools/AMBuilder', 'extensions/clientprefs/AMBuilder',
'extensions/clientprefs/AMBuilder', 'extensions/curl/AMBuilder',
'extensions/curl/AMBuilder', 'extensions/cstrike/AMBuilder',
'extensions/cstrike/AMBuilder', 'extensions/geoip/AMBuilder',
'extensions/geoip/AMBuilder', 'extensions/mysql/AMBuilder',
'extensions/mysql/AMBuilder', 'extensions/regex/AMBuilder',
'extensions/regex/AMBuilder', 'extensions/sdkhooks/AMBuilder',
'extensions/sdkhooks/AMBuilder', 'extensions/sdktools/AMBuilder',
'extensions/sdktools/AMBuilder', 'extensions/sqlite/AMBuilder',
'extensions/sqlite/AMBuilder', 'extensions/tf2/AMBuilder',
'extensions/tf2/AMBuilder', 'extensions/topmenus/AMBuilder',
'extensions/topmenus/AMBuilder', 'extensions/updater/AMBuilder',
'extensions/updater/AMBuilder', 'sourcepawn/compiler/AMBuilder',
'sourcepawn/compiler/AMBuilder', 'sourcepawn/jit/AMBuilder',
'sourcepawn/jit/AMBuilder', ]
if builder.backend == 'amb2':
BuildScripts += [
'plugins/AMBuilder', 'plugins/AMBuilder',
'tools/buildbot/PackageScript', 'tools/buildbot/PackageScript',
], ]
{
'SM': SM builder.RunBuildScripts(BuildScripts, { 'SM': SM })
}
)
if builder.options.breakpad_dump: if builder.options.breakpad_dump:
builder.RunScript('tools/buildbot/BreakpadSymbols', { 'SM': SM }) builder.RunScript('tools/buildbot/BreakpadSymbols', { 'SM': SM })

View File

@ -34,7 +34,7 @@ for sdk_name in SM.sdks:
elif builder.target_platform == 'mac': elif builder.target_platform == 'mac':
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a') lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
elif builder.target_platform == 'windows': elif builder.target_platform == 'windows':
msvc_ver = int(compiler.cxx.version) msvc_ver = compiler.cxx.version
vs_year = '' vs_year = ''
if msvc_ver == 1800: if msvc_ver == 1800:
vs_year = '2013' vs_year = '2013'

View File

@ -342,8 +342,8 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__); ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__);
#if defined(SM_GENERATED_BUILD) #if defined(SM_GENERATED_BUILD)
ConsolePrint(" Built from: https://github.com/alliedmodders/sourcemod/commit/%s", SOURCEMOD_SHA); ConsolePrint(" Built from: https://github.com/alliedmodders/sourcemod/commit/%s", SOURCEMOD_SHA);
#endif
ConsolePrint(" Build ID: %s:%s", SOURCEMOD_LOCAL_REV, SOURCEMOD_SHA); ConsolePrint(" Build ID: %s:%s", SOURCEMOD_LOCAL_REV, SOURCEMOD_SHA);
#endif
ConsolePrint(" http://www.sourcemod.net/"); ConsolePrint(" http://www.sourcemod.net/");
} }
} }