Skip to content

Instantly share code, notes, and snippets.

@nsticco
Last active February 9, 2023 21:57
Show Gist options
  • Save nsticco/fc0b10b6981618bfe0962e0696f14eba to your computer and use it in GitHub Desktop.
Save nsticco/fc0b10b6981618bfe0962e0696f14eba to your computer and use it in GitHub Desktop.
Install Boost and Python on Windows
# iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/nsticco/fc0b10b6981618bfe0962e0696f14eba/raw'))
# Variables
$boost_version = "1.81.0"
$boost_underscores = "1_81_0"
$boost_install_dir = "D:\libraries"
Write-Output "Installing Chocolatey..."
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Write-Output "Installing Python 3.10 with debug symbols..."
choco install -y python310 -debug
Write-Output "Installing Boost $boost_version..."
Invoke-WebRequest https://boostorg.jfrog.io/artifactory/main/release/${boost_version}/source/boost_${boost_underscores}.zip -OutFile boost.zip
Expand-Archive boost.zip -DestinationPath $boost_install_dir
Write-Output "Setting environment variables..."
$env:BOOST_ROOT = "$boost_install_dir\boost_${boost_underscores}"
[Environment]::SetEnvironmentVariable("BOOST_ROOT", $env:BOOST_ROOT, "User")
$env:BOOST_LIBRARYDIR = "$env:BOOST_ROOT\stage64\lib"
[Environment]::SetEnvironmentVariable("BOOST_LIBRARYDIR", $env:BOOST_LIBRARYDIR, "User")
$env:PATH = "$env:BOOST_LIBRARYDIR;$env:PATH"
[Environment]::SetEnvironmentVariable("Path", $env:Path, "User")
Write-Output "Building Boost Python..."
cd $BOOST_ROOT
.\bootstrap.bat
.\b2 --with-python address-model=64 --build-dir=build64 --stagedir=stage64 toolset=msvc-14.3 --build-type=complete stage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment