def GetWinSDKDir(): """Get the location of the current SDK. Sets dia_dll as a side-effect.""" global win_sdk_dir global dia_dll if win_sdk_dir: return win_sdk_dir # Bump after VC updates. DIA_DLL = { '2013': 'msdia120.dll', '2015': 'msdia140.dll', '2017': 'msdia140.dll', } # Don't let vs_toolchain overwrite our environment. environ_bak = os.environ sys.path.append(os.path.join(CHROMIUM_DIR, 'build')) import vs_toolchain win_sdk_dir = vs_toolchain.SetEnvironmentAndGetSDKDir() msvs_version = vs_toolchain.GetVisualStudioVersion() if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))): dia_path = os.path.join(win_sdk_dir, '..', 'DIA SDK', 'bin', 'amd64') else: if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ: vs_path = vs_toolchain.DetectVisualStudioPath() else: vs_path = os.environ['GYP_MSVS_OVERRIDE_PATH'] dia_path = os.path.join(vs_path, 'DIA SDK', 'bin', 'amd64') dia_dll = os.path.join(dia_path, DIA_DLL[msvs_version]) os.environ = environ_bak return win_sdk_dir
def GetWinSDKDir(): """Get the location of the current SDK.""" global win_sdk_dir if win_sdk_dir: return win_sdk_dir # Don't let vs_toolchain overwrite our environment. environ_bak = os.environ sys.path.append(os.path.join(CHROMIUM_DIR, 'build')) import vs_toolchain win_sdk_dir = vs_toolchain.SetEnvironmentAndGetSDKDir() msvs_version = vs_toolchain.GetVisualStudioVersion() if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))): dia_path = os.path.join(win_sdk_dir, '..', 'DIA SDK', 'bin', 'amd64') else: if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ: vs_path = vs_toolchain.DetectVisualStudioPath() else: vs_path = os.environ['GYP_MSVS_OVERRIDE_PATH'] dia_path = os.path.join(vs_path, 'DIA SDK', 'bin', 'amd64') os.environ = environ_bak return win_sdk_dir
def GetDiaDll(): """Get the location of msdia*.dll for the platform.""" # Bump after VC updates. DIA_DLL = { '2013': 'msdia120.dll', '2015': 'msdia140.dll', '2017': 'msdia140.dll', '2019': 'msdia140.dll', } # Don't let vs_toolchain overwrite our environment. environ_bak = os.environ sys.path.append(os.path.join(THIS_DIR, '..', '..', 'build')) import vs_toolchain win_sdk_dir = vs_toolchain.SetEnvironmentAndGetSDKDir() msvs_version = vs_toolchain.GetVisualStudioVersion() if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))): dia_path = os.path.join(win_sdk_dir, '..', 'DIA SDK', 'bin', 'amd64') else: if 'GYP_MSVS_OVERRIDE_PATH' in os.environ: vs_path = os.environ['GYP_MSVS_OVERRIDE_PATH'] else: vs_path = vs_toolchain.DetectVisualStudioPath() dia_path = os.path.join(vs_path, 'DIA SDK', 'bin', 'amd64') os.environ = environ_bak return os.path.join(dia_path, DIA_DLL[msvs_version])
def _DetectVisualStudioPath(): """Return path to the installed Visual Studio. """ # Use the code in build/vs_toolchain.py to avoid duplicating code. chromium_dir = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..', '..')) sys.path.append(os.path.join(chromium_dir, 'build')) import vs_toolchain return vs_toolchain.DetectVisualStudioPath()
def _DetectVisualStudioPath(): """Return path to the GYP_MSVS_VERSION of Visual Studio. """ import vs_toolchain return vs_toolchain.DetectVisualStudioPath()
# Copyright (c) 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Helper script to do the heavy lifting for setenv.bat. """ import os import sys script_path = os.path.abspath(os.path.dirname(__file__)) build_path = os.path.normpath(os.path.join(script_path, '..', '..', 'build')) sys.path.append(build_path) import vs_toolchain if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))): win_sdk_dir = vs_toolchain.SetEnvironmentAndGetSDKDir() print os.path.normpath(os.path.join(win_sdk_dir, 'bin/SetEnv.cmd')) else: vs_version = vs_toolchain.GetVisualStudioVersion() vs_path = vs_toolchain.DetectVisualStudioPath() if vs_version == '2017': print os.path.join(vs_path, r'VC\Auxiliary\Build\vcvarsall.bat') elif vs_version == '2015': print os.path.join(vs_path, r'VC\vcvarsall.bat') else: raise Exception('Unknown VS version %s' % vs_version)