Added --no-mysql option to configure script to make MySQL optional (bug 5661, r+a=dvander).

This commit is contained in:
Scott Ehlert 2013-03-17 04:09:44 -05:00
parent 64be2bc5a0
commit d3d5cd8181
3 changed files with 16 additions and 4 deletions

View File

@ -51,12 +51,17 @@ class SM:
if AMBuild.mode == 'config':
#Detect compilers
self.compiler.DetectAll(AMBuild)
#Required paths
self.hasMySql = AMBuild.options.hasMySql
AMBuild.cache.CacheVariable('hasMySql', self.hasMySql)
#Environment variable paths to external headers
envvars = { 'MMSOURCE19': 'mmsource-1.9', 'MYSQL5': 'mysql-5.0' }
#Look for Metamod:Source and MySQL directories
#Look for Metamod:Source and MySQL if not disabled
for env in envvars:
if not self.hasMySql and env == 'MYSQL5':
continue
path = self.ResolveEnvPath(env, envvars[env])
if path == None:
raise Exception('Could not find a valid path for {0}'.format(env))
@ -220,6 +225,7 @@ class SM:
self.sdkInfo = AMBuild.cache['sdkInfo']
self.compiler.FromConfig(AMBuild, 'compiler')
self.targetMap = AMBuild.cache['targetMap']
self.hasMySql = AMBuild.cache['hasMySql']
if AMBuild.target['platform'] == 'windows':
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
@ -441,6 +447,9 @@ FileList = [
['tools', 'buildbot', 'BreakpadSymbols']
]
if not sm.hasMySql:
FileList.remove(['extensions', 'mysql', 'AMBuilder'])
for parts in FileList:
AMBuild.Include(os.path.join(*parts), globals)

View File

@ -7,6 +7,8 @@ run.options.add_option('--enable-debug', action='store_const', const='1', dest='
help='Enable debugging symbols')
run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
run.options.add_option('--no-mysql', action='store_false', default=True, dest='hasMySql',
help='Disable building MySQL extension')
run.options.add_option('-s', '--sdks', default='all', dest='sdks',
help='Build against specified SDKs; valid args are "all", "present", or '
'comma-delimited list of engine names (default: %default)')

View File

@ -230,7 +230,8 @@ AddHL2Library('sourcemod', 'bin')
AddNormalLibrary('sourcemod.logic', 'bin')
AddNormalLibrary('sourcepawn.jit.x86', 'bin')
AddNormalLibrary('geoip.ext', 'extensions')
AddNormalLibrary('dbi.mysql.ext', 'extensions')
if SM.hasMySql:
AddNormalLibrary('dbi.mysql.ext', 'extensions')
AddNormalLibrary('dbi.sqlite.ext', 'extensions')
if 'css' in SM.sdkInfo: