|
| 1 | +# Build script for windows CPU |
| 2 | +# TODO unify this with the other Win scripts |
| 3 | + |
| 4 | +param ( |
| 5 | + [switch]$clone = $false, |
| 6 | + [switch]$install = $false, |
| 7 | + [string]$libsDir = "C:\" |
| 8 | +) |
| 9 | + |
| 10 | +$ErrorActionPreference = "Stop" |
| 11 | + |
| 12 | +$RepoURL = 'https://github.com/taichi-dev/taichi' |
| 13 | + |
| 14 | +function WriteInfo($text) { |
| 15 | + Write-Host -ForegroundColor Green "[BUILD] $text" |
| 16 | +} |
| 17 | + |
| 18 | +$libsDir = (Resolve-Path $libsDir).Path |
| 19 | +if (-not (Test-Path $libsDir)) { |
| 20 | + New-Item -ItemType Directory -Path $libsDir |
| 21 | +} |
| 22 | +Set-Location $libsDir |
| 23 | + |
| 24 | +if (-not (Test-Path "taichi_llvm")) { |
| 25 | + WriteInfo("Download and extract LLVM") |
| 26 | + 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 |
| 27 | + 7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm |
| 28 | +} |
| 29 | +if (-not (Test-Path "taichi_clang")) { |
| 30 | + WriteInfo("Download and extract Clang") |
| 31 | + curl.exe --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO |
| 32 | + 7z x clang-10.0.0-win.zip -otaichi_clang |
| 33 | +} |
| 34 | + |
| 35 | +WriteInfo("Setting the env vars") |
| 36 | +$env:LLVM_DIR = "C://taichi_llvm" |
| 37 | + |
| 38 | +#TODO enable build test |
| 39 | +$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" |
| 40 | + |
| 41 | +#TODO: For now we need to hard code the compiler path from build tools 2019 |
| 42 | +$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' |
| 43 | +$env:TAICHI_CMAKE_ARGS += " -DCLANG_EXECUTABLE=C:\\taichi_clang\\bin\\clang++.exe" |
| 44 | +$env:TAICHI_CMAKE_ARGS += " -DLLVM_AS_EXECUTABLE=C:\\taichi_llvm\\bin\\llvm-as.exe -DTI_WITH_VULKAN:BOOL=OFF" |
| 45 | + |
| 46 | +WriteInfo("Checking clang compiler") |
| 47 | +clang --version |
| 48 | + |
| 49 | +WriteInfo("Enter the repository") |
| 50 | +Set-Location .\taichi |
| 51 | + |
| 52 | +WriteInfo("Setting up Python environment") |
| 53 | +conda activate py37 |
| 54 | +python -m pip install -r requirements_dev.txt |
| 55 | +python -m pip install -r requirements_test.txt |
| 56 | + |
| 57 | +# These have to be re-installed to avoid strange certificate issue |
| 58 | +# on CPU docker environment |
| 59 | +python -m pip install --upgrade --force-reinstall numpy |
| 60 | +python -m pip install --upgrade --force-reinstall cmake |
| 61 | +python -m pip install --upgrade --force-reinstall wheel |
| 62 | +if (-not $?) { exit 1 } |
| 63 | + |
| 64 | +WriteInfo("Building Taichi") |
| 65 | +python setup.py install |
| 66 | +if (-not $?) { exit 1 } |
| 67 | +WriteInfo("Build finished") |
| 68 | + |
| 69 | +$env:TI_ENABLE_PADDLE = "0" |
| 70 | +WriteInfo("Testing Taichi") |
| 71 | +python tests/run_tests.py -vr2 -t4 -k "not torch and not paddle" -a cpu |
| 72 | +WriteInfo("Test finished") |
0 commit comments