Update ambuild tooling to work on both Windows / Linux with boost distrib (#3)

* Add Windows / msvc boost support on AMBuild

* Disable RTTI and use config on b2's side

* Update AMBuild to require boost's setup on Windows / Linux

* Remove HL2SDK and MM:S settings in configure/buildscript

* Indenting is hard
This commit is contained in:
nosoop
2020-03-22 17:35:54 -04:00
committed by GitHub
parent 624d2423c3
commit c168b3b4b4
3 changed files with 49 additions and 29 deletions
+15 -11
View File
@@ -26,7 +26,7 @@ class ExtensionConfig(object):
def __init__(self):
self.extensions = []
self.sm_root = None
self.mms_root = None
self.boost_root = None
@property
def tag(self):
@@ -49,15 +49,11 @@ class ExtensionConfig(object):
self.sm_root = Normalize(self.sm_root)
def detectMetaMod(self):
if builder.options.mms_path:
self.mms_root = builder.options.mms_path
def detectBoost(self):
if builder.options.boost_path:
self.boost_root = builder.options.boost_path
else:
self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10')
if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE', 'metamod-source')
if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central')
raise Exception('Could not find a copy of Boost')
def configure(self):
cxx = builder.DetectCompilers()
@@ -156,6 +152,7 @@ class ExtensionConfig(object):
'_CRT_SECURE_NO_WARNINGS',
'_CRT_NONSTDC_NO_DEPRECATE',
'_ITERATOR_DEBUG_LEVEL=0',
'_WIN32_WINNT=0x0601',
]
cxx.cflags += [
'/W3',
@@ -181,6 +178,9 @@ class ExtensionConfig(object):
'odbccp32.lib',
]
# setup boost libraries
cxx.linkflags += ['/LIBPATH:"' + os.path.join(self.boost_root, 'stage', 'x86', 'lib') + '"']
if builder.options.opt == '1':
cxx.cflags += ['/Ox', '/Zo']
cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
@@ -196,7 +196,10 @@ class ExtensionConfig(object):
cxx.defines += ['_LINUX', 'POSIX']
# link flags based off of socket Makefile
cxx.linkflags += ['-lpthread', '-Wl,-Bstatic', '-lm', '-lboost_thread', '-lboost_system', '-lstdc++', '-Wl,-Bdynamic']
cxx.linkflags += ['-lpthread', '-Wl,-Bstatic', '-lm', '-lstdc++']
cxx.linkflags += ['-L', os.path.join(self.boost_root, 'stage', 'x86', 'lib')]
cxx.linkflags += ['-lboost_thread']
cxx.linkflags += ['-Wl,-Bdynamic']
if cxx.vendor == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.vendor == 'clang':
@@ -224,6 +227,7 @@ class ExtensionConfig(object):
os.path.join(self.sm_root, 'sourcepawn', 'include'),
os.path.join(self.sm_root, 'public', 'amtl', 'amtl'),
os.path.join(self.sm_root, 'public', 'amtl'),
os.path.join(self.boost_root)
]
return compiler
@@ -233,8 +237,8 @@ class ExtensionConfig(object):
return binary
Extension = ExtensionConfig()
Extension.detectMetaMod()
Extension.detectSourceMod()
Extension.detectBoost()
Extension.configure()
# Add additional buildscripts here