Skip to content

Commit

Permalink
Merge pull request #2220 from ix-dcourtois/fix_microsoft_build_tools_…
Browse files Browse the repository at this point in the history
…build

[build] Fix toolchain detection when using Microsoft Build Tools

(Internal change: 2319876)
  • Loading branch information
pixar-oss committed Mar 11, 2024
2 parents 6686384 + bbe0059 commit d8d5b73
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions build_scripts/build_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ def GetVisualStudioCompilerAndVersion():

msvcCompiler = which('cl')
if msvcCompiler:
# VisualStudioVersion environment variable should be set by the
# VCToolsVersion environment variable should be set by the
# Visual Studio Command Prompt.
match = re.search(
r"(\d+)\.(\d+)",
os.environ.get("VisualStudioVersion", ""))
os.environ.get("VCToolsVersion", ""))
if match:
return (msvcCompiler, tuple(int(v) for v in match.groups()))
return None
Expand All @@ -154,16 +154,17 @@ def IsVisualStudioVersionOrGreater(desiredVersion):
return version >= desiredVersion
return False

# Helpers to determine the version of "Visual Studio" (also support the Build Tools) based
# on the version of the MSVC compiler.
# See MSVC++ versions table on https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
def IsVisualStudio2022OrGreater():
VISUAL_STUDIO_2022_VERSION = (17, 0)
VISUAL_STUDIO_2022_VERSION = (14, 30)
return IsVisualStudioVersionOrGreater(VISUAL_STUDIO_2022_VERSION)

def IsVisualStudio2019OrGreater():
VISUAL_STUDIO_2019_VERSION = (16, 0)
VISUAL_STUDIO_2019_VERSION = (14, 20)
return IsVisualStudioVersionOrGreater(VISUAL_STUDIO_2019_VERSION)

def IsVisualStudio2017OrGreater():
VISUAL_STUDIO_2017_VERSION = (15, 0)
VISUAL_STUDIO_2017_VERSION = (14, 1)
return IsVisualStudioVersionOrGreater(VISUAL_STUDIO_2017_VERSION)

def GetPythonInfo(context):
Expand Down

0 comments on commit d8d5b73

Please sign in to comment.