core: Add Insurgency support for amd64 Windows (#1295)
* Add basic Insurgency support on Windows x64 This allows SourceMod to load on x64 Insurgency. There are still a lot of variable truncation warnings that have to be dealt with. * Fix 32bit builds * Compile MySQL extension as well The hack for __iob_func being removed from the core runtime, but required by the old mysql we're building against can be simplified a lot due to the `_ReturnAddress` intrinsic available since MSVC 2015. * Don't include the offset we want to extract in the signature
This commit is contained in:
+24
-14
@@ -97,6 +97,8 @@ def SetArchFlags(compiler, arch, platform):
|
||||
compiler.linkflags += ['/MACHINE:X86']
|
||||
elif builder.target.arch == 'x64':
|
||||
compiler.linkflags += ['/MACHINE:X64']
|
||||
if arch == 'x64':
|
||||
compiler.defines += ['WIN64']
|
||||
|
||||
def AppendArchSuffix(binary, name, arch):
|
||||
if arch == 'x64':
|
||||
@@ -180,19 +182,19 @@ class SMConfig(object):
|
||||
self.mms_root = Normalize(self.mms_root)
|
||||
|
||||
if builder.options.hasMySql:
|
||||
if builder.options.mysql_path:
|
||||
self.mysql_root['x86'] = builder.options.mysql_path
|
||||
else:
|
||||
for i in range(10):
|
||||
self.mysql_root['x86'] = ResolveEnvPath('MYSQL55', 'mysql-5.' + str(i))
|
||||
if self.mysql_root['x86']:
|
||||
break
|
||||
if not self.mysql_root['x86'] or not os.path.isdir(self.mysql_root['x86']):
|
||||
raise Exception('Could not find a path to MySQL!')
|
||||
self.mysql_root['x86'] = Normalize(self.mysql_root['x86'])
|
||||
if 'x86' in self.archs:
|
||||
if builder.options.mysql_path:
|
||||
self.mysql_root['x86'] = builder.options.mysql_path
|
||||
else:
|
||||
for i in range(10):
|
||||
self.mysql_root['x86'] = ResolveEnvPath('MYSQL55', 'mysql-5.' + str(i))
|
||||
if self.mysql_root['x86']:
|
||||
break
|
||||
if not self.mysql_root['x86'] or not os.path.isdir(self.mysql_root['x86']):
|
||||
raise Exception('Could not find a path to MySQL!')
|
||||
self.mysql_root['x86'] = Normalize(self.mysql_root['x86'])
|
||||
|
||||
# For now, ignore 64-bit MySQL on Windows
|
||||
if 'x64' in self.archs and builder.target.platform != 'windows':
|
||||
if 'x64' in self.archs:
|
||||
if builder.options.mysql64_path:
|
||||
self.mysql_root['x64'] = builder.options.mysql64_path
|
||||
else:
|
||||
@@ -490,6 +492,7 @@ class SMConfig(object):
|
||||
|
||||
def ExtLibrary(self, context, name, arch):
|
||||
binary = self.Library(context, name, arch)
|
||||
SetArchFlags(binary.compiler, arch, builder.target.platform)
|
||||
self.ConfigureForExtension(context, binary.compiler)
|
||||
return binary
|
||||
|
||||
@@ -533,7 +536,11 @@ class SMConfig(object):
|
||||
compiler.defines.remove('_vsnprintf=vsnprintf')
|
||||
|
||||
if compiler.like('msvc'):
|
||||
compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32']
|
||||
compiler.defines += ['COMPILER_MSVC']
|
||||
if arch == 'x86':
|
||||
compiler.defines += ['COMPILER_MSVC32']
|
||||
elif arch == 'x64':
|
||||
compiler.defines += ['COMPILER_MSVC64']
|
||||
compiler.linkflags += ['legacy_stdio_definitions.lib']
|
||||
else:
|
||||
compiler.defines += ['COMPILER_GCC']
|
||||
@@ -611,7 +618,10 @@ class SMConfig(object):
|
||||
if sdk.name in ['swarm', 'blade', 'insurgency', 'doi', 'csgo']:
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
|
||||
if arch == 'x86':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
|
||||
elif arch == 'x64':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', 'win64', lib) + '.lib'
|
||||
compiler.linkflags.append(compiler.Dep(lib_path))
|
||||
|
||||
for library in dynamic_libs:
|
||||
|
||||
Reference in New Issue
Block a user