Skip to content

Commit

Permalink
update build scipts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattias Jansson committed Jul 14, 2021
1 parent 6164243 commit 3f6214b
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions build/ninja/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
self.dllcmd = self.linkcmd + ' /DLL'

self.cflags = ['/D', '"' + project.upper() + '_COMPILE=1"', '/D', '"_UNICODE"', '/D', '"UNICODE"', '/std:c17', '/Zi', '/Oi', '/Oy-', '/GS-', '/Gy-', '/Qpar-', '/fp:fast', '/fp:except-', '/Zc:forScope', '/Zc:wchar_t', '/GR-', '/openmp-']
self.cwarnflags = ['/W4', '/WX']
self.cwarnflags = ['/W4', '/WX', '/wd4201'] #Ignore nameless union/struct which is allowed in C11
self.cmoreflags = []
self.arflags = ['/ignore:4221'] #Ignore empty object file warning]
self.linkflags = ['/DEBUG']
Expand Down Expand Up @@ -138,10 +138,11 @@ def build_toolchain(self):
tools_list.sort(key=StrictVersion)
self.toolchain = os.path.join(tools_basepath, tools_list[-1])
self.toolchain_version = major_version + ".0"
break

if self.toolchain == '':
toolchain = ''
versions = ['16.0', '15.0', '14.0', '13.0', '12.0', '11.0', '10.0']
versions = ['17.0', '16.0', '15.0']
keys = [
'HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7',
'HKCU\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7',
Expand All @@ -161,12 +162,11 @@ def build_toolchain(self):
except:
continue
if not toolchain == '':
if version == '15.0' or version == '16.0':
tools_basepath = os.path.join(toolchain, 'VC', 'Tools', 'MSVC')
tools_list = [item for item in os.listdir(tools_basepath) if os.path.isdir(os.path.join(tools_basepath, item))]
from distutils.version import StrictVersion
tools_list.sort(key=StrictVersion)
toolchain = os.path.join(tools_basepath, tools_list[-1])
tools_basepath = os.path.join(toolchain, 'VC', 'Tools', 'MSVC')
tools_list = [item for item in os.listdir(tools_basepath) if os.path.isdir(os.path.join(tools_basepath, item))]
from distutils.version import StrictVersion
tools_list.sort(key=StrictVersion)
toolchain = os.path.join(tools_basepath, tools_list[-1])
self.toolchain = toolchain
self.toolchain_version = version
break
Expand Down Expand Up @@ -239,13 +239,10 @@ def make_libpaths(self, libpaths):
return []

def make_arch_toolchain_path(self, arch):
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
if arch == 'x86-64':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x64\\')
elif arch == 'x86':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x86\\')
if arch == 'x86-64':
return os.path.join(self.toolchain, 'bin', 'amd64\\')
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x64\\')
elif arch == 'x86':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x86\\')
return os.path.join(self.toolchain, 'bin\\')

def make_carchflags(self, arch, targettype):
Expand Down Expand Up @@ -323,20 +320,14 @@ def make_configlibpaths(self, config, arch, extralibpaths):
libpaths += [os.path.join(libpath, self.libpath, config, arch) for libpath in extralibpaths]
if self.sdkpath != '':
if arch == 'x86':
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
libpaths += [os.path.join(self.toolchain, 'lib', 'x86')]
else:
libpaths += [os.path.join(self.toolchain, 'lib')]
libpaths += [os.path.join(self.toolchain, 'lib', 'x86')]
if self.sdkversion == 'v8.1':
libpaths += [os.path.join( self.sdkpath, 'lib', 'winv6.3', 'um', 'x86')]
if self.sdkversion == 'v10.0':
libpaths += [os.path.join(self.sdkpath, 'lib', self.sdkversionpath, 'um', 'x86')]
libpaths += [os.path.join(self.sdkpath, 'lib', self.sdkversionpath, 'ucrt', 'x86')]
else:
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
libpaths += [os.path.join( self.toolchain, 'lib', 'x64')]
else:
libpaths += [os.path.join( self.toolchain, 'lib', 'amd64')]
libpaths += [os.path.join( self.toolchain, 'lib', 'x64')]
if self.sdkversion == 'v8.1':
libpaths += [os.path.join( self.sdkpath, 'lib', 'winv6.3', 'um', 'x64')]
if self.sdkversion == 'v10.0':
Expand Down

0 comments on commit 3f6214b

Please sign in to comment.