-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ci] Add build script for win #3410
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9d9f21c
add build scripts for win
frostming 6638773
Don't create dir if exists
frostming 6004e10
install wheel
frostming 875eb67
activate venv for testing
frostming 1d0cb0a
fix the cmake args
frostming b1c28c4
Update release.yml to use the script
frostming 0b376c1
change the option name
frostming 88818b4
update the option name as requested
frostming 1f67bef
change libsdir default to .
frostming 1fbd7d6
show the verbose output
frostming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Build script for windows | ||
|
||
param ( | ||
[switch]$clone = $false, | ||
[switch]$installVulkan = $false, | ||
[switch]$develop = $false, | ||
[switch]$install = $false, | ||
[string]$libsDir = "." | ||
) | ||
|
||
$RepoURL = 'https://github.com/taichi-dev/taichi' | ||
|
||
function WriteInfo($text) { | ||
Write-Host -ForegroundColor Green "[BUILD] $text" | ||
} | ||
|
||
WriteInfo("Install 7Zip") | ||
Install-Module 7Zip4PowerShell -Force -Verbose -Scope CurrentUser | ||
|
||
if ($clone) { | ||
WriteInfo("Clone the repository") | ||
git clone --recurse-submodules $RepoURL | ||
Set-Location .\taichi | ||
} | ||
|
||
$libsDir = (Resolve-Path $libsDir).Path | ||
|
||
if (-not (Test-Path $libsDir)) { | ||
New-Item -ItemType Directory -Path $libsDir | ||
} | ||
Push-Location $libsDir | ||
WriteInfo("Download and extract LLVM") | ||
if (-not (Test-Path "taichi_llvm")) { | ||
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 | ||
7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm | ||
} | ||
WriteInfo("Download and extract Clang") | ||
if (-not (Test-Path "taichi_clang")) { | ||
curl.exe --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO | ||
7z x clang-10.0.0-win.zip -otaichi_clang | ||
} | ||
$env:PATH = "$libsDir\taichi_llvm\bin;$libsDir\taichi_clang\bin;$env:PATH" | ||
$env:TAICHI_CMAKE_ARGS = "-G 'Visual Studio 16 2019' -A x64 -DLLVM_DIR=$libsDir\taichi_llvm\lib\cmake\llvm" | ||
if ($installVulkan) { | ||
WriteInfo("Download and install Vulkan") | ||
if (-not (Test-Path "VulkanSDK.exe")) { | ||
curl.exe --retry 10 --retry-delay 5 https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe -Lo VulkanSDK.exe | ||
} | ||
$installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S"); | ||
$installer.WaitForExit(); | ||
$env:VULKAN_SDK = "$libsDir\VulkanSDK\1.2.189.0" | ||
$env:PATH += ";$env:VULKAN_SDK\Bin" | ||
$env:TAICHI_CMAKE_ARGS += " -DTI_WITH_VULKAN:BOOL=ON" | ||
} | ||
|
||
Pop-Location | ||
clang --version | ||
|
||
WriteInfo("Setting up Python environment") | ||
python -m venv venv | ||
. venv\Scripts\activate.ps1 | ||
python -m pip install wheel | ||
python -m pip install -r requirements_dev.txt | ||
python -m pip install -r requirements_test.txt | ||
WriteInfo("Building Taichi") | ||
$env:CXX = "$libsDir\taichi_clang\bin\clang++.exe" | ||
if ($install) { | ||
if ($develop) { | ||
python -m pip install -v -e . | ||
} else { | ||
python -m pip install -v . | ||
} | ||
WriteInfo("Build and install finished") | ||
} else { | ||
python setup.py bdist_wheel | ||
WriteInfo("Build finished") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the LLVM/clang/Vulkan libs usually are usually downloaded once and placed somewhere outside the repo dir/build dir, (i.e., a more stable place, e.g.
C:\ThirdParty\Libs
). I'd suggest that we add one additional flag to hold all these required dependent libs, WDYT?In addition, let's make the default behavior not to download these libs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lib location can be specified with
-build
option, and if the library exists, won't download again.So
-build C:\ThirdParty\Libs
can do the trick.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, then let's give it a more obvious name, e.g.
libsdir
,depsdir
, ...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is changed to
libdir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I guess the naming convention here is
$libsDir
? Also, the default value should be empty (or at least not_build
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the name and default to the current location (
.
) since empty isn't a valid path parameter