diff llvm/utils/sysroot.py @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 79ff65ed7e25
children 1f2b6ac9f198
line wrap: on
line diff
--- a/llvm/utils/sysroot.py	Wed Jul 21 10:27:27 2021 +0900
+++ b/llvm/utils/sysroot.py	Wed Nov 09 17:45:10 2022 +0900
@@ -13,6 +13,10 @@
         return subprocess.check_output(cmd).decode(sys.stdout.encoding).strip()
 
     if sys.platform == 'win32':
+        def mkjunction(dst, src):
+            subprocess.check_call(['mklink', '/j', dst, src], shell=True)
+
+        os.mkdir(out_dir)
         p = os.getenv('ProgramFiles(x86)', 'C:\\Program Files (x86)')
 
         winsdk = os.getenv('WindowsSdkDir')
@@ -20,6 +24,8 @@
             winsdk = os.path.join(p, 'Windows Kits', '10')
             print('%WindowsSdkDir% not set. You might want to run this from')
             print('a Visual Studio cmd prompt. Defaulting to', winsdk)
+        os.mkdir(os.path.join(out_dir, 'Windows Kits'))
+        mkjunction(os.path.join(out_dir, 'Windows Kits', '10'), winsdk)
 
         vswhere = os.path.join(
                 p, 'Microsoft Visual Studio', 'Installer', 'vswhere')
@@ -28,13 +34,12 @@
                 [vswhere, '-latest', '-products', '*', '-requires', vcid,
                     '-property', 'installationPath'])
 
-        def mkjunction(dst, src):
-            subprocess.check_call(['mklink', '/j', dst, src], shell=True)
-        os.mkdir(out_dir)
         mkjunction(os.path.join(out_dir, 'VC'),
                    os.path.join(vsinstalldir, 'VC'))
-        os.mkdir(os.path.join(out_dir, 'Windows Kits'))
-        mkjunction(os.path.join(out_dir, 'Windows Kits', '10'), winsdk)
+        # Not all MSVC versions ship the DIA SDK, so the junction destination
+        # might not exist. That's fine.
+        mkjunction(os.path.join(out_dir, 'DIA SDK'),
+                   os.path.join(vsinstalldir, 'DIA SDK'))
     elif sys.platform == 'darwin':
         # The SDKs used by default in compiler-rt/cmake/base-config-ix.cmake.
         # COMPILER_RT_ENABLE_IOS defaults to on.