| 
 | 1 | +conda create --yes --quiet -n et python=3.12  | 
 | 2 | +conda activate et  | 
 | 3 | + | 
 | 4 | +# Activate the VS environment - this is required for MSVC to work  | 
 | 5 | +# There are a bunch of environment variables that it requires.  | 
 | 6 | +# See https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line.  | 
 | 7 | +& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64  | 
 | 8 | + | 
 | 9 | +# Install CI requirements  | 
 | 10 | +pip install -r .ci/docker/requirements-ci.txt  | 
 | 11 | + | 
 | 12 | +# Create build directory  | 
 | 13 | +$buildDir = "cmake-out-msvc"  | 
 | 14 | +if (Test-Path -Path $buildDir) {  | 
 | 15 | +    Remove-Item -Path $buildDir -Recurse -Force  | 
 | 16 | +}  | 
 | 17 | +New-Item -Path $buildDir -ItemType Directory  | 
 | 18 | + | 
 | 19 | +# Configure CMake with MSVC (not ClangCL) and disable custom/quantized ops  | 
 | 20 | +cmake -S . -B $buildDir `  | 
 | 21 | +    -DCMAKE_BUILD_TYPE=Release `  | 
 | 22 | +    -DEXECUTORCH_BUILD_EXECUTOR_RUNNER=ON `  | 
 | 23 | +    -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON `  | 
 | 24 | +    -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON `  | 
 | 25 | +    -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON `  | 
 | 26 | +    -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON `  | 
 | 27 | +    -DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON `  | 
 | 28 | +    -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON `  | 
 | 29 | +    -DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF `  | 
 | 30 | +    -DEXECUTORCH_BUILD_KERNELS_CUSTOM_AOT=OFF `  | 
 | 31 | +    -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=OFF `  | 
 | 32 | +    -DEXECUTORCH_BUILD_XNNPACK=ON `  | 
 | 33 | +    -DEXECUTORCH_BUILD_EXTENSION_LLM=ON `  | 
 | 34 | +    -DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON  | 
 | 35 | + | 
 | 36 | +if ($LASTEXITCODE -ne 0) {  | 
 | 37 | +    Write-Host "CMake configuration failed. Exit code: $LASTEXITCODE."  | 
 | 38 | +    exit $LASTEXITCODE  | 
 | 39 | +}  | 
 | 40 | + | 
 | 41 | +# Build with MSVC  | 
 | 42 | +cmake --build $buildDir --config Release -j16  | 
 | 43 | + | 
 | 44 | +if ($LASTEXITCODE -ne 0) {  | 
 | 45 | +    Write-Host "Build failed. Exit code: $LASTEXITCODE."  | 
 | 46 | +    exit $LASTEXITCODE  | 
 | 47 | +}  | 
 | 48 | + | 
 | 49 | +Write-Host "MSVC build completed successfully!"  | 
0 commit comments