1- param ($LLVMDirectory = " " , $ToolsetName = " " <# , $ClangClToolsetName = ""#> )
1+ param ($LLVMDirectory = " " , $ToolsetName = " " , $ClangClToolsetName = " " )
22$id = [System.Security.Principal.WindowsIdentity ]::GetCurrent()
33$principal = new-object System.Security.Principal.WindowsPrincipal($id )
44
9292 }
9393 }
9494
95- <#
9695 if ($reset -or ($ClangClToolsetName -eq " " -and (Read-Host " Do you want to install a toolset for clang-cl? (y/N)" ) -match " y|yes" )) {
9796 $prompt = " What is the clang-cl toolset name?"
9897 if ($reset ) {
9998 $prompt += " (current: $ClangClToolsetName )"
10099 } else {
101- $prompt += " (default: v100_clang_fafnir )"
100+ $prompt += " (default: fafnir_clang_cl )"
102101 }
103102 $tmp = Read-Host $prompt
104103 if ($tmp -eq " " -and $ClangClToolsetName -eq " " ) {
105104 $ClangClToolsetName = " fafnir_clang_cl"
106105 }
107106 }
108- #>
109107
110108 " "
111109 " === Install configuration ==="
112110 " * LLVM install directory: $LLVMDirectory "
113111 " * Toolset name: $ToolsetName "
114- <#
115112 if ($ClangClToolsetName -eq " " ) {
116113 " * Clang-cl toolset won't install."
117114 } else {
118115 " * Clang-cl toolset: $ClangClToolsetName "
119116 }
120- #>
121117 " "
122118 $reset = $true
123119} while ((Read-Host " Is it OK to install? (Y/n)" ) -match " n|no" )
@@ -127,10 +123,11 @@ $assets = "$rootDir\assets"
127123$bin = " $rootDir \bin\clang.exe"
128124
129125function Install ($arch ) {
130- if (! (Test-Path " $VSInstallDir \Common7\IDE\VC\VCTargets\Platforms\$arch " )) {
126+ $platformDir = " $VSInstallDir \Common7\IDE\VC\VCTargets\Platforms\$arch \PlatformToolsets" ;
127+ if (! (Test-Path $platformDir )) {
131128 return
132129 }
133- $targetPath = " $VSInstallDir \Common7\IDE\VC\VCTargets\Platforms\ $arch \PlatformToolsets \$ToolsetName "
130+ $targetPath = " $platformDir \$ToolsetName "
134131
135132 if (! (Test-Path $targetPath )) {
136133 New-Item - ItemType Directory $targetPath
@@ -144,6 +141,16 @@ function Install ($arch) {
144141 }
145142 Copy-Item $bin " $targetPath \bin"
146143 Set-Content - Path " $targetPath \bin\.target" " $LLVMDirectory \bin\clang.exe" - Encoding UTF8 - NoNewline
144+
145+ if ($ClangClToolsetName -ne " " ) {
146+ $targetPath = " $platformDir \$ClangClToolsetName "
147+ if (! (Test-Path $targetPath )) {
148+ New-Item - ItemType Directory $targetPath
149+ }
150+ Copy-Item " $assets \clang-cl\Toolset.targets" " $targetPath "
151+ $content = (Get-Content - Encoding UTF8 " $assets \clang-cl\Toolset.props" ) -replace " {{LLVMDir}}" , $LLVMDirectory
152+ Set-Content " $targetPath \Toolset.props" $content - Encoding UTF8 | Out-Null
153+ }
147154}
148155
149156Install " Win32"
0 commit comments