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