Skip to content

Commit

Permalink
Merge branch '89-vcpkg': Use vcpkg for most dependency libraries on W…
Browse files Browse the repository at this point in the history
…indows.

Closes #89.
  • Loading branch information
cwidisgroup committed Mar 8, 2024
2 parents 39c64d9 + 4044302 commit a804763
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 66 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
run: |
$thirdpartydir="$((Get-Item ..).FullName)\3rdparty"
mkdir $thirdpartydir
- name: Export GitHub Actions cache environment variables for vcpkg
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install NSIS 8192-character limit override
shell: pwsh
run: |
Expand All @@ -36,6 +42,10 @@ jobs:
shell: pwsh
run: scripts\install-3rdparty-full-win1064.ps1

- name: Bootstrap vcpkg
shell: pwsh
run: vcpkg\bootstrap-vcpkg.bat

- name: Install Python packages (Windows)
shell: bash
run: |
Expand All @@ -45,11 +55,19 @@ jobs:
pythonExecutable=`cygpath --windows "$pythonExecutable"`
echo "Python_ROOT_DIR=$pythonRoot" >> $GITHUB_ENV
echo "Python3_EXECUTABLE=$pythonExecutable" >> $GITHUB_ENV
- name: Print Path
shell: pwsh
run: |
$env:path -split ";"
- name: Build & Test
uses: ashutoshvarma/action-cmake-build@master
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
with:
build-dir: ${{ github.workspace }}/build
configure-options: -Wno-dev -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/installed -DPython3_EXECUTABLE=${{ env.Python3_EXECUTABLE }} -DOpenCV_ROOT=${{ env.OPENCV_DIR }}
configure-options: -Wno-dev -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/installed -DPython3_EXECUTABLE=${{ env.Python3_EXECUTABLE }} -DOpenCV_ROOT=${{ env.OPENCV_DIR }}
build-type: Release
run-test: true
install-build: true
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
url = ../cwipc_kinect
branch = .
update = merge
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/Microsoft/vcpkg.git
3 changes: 2 additions & 1 deletion CMakeFiles/CwipcInstallers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ elseif(WIN32)
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "")
string(APPEND CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "ExecWait 'python3 -m pip uninstall -y cwipc_util cwipc_codec cwipw_realsense2 cwipc_kinect'\\n")
set(CPACK_NSIS_MENU_LINKS
"libexec/cwipc/scripts/run-cwipc-check-fix.bat" "Attempt to fix cwipc installation"
"libexec/cwipc/scripts/run-cwipc-view-synthetic.bat" "View a sample dynamic pointcloud"
"libexec/cwipc/scripts/run-cwipc-check-fix.bat" "Attempt to fix cwipc installation"
"libexec/cwipc/scripts/run-cwipc-check.bat" "Check cwipc installation"
"share/docs/cwipc/readme.md" "Readme file"
)
Expand Down
2 changes: 1 addition & 1 deletion cwipc_codec
2 changes: 1 addition & 1 deletion cwipc_kinect
2 changes: 1 addition & 1 deletion cwipc_realsense2
2 changes: 1 addition & 1 deletion cwipc_util
Submodule cwipc_util updated 1 files
+3 −0 src/CMakeLists.txt
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ The change log can be found at [CHANGELOG.md](CHANGELOG.md).

The simplest way to install cwipc is through a prebuilt installer. This will install everything in the standard location, and it allows running the command line tools as well as developing C, C++, Python or Unity programs that use the cwipc library.

After installation, run `cwipc_view --synthetic` from a shell (terminal window, command prompt). It should show you a window with a rotating synthetic point cloud if everything is installed correctly. There is also a command line utility `cwipc_check` that will test that all third-party requirements have been installed correctly. Especially on Windows this can be very helpful (see below).
After installation, run `cwipc_view --synthetic` from a shell (terminal window, command prompt). It should show you a window with a rotating synthetic point cloud if everything is installed correctly. There is also a command line utility `cwipc_check` that will test that all third-party requirements have been installed correctly.
On Windows you can find these in the start menu too.

See below if you want to install to a different location, or if you want to modify cwipc itself and build it from source.

Expand All @@ -32,6 +33,8 @@ Download the windows installer `.exe` for the most recent cwipc release from <ht

Run it, and it will install the cwipc command line tools and the C++ and Python APIs.

> If the installer does not run you must install the "Microsoft VC++ Redistributable" first (64 bit version).
It will _also install all required third party packages_, unless a usable version is detected.

### Windows - check installation
Expand Down
2 changes: 1 addition & 1 deletion scripts/buildall-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if nproc 2>&1 >/dev/null; then
fi

mkdir -p build
cmake -S . -B build -DCMAKE_INSTALL_PREFIX="$instdir"
cmake -S . -B build -DCMAKE_INSTALL_PREFIX="$instdir" -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config $config
if [ "$notest" != "notest" ]; then
ctest --test-dir build --build-config $config
Expand Down
73 changes: 16 additions & 57 deletions scripts/install-3rdparty-full-win1064.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
#
# Install required third party packages.
# NEEDS ADMIN RIGHTS
# xxxjack Need to add entries to PATH environment
#
# First check whether we are running under gitbuh actions
#
$global:ghActionRunner = Test-Path env:\GITHUB_ACTIONS
#
# Function to add entries to PATH environment variable
#
Expand All @@ -15,6 +18,11 @@ Function Add-PathVariable {
$arrPath = $env:Path -split ';' | Where-Object {$_ -notMatch
"^$regexAddPath\\?"}
$env:Path = ($arrPath + $addPath) -join ';'
# For github actions we also add to the runner path
if ($global:ghActionRunner) {
echo $addPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
Write-Output "Added to PATH: " $addPath
} else {
Throw "'$addPath' is not a valid path."
}
Expand Down Expand Up @@ -83,50 +91,18 @@ if (Test-Path $env:TEMP\cwipc-3rdparty-downloads) {
}
$tmpinstalldir="$((Get-Item $env:TEMP\cwipc-3rdparty-downloads).FullName)"

#
# Install libjpeg-turbo
#
if(Can-Execute-From-Path("jpegtran -help")) {
Write-Output "libjpeg-turbo: already installed"
} else {
Write-Output "libjpeg-turbo: downloading..."
$installer="$tmpinstalldir\libjpeg-turbo-2.1.5.1-vc64.exe"
(New-Object System.Net.WebClient).DownloadFile("https://sourceforge.net/projects/libjpeg-turbo/files/2.1.5.1/libjpeg-turbo-2.1.5.1-vc64.exe",$installer);
Write-Output "libjpeg-turbo: installing..."
Start-Process -FilePath $installer -ArgumentList "/S" -Wait
Add-PathVariable("C:\libjpeg-turbo64\bin")
Write-Output "libjpeg-turbo: installed"
}

#
# Install PCL 1.13
#
$ok = Can-Execute-From-Path("pcl_generate -help")
if($ok) {
Write-Output "pcl: already installed"
} else {
Write-Output "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..."
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"
}

#
# Install Realsense SDK.
#
$ok = Is-DLL-On-Path("realsense2.dll")
if($ok) {
if ($global:ghActionRunner) {
Write-Output "intel-realsense: skipped"
} elseif (Is-DLL-On-Path("realsense2.dll")) {
Write-Output "intel-realsense: already installed"
} else {
Write-Output "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.52.2/Intel.RealSense.SDK-WIN10-2.52.2.5684.exe",$installer);
"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..."
Start-Process -FilePath $installer -ArgumentList '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP-' -Wait
Add-PathVariable("C:\Program Files (x86)\Intel RealSense SDK 2.0\bin\x64")
Expand All @@ -136,8 +112,7 @@ if($ok) {
#
# Install Kinect SDK
#
$ok = Is-DLL-On-Path("k4a.dll")
if($ok) {
if (Is-DLL-On-Path("k4a.dll")) {
Write-Output "k4a: already installed"
} else {
Write-Output "k4a: downloading..."
Expand All @@ -152,8 +127,7 @@ if($ok) {
#
# Install Kinect Body Tracking SDK
#
$ok = Is-DLL-On-Path("k4abt.dll")
if($ok) {
if (Is-DLL-On-Path("k4abt.dll")) {
Write-Output "k4a-bt: already installed"
} else {
Write-Output "k4a-bt: downloading..."
Expand All @@ -164,22 +138,7 @@ if($ok) {
Add-PathVariable("C:\Program Files\Azure Kinect Body Tracking SDK\tools")
Write-Output "k4a-bt: installed"
}
#
# Install OpenCV
#
$ok = Can-Execute-From-Path("opencv_version")
if($ok) {
Write-Output "opencv: already installed"
} else {
Write-Output "opencv: downloading..."
$installer="$tmpinstalldir\opencv-4.9.0-windows.exe"
(New-Object System.Net.WebClient).DownloadFile("https://github.com/opencv/opencv/releases/download/4.9.0/opencv-4.9.0-windows.exe",$installer);
Write-Output "opencv: installing..."
Start-Process $installer -ArgumentList '-o"C:\" -y' -Wait
Add-PathVariable("C:\opencv\build\bin")
Add-PathVariable("C:\opencv\build\x64\vc16\bin")
Write-Output "opencv: installed"
}


#
# Finally save modified PATH environment variable to the registry.
Expand Down
2 changes: 1 addition & 1 deletion scripts/nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
git fetch --recurse-submodules
gh release delete nightly --cleanup-tag --yes
git tag -f nightly origin/master
git push origin nightly
git push -f origin nightly
2 changes: 2 additions & 0 deletions scripts/run-cwipc-view-synthetic.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cwipc_view --synthetic
pause
1 change: 1 addition & 0 deletions vcpkg
Submodule vcpkg added at 69baa8
14 changes: 14 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"default-registry": {
"kind": "git",
"baseline": "69baa842721d9083bb8278ca85c73dd328b1ebdc",
"repository": "https://github.com/microsoft/vcpkg"
},
"registries": [
{
"kind": "artifact",
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
"name": "microsoft"
}
]
}
10 changes: 10 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "cwipc",
"version": "7.5.0",
"dependencies": [
"libjpeg-turbo",
"opencv4",
"pcl",
"realsense2"
]
}

0 comments on commit a804763

Please sign in to comment.