1- param ([switch ] $Generate , [switch ] $Install , [switch ] $InstallOnly , [switch ] $Debug )
1+ param ([switch ] $Generate , [switch ] $Install , [switch ] $InstallOnly , [switch ] $Debug , [ string ] $UbaEngine )
22
33$global :ErrorActionPreference = ' Stop'
44
@@ -15,19 +15,31 @@ function Invoke-CmdScript {
1515 }
1616}
1717
18- $UbaViaUet = (Test-Path " C:\ProgramData\UET\Current\uet.exe" )
19-
2018Push-Location " $PSScriptRoot \.."
2119try {
2220 # Set the build path.
2321 $BuildPathDebug = " build\win64\debug"
2422 $BuildPathRelease = " build\win64\release"
25- $LauncherFlags = @ ()
26- $UbaCores = @ ()
27- if ($UbaViaUet ) {
28- $LauncherFlags += " -DCMAKE_C_COMPILER_LAUNCHER=$PSScriptRoot \uet-cmake.bat"
29- $LauncherFlags += " -DCMAKE_CXX_COMPILER_LAUNCHER=$PSScriptRoot \uet-cmake.bat"
30- $UbaCores += " -j256"
23+ $CMakeCommand = " C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
24+ $CMakeCommandArguments = @ (
25+ )
26+ $CMakeCommandGenerateArguments = @ (
27+ " -G" ,
28+ " Ninja"
29+ )
30+ if ($null -ne $UbaEngine ) {
31+ $CMakeCommand = " uet" ;
32+ if (Test-Path " C:\Work\uet\UET\uet\bin\Debug\net9.0\win-x64\uet.exe" ) {
33+ $CMakeCommand = " C:\Work\uet\UET\uet\bin\Debug\net9.0\win-x64\uet.exe"
34+ }
35+ $CMakeCommandArguments = @ (
36+ " cmake" ,
37+ " -e" ,
38+ $UbaEngine ,
39+ " --"
40+ )
41+ $CMakeCommandGenerateArguments = @ (
42+ )
3143 }
3244
3345 # Create the session ID for this build.
4658 if (! (Test-Path $BuildPathRelease )) {
4759 New-Item - ItemType Directory $BuildPathRelease | Out-Null
4860 }
49- # -T host=x64 -A x64 `
50- & ' C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' `
51- - G " Ninja" `
61+
62+ & $CMakeCommand $CMakeCommandArguments $CMakeCommandGenerateArguments `
5263 " -DCMAKE_MAKE_PROGRAM=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" `
5364 " -DLLVM_ENABLE_PROJECTS:STRING=clang;lld" `
5465 " -DCMAKE_C_COMPILER=C:\Program Files\LLVM\bin\clang-cl.exe" `
7384 if ($LastExitCode -ne 0 ) {
7485 exit $LastExitCode
7586 }
76- & ' C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' `
77- - G " Ninja" `
87+ & $CMakeCommand $CMakeCommandArguments $CMakeCommandGenerateArguments `
7888 " -DCMAKE_MAKE_PROGRAM=C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" `
7989 " -DLLVM_ENABLE_PROJECTS:STRING=clang;lld" `
8090 " -DCMAKE_C_COMPILER=C:\Program Files\LLVM\bin\clang-cl.exe" `
@@ -111,15 +121,9 @@ try {
111121
112122 # Build if not only installing.
113123 if (! $InstallOnly ) {
114- # Start UBA worker if needed.
115- if ($UbaViaUet ) {
116- Start-Process - NoNewWindow - FilePath " C:\Work\uet\UET\uet\bin\Debug\net8.0\win-x64\uet.exe" - ArgumentList @ (" internal" , " cmake-uba-server" )
117- }
118-
119- & ' C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe' `
124+ & $CMakeCommand $CMakeCommandArguments `
120125 -- build $BuildPath `
121- -- config $BuildConfiguration `
122- $UbaCores
126+ -- config $BuildConfiguration
123127 if ($LastExitCode -ne 0 ) {
124128 exit $LastExitCode
125129 }
0 commit comments