@@ -172,22 +172,34 @@ try {
172172 " -DCUDAToolkit_ROOT=$env: CUDA_HOME "
173173 )
174174 }
175+ $cmakeCommonArgs = @ (" -DCMAKE_CXX_STANDARD=20" )
175176 Write-Host " ::endgroup::"
176177
177178 Write-Host " ::group::Build ExecuTorch (CUDA)"
178179 $numCores = [Math ]::Max([Environment ]::ProcessorCount - 1 , 1 )
180+ $cmakeOut = Join-Path - Path $executorchRoot - ChildPath " cmake-out"
181+ $executorchCmakeDir = Join-Path - Path $cmakeOut - ChildPath " lib\cmake\ExecuTorch"
182+ $executorchConfig = Join-Path - Path $executorchCmakeDir - ChildPath " executorch-config.cmake"
179183 # EXECUTORCH_BUILD_EXTENSION_IMAGE defaults OFF in the preset, so it must be
180184 # enabled explicitly here (matching the Makefile CUDA target used on Linux).
181185 # The dinov2 runner links the installed extension_image.lib; without this the
182186 # main install never builds it and dinov2_runner fails to link (LNK1181).
183- cmake -- preset llm- release- cuda - DEXECUTORCH_BUILD_EXTENSION_IMAGE= ON @cmakeCudaArgs
184- cmake -- build cmake- out -- target install -- config Release - j $numCores
187+ cmake -- preset llm- release- cuda - DEXECUTORCH_BUILD_EXTENSION_IMAGE= ON @cmakeCommonArgs @cmakeCudaArgs
188+ cmake -- build $cmakeOut -- target install -- config Release - j $numCores
189+ if (-not (Test-Path - Path $executorchConfig - PathType Leaf)) {
190+ throw " ExecuTorch CMake package config not found after install: $executorchConfig "
191+ }
185192 Write-Host " ::endgroup::"
186193
187194 Write-Host " ::group::Build $runnerTarget "
195+ $cmakePackageArgs = @ (
196+ " -DCMAKE_FIND_ROOT_PATH=$cmakeOut " ,
197+ " -DCMAKE_PREFIX_PATH=$cmakeOut ;$executorchCmakeDir " ,
198+ " -Dexecutorch_DIR=$executorchCmakeDir "
199+ )
188200 Push-Location (Join-Path - Path $executorchRoot - ChildPath " examples\models\$runnerPath " )
189201 try {
190- cmake -- preset $runnerPreset @cmakeCudaArgs
202+ cmake -- preset $runnerPreset @cmakeCommonArgs @cmakePackageArgs @ cmakeCudaArgs
191203 cmake -- build (Join-Path - Path $executorchRoot - ChildPath " cmake-out\examples\models\$runnerPath " ) -- target $runnerTarget -- config Release - j $numCores
192204 }
193205 finally {
0 commit comments