Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
dia_dll.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2#
3# Copyright (c) 2012 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""
8This script is based on chromium/chromium/main/tools/clang/scripts/update.py.
9
10It is used on Windows platforms to copy the correct msdia*.dll to the
11clang folder, as a "gclient hook".
12"""
13
14import os
15import shutil
16import stat
17import sys
18
19# Path constants. (All of these should be absolute paths.)
20THIS_DIR = os.path.abspath(os.path.dirname(__file__))
21LLVM_BUILD_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', 'buildtools', 'windows-x64', 'clang'))
22
23
25 """Get the location of msdia*.dll for the platform."""
26
27 # Bump after VC updates.
28 DIA_DLL = {
29 '2013': 'msdia120.dll',
30 '2015': 'msdia140.dll',
31 '2017': 'msdia140.dll',
32 '2019': 'msdia140.dll',
33 '2022': 'msdia140.dll',
34 }
35
36 # Don't let vs_toolchain overwrite our environment.
37 environ_bak = os.environ
38
39 sys.path.append(os.path.join(THIS_DIR, '..', '..', 'build'))
40 import vs_toolchain
43
44 if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))):
45 # Depot tools .zip layout:
46 # \- DIA SDK
47 # \- Windows Kits
48 # \- 10
49 # \- ... # Location of `DEPOT_TOOLS_WIN_TOOLCHAIN`
50 dia_path = os.path.join(win_sdk_dir, '..', '..', 'DIA SDK', 'bin', 'amd64')
51 else:
52 if 'GYP_MSVS_OVERRIDE_PATH' in os.environ:
53 vs_path = os.environ['GYP_MSVS_OVERRIDE_PATH']
54 else:
56 dia_path = os.path.join(vs_path, 'DIA SDK', 'bin', 'amd64')
57
58 os.environ = environ_bak
59 return os.path.join(dia_path, DIA_DLL[msvs_version])
60
61
62def CopyFile(src, dst):
63 """Copy a file from src to dst."""
64 print("Copying %s to %s" % (str(src), str(dst)))
65 shutil.copy(src, dst)
66
67
68def CopyDiaDllTo(target_dir):
69 # This script always wants to use the 64-bit msdia*.dll.
70 dia_dll = GetDiaDll()
71 CopyFile(dia_dll, target_dir)
72
73
74def main():
75 CopyDiaDllTo(os.path.join(LLVM_BUILD_DIR, 'bin'))
76 return 0
77
78
79if __name__ == '__main__':
80 sys.exit(main())
Type::kYUV Type::kRGBA() int(0.7 *637)
void print(void *str)
Definition bridge.cpp:126
CopyDiaDllTo(target_dir)
Definition dia_dll.py:68
main()
Definition dia_dll.py:74
GetDiaDll()
Definition dia_dll.py:24
Definition main.py:1
SetEnvironmentAndGetSDKDir()
#define CopyFile