|
| 1 | +# Build script for windows |
| 2 | + |
| 3 | +param ( |
| 4 | + [switch]$develop = $false, |
| 5 | + [switch]$install = $false, |
| 6 | + [string]$libsDir = "C:\" |
| 7 | +) |
| 8 | + |
| 9 | +$ErrorActionPreference = "Stop" |
| 10 | + |
| 11 | +function WriteInfo($text) { |
| 12 | + Write-Host -ForegroundColor Green "[BUILD] $text" |
| 13 | +} |
| 14 | + |
| 15 | +$libsDir = (Resolve-Path $libsDir).Path |
| 16 | +if (-not (Test-Path $libsDir)) { |
| 17 | + New-Item -ItemType Directory -Path $libsDir |
| 18 | +} |
| 19 | +Push-Location $libsDir |
| 20 | + |
| 21 | +if (-not (Test-Path "taichi_llvm")) { |
| 22 | + WriteInfo("Download and extract LLVM") |
| 23 | + curl.exe --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip -LO |
| 24 | + 7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm |
| 25 | +} |
| 26 | +if (-not (Test-Path "taichi_clang")) { |
| 27 | + WriteInfo("Download and extract Clang") |
| 28 | + curl.exe --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO |
| 29 | + 7z x clang-10.0.0-win.zip -otaichi_clang |
| 30 | +} |
| 31 | + |
| 32 | +WriteInfo("Setting the env vars") |
| 33 | + |
| 34 | +$env:LLVM_DIR = "C://taichi_llvm" |
| 35 | +$env:TAICHI_CMAKE_ARGS = "-DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=OFF -DTI_WITH_CUDA:BOOL=OFF -DTI_BUILD_TESTS:BOOL=OFF" |
| 36 | + |
| 37 | +#TODO: For now we have to hard code the compiler path from build tools 2019 |
| 38 | +$env:TAICHI_CMAKE_ARGS +=' -DCMAKE_CXX_COMPILER=C:/Program\ Files\ (x86)/Microsoft\ Visual\ Studio/2019/BuildTools/vc/Tools/Llvm/x64/bin/clang++.exe -DCMAKE_C_COMPILER=C:/Program\ Files\ (x86)/Microsoft\ Visual\ Studio/2019/BuildTools/vc/Tools/Llvm/x64/bin/clang.exe' |
| 39 | +$env:TAICHI_CMAKE_ARGS += " -DCLANG_EXECUTABLE=C:\\taichi_clang\\bin\\clang++.exe" |
| 40 | +$env:TAICHI_CMAKE_ARGS += " -DLLVM_AS_EXECUTABLE=C:\\taichi_llvm\\bin\\llvm-as.exe -DTI_WITH_VULKAN:BOOL=OFF" |
| 41 | + |
| 42 | +Pop-Location |
| 43 | +clang --version |
| 44 | + |
| 45 | +WriteInfo("Enter the repository") |
| 46 | +Set-Location .\test_actions |
| 47 | + |
| 48 | +WriteInfo("Setting up Python environment") |
| 49 | +conda activate py37 |
| 50 | + |
| 51 | +python -m pip install numpy |
| 52 | +python -m pip install wheel |
| 53 | +python -m pip install -r requirements_dev.txt |
| 54 | +python -m pip install -r requirements_test.txt |
| 55 | +if (-not $?) { exit 1 } |
| 56 | + |
| 57 | +WriteInfo("Building Taichi") |
| 58 | +python setup.py develop |
| 59 | +if (-not $?) { exit 1 } |
| 60 | +WriteInfo("Build finished") |
| 61 | + |
| 62 | + |
| 63 | +WriteInfo("Testing Taichi") |
| 64 | +python tests/run_tests.py -vr2 -t2 -k "not torch and not paddle" -a cpu |
| 65 | +WriteInfo("Test finished") |
0 commit comments