Skip to content

Commit

Permalink
Changed logic for installing Python modules: do it in the install-thi…
Browse files Browse the repository at this point in the history
…rdparty script, so it is done as Administrator.
  • Loading branch information
cwidisgroup committed Mar 21, 2024
1 parent ef786a3 commit 5395e67
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cwipc_util
57 changes: 32 additions & 25 deletions scripts/install-3rdparty-full-win1064.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Function Add-PathVariable {
if ($global:ghActionRunner) {
echo $addPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
Write-Output "Added to PATH: " $addPath
Write-Output "cwipc_check install: Added to PATH: " $addPath
} else {
Throw "'$addPath' is not a valid path."
}
Expand Down Expand Up @@ -96,89 +96,96 @@ $tmpinstalldir="$((Get-Item $env:TEMP\cwipc-3rdparty-downloads).FullName)"
# Install PCL 1.14
#
if ($global:ghActionRunner) {
Write-Output "pcl: skipped"
Write-Output "cwipc_check install: pcl: skipped"
} elseif (Can-Execute-From-Path("pcl_generate -help")) {
Write-Output "pcl: already installed"
Write-Output "cwipc_check install: pcl: already installed"
} else {
Write-Output "pcl: downloading..."
Write-Output "cwipc_check install: pcl: downloading..."
$installer="$tmpinstalldir\PCL-1.14.0-AllInOne-msvc2022-win64.exe"
(New-Object System.Net.WebClient).DownloadFile("https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.14.0/PCL-1.14.0-AllInOne-msvc2022-win64.exe",$installer);
Write-Output "pcl: installing..."
Write-Output "cwipc_check install: pcl: installing..."
Start-Process -FilePath $installer -ArgumentList "/S" -Wait
Add-PathVariable("C:\Program Files\PCL 1.14.0\bin")
Add-PathVariable("C:\Program Files\PCL 1.14.0\3rdParty\VTK\bin")
Add-PathVariable("C:\Program Files\OpenNI2\Redist")
Write-Output "pcl: installed"
Write-Output "cwipc_check install: pcl: installed"
}

#
# Install Realsense SDK.
#
if ($global:ghActionRunner) {
Write-Output "intel-realsense: skipped"
Write-Output "cwipc_check install: intel-realsense: skipped"
} elseif (Is-DLL-On-Path("realsense2.dll")) {
Write-Output "intel-realsense: already installed"
Write-Output "cwipc_check install: intel-realsense: already installed"
} else {
Write-Output "intel-realsense: downloading..."
Write-Output "cwipc_check install: intel-realsense: downloading..."
$installer="$tmpinstalldir\Intel.RealSense.SDK-WIN10-2.54.2.5684.exe"
(New-Object System.Net.WebClient).DownloadFile(
"https://github.com/IntelRealSense/librealsense/releases/download/v2.54.2/Intel.RealSense.SDK-WIN10-2.54.2.5684.exe",$installer);
Write-Output "intel-realsense: installing..."
Write-Output "cwipc_check install: intel-realsense: installing..."
Start-Process -FilePath $installer -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP-' -Wait
Add-PathVariable("C:\Program Files (x86)\Intel RealSense SDK 2.0\bin\x64")
Write-Output "intel-realsense: installed"
Write-Output "cwipc_check install: intel-realsense: installed"
}

#
# Install Kinect SDK
#
if (Is-DLL-On-Path("k4a.dll")) {
Write-Output "k4a: already installed"
Write-Output "cwipc_check install: k4a: already installed"
} else {
Write-Output "k4a: downloading..."
Write-Output "cwipc_check install: k4a: downloading..."
$installer="$tmpinstalldir\Azure Kinect SDK 1.4.1.exe"
(New-Object System.Net.WebClient).DownloadFile("https://download.microsoft.com/download/3/d/6/3d6d9e99-a251-4cf3-8c6a-8e108e960b4b/Azure%20Kinect%20SDK%201.4.1.exe", $installer);
Write-Output "k4a: installing..."
Write-Output "cwipc_check install: k4a: installing..."
Start-Process -FilePath $installer -ArgumentList "/S" -Wait
Add-PathVariable("C:\Program Files\Azure Kinect SDK v1.4.1\sdk\windows-desktop\amd64\release\bin")
Write-Output "k4a: installed"
Write-Output "cwipc_check install: k4a: installed"
}

#
# Install Kinect Body Tracking SDK
#
if (Is-DLL-On-Path("k4abt.dll")) {
Write-Output "k4a-bt: already installed"
Write-Output "cwipc_check install: k4a-bt: already installed"
} else {
Write-Output "k4a-bt: downloading..."
Write-Output "cwipc_check install: k4a-bt: downloading..."
$installer="$tmpinstalldir\Azure Kinect Body Tracking SDK 1.1.1.msi"
(New-Object System.Net.WebClient).DownloadFile("https://download.microsoft.com/download/9/d/b/9dbe0fbe-c9c3-4228-a64c-1e0a08736ec1/Azure%20Kinect%20Body%20Tracking%20SDK%201.1.1.msi",$installer);
Write-Output "k4a-bt: installing..."
Write-Output "cwipc_check install: k4a-bt: installing..."
Start-Process $installer -ArgumentList '/quiet /passive' -Wait
Add-PathVariable("C:\Program Files\Azure Kinect Body Tracking SDK\tools")
Write-Output "k4a-bt: installed"
Write-Output "cwipc_check install: k4a-bt: installed"
}


#
# Finally save modified PATH environment variable to the registry.
#
Write-Output "registry: update PATH environment variable"
Write-Output "cwipc_check install: registry: update PATH environment variable"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $env:Path
Write-Output "registry: done"
Write-Output "cwipc_check install: registry: done"
#
# Install Python.
# NOTE: must be done last, due to manipulating PATH.
# NOTE: use pip, not python, because windows has an alias "python" that tells you how to install it.
#
$ok = Can-Execute-From-Path("pip --version")
if($ok) {
Write-Output "python: already installed"
Write-Output "cwipc_check install: python: already installed"
} else {
Write-Output "python: downloading..."
Write-Output "cwipc_check install: python: downloading..."
$installer="$tmpinstalldir\python-3.11.8-amd64.exe"
(New-Object System.Net.WebClient).DownloadFile("https://www.python.org/ftp/python/3.11.8/python-3.11.8-amd64.exe",$installer);
Write-Output "python: installing..."
Write-Output "cwipc_check install: python: installing..."
Start-Process -FilePath $installer -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait
Write-Output "python: installed"
Write-Output "cwipc_check install: python: installed"
}
#
# Install Python packages
#
Write-Output "cwipc_check install: python: cwipc packages: installing..."
& cwipc_pymodules_install.ps1
Write-Output "cwipc_check install: python: cwipc packages: All done."
Write-Output "cwipc_check install: python: cwipc packages: You can close this Powershell window."

0 comments on commit 5395e67

Please sign in to comment.