Skip to content

added a build script for windows and documentation for it #115

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions build/build_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
if ($args -contains "-it") {
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
winget install --id Git.Git -e
}
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
winget install --id Python.Python -e
}
if (-not (Get-Command cl -ErrorAction SilentlyContinue)) {
winget install --id Microsoft.VisualStudio.2022.BuildTools -e
}
}

if ($args -contains "-ci") {
Set-Location ..
} else {
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
winget install --id Git.Git -e
}
git clone --head 1 https://github.com/samtupy/nvgt
Set-Location -Path "nvgt"
}

$windevPath = "windev"
if (-not (Test-Path $windevPath) -or (Get-ChildItem $windevPath -Recurse | Measure-Object).Count -eq 0) {
$windevZipUrl = "https://nvgt.gg/windev.zip"
$zipFile = "$env:TEMP\windev.zip"
Invoke-WebRequest -Uri $windevZipUrl -OutFile $zipFile
New-Item -ItemType Directory -Path $windevPath -Force
Expand-Archive -Path $zipFile -DestinationPath $windevPath -Force
}

python -m venv venv --upgrade-deps
.\venv\scripts\activate.ps1
python -m pip install scons
scons -s
.\venv\scripts\deactivate.ps1
22 changes: 22 additions & 0 deletions doc/src/advanced/Building NVGT For windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# building nvgt on windows

## Building with the `build_windows.ps1` script
There is a [script for building NVGT for Windows](https://github.com/samtupy/nvgt/blob/main/build/build_windows.ps1). It requires [Winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/) to be installed.

This script allows for multiple parameters to alter it's behaviour:
* `-it`: This parameter instructs the script to download the relevant tooling that will be used; this includes a compiler, Python, and Git.
* `-ci`: This parameter tells the script that you have already cloned NVGT's repo and will download dependencies assuming it is in NVGT's top-level directory.

### Notes
PowerShell might refuse to execute the script do to execution policys. In this case, run the command:
`Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process`
This will apply this change for the current session of PowerShell only

For a more permanent solution, run one of the following:
* `Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser`: This will set this property for the current user only.
* `Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine`: This will set the policy for the intire system.

Note: Setting this setting permanently requires running PowerShell as administrator.

## Building NVGT manually
if you do not wish to use this script for building nvgt, you can build NVGT manually. See the [main project readme](https://github.com/samtupy/nvgt/blob/main/readme.md) for more details.