Support MSVC (2015) build tools

This commit is contained in:
Brent Taylor 2017-07-26 21:45:11 -07:00
parent a116f04a3e
commit 90f853f710
2 changed files with 12 additions and 4 deletions

View File

@ -62,7 +62,7 @@ platform_arg = ARGUMENTS.get("platform", ARGUMENTS.get("p", False))
if (os.name == "posix"): if (os.name == "posix"):
pass pass
elif (os.name == "nt"): elif (os.name == "nt"):
if (os.getenv("VSINSTALLDIR") == None or platform_arg == "android"): if (os.getenv("VCINSTALLDIR") == None or platform_arg == "android"):
custom_tools = ['mingw'] custom_tools = ['mingw']
env_base = Environment(tools=custom_tools) env_base = Environment(tools=custom_tools)
@ -283,7 +283,15 @@ if selected_platform in platform_list:
if (env["warnings"] == 'yes'): if (env["warnings"] == 'yes'):
print("WARNING: warnings=yes is deprecated; assuming warnings=all") print("WARNING: warnings=yes is deprecated; assuming warnings=all")
if (os.name == "nt" and os.getenv("VSINSTALLDIR")): # MSVC, needs to stand out of course if (os.name == "nt" and os.getenv("VCINSTALLDIR")): # MSVC, needs to stand out of course
# This is an ugly hack. It's possible (and common in the case of having older versions of MSVC installed)
# to have MSVC installed but not Visual Studio itself. If this happens the environment variable
# "VSINSTALLDIR" is never set as Visual Studio isn't installed. However, near as I can figure out,
# internally scons uses the "VSINSTALLDIR" environment variable for something so it needs to be set.
# So we set it to the same directory as MSVC itself. It's an ugly hack but it works without side effects.
if os.getenv("VSINSTALLDIR") is None:
os.environ["VSINSTALLDIR"] = os.getenv("VCINSTALLDIR")
disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions... disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions...
if (env["warnings"] == 'extra'): if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['/Wall']) # Implies /W4 env.Append(CCFLAGS=['/Wall']) # Implies /W4

View File

@ -114,7 +114,7 @@ def can_build():
if (os.name == "nt"): if (os.name == "nt"):
# building natively on windows! # building natively on windows!
if (os.getenv("VSINSTALLDIR")): if (os.getenv("VCINSTALLDIR")):
return True return True
else: else:
print("\nMSVC not detected, attempting Mingw.") print("\nMSVC not detected, attempting Mingw.")
@ -214,7 +214,7 @@ def configure(env):
winver = "0x0600" # Windows Vista is the minimum target for windows builds winver = "0x0600" # Windows Vista is the minimum target for windows builds
env['is_mingw'] = False env['is_mingw'] = False
if (os.name == "nt" and os.getenv("VSINSTALLDIR") != None): if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
# build using visual studio # build using visual studio
env['ENV']['TMP'] = os.environ['TMP'] env['ENV']['TMP'] = os.environ['TMP']
env.Append(CPPPATH=['#platform/windows/include']) env.Append(CPPPATH=['#platform/windows/include'])