diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8de3c12..7edb027 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | @@ -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: | @@ -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 diff --git a/.gitmodules b/.gitmodules index 13d0d76..4538124 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,3 +18,6 @@ url = ../cwipc_kinect branch = . update = merge +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/Microsoft/vcpkg.git diff --git a/CMakeFiles/CwipcInstallers.cmake b/CMakeFiles/CwipcInstallers.cmake index f89acf9..8b2269e 100644 --- a/CMakeFiles/CwipcInstallers.cmake +++ b/CMakeFiles/CwipcInstallers.cmake @@ -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" ) diff --git a/cwipc_codec b/cwipc_codec index fb88d91..62eee37 160000 --- a/cwipc_codec +++ b/cwipc_codec @@ -1 +1 @@ -Subproject commit fb88d91056681c5e934e01b210166eb93821447f +Subproject commit 62eee37325fa23d610128e64385b87181ecd9080 diff --git a/cwipc_kinect b/cwipc_kinect index 52a9b64..5cb6a36 160000 --- a/cwipc_kinect +++ b/cwipc_kinect @@ -1 +1 @@ -Subproject commit 52a9b6496845ae9cf2ede6571d2006ef511a28b8 +Subproject commit 5cb6a3645b0c75120c2e66ba7d0ee0cefa578c8a diff --git a/cwipc_realsense2 b/cwipc_realsense2 index 21f1604..df787a1 160000 --- a/cwipc_realsense2 +++ b/cwipc_realsense2 @@ -1 +1 @@ -Subproject commit 21f16048c5095f9993dfddac600a9c83f7eb1402 +Subproject commit df787a138c85fb89a76cb3e29cf94f57816b4922 diff --git a/cwipc_util b/cwipc_util index 32e8da0..cd8d328 160000 --- a/cwipc_util +++ b/cwipc_util @@ -1 +1 @@ -Subproject commit 32e8da0652fa35e4c7b68ca3f886b9e0bbf9e514 +Subproject commit cd8d328ee0596ecbe6dbb4035cdaec470dfa1a4d diff --git a/readme.md b/readme.md index addc7e1..0889577 100644 --- a/readme.md +++ b/readme.md @@ -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. @@ -32,6 +33,8 @@ Download the windows installer `.exe` for the most recent cwipc release from 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 diff --git a/scripts/buildall-win.sh b/scripts/buildall-win.sh index 233aa0d..6b9969d 100755 --- a/scripts/buildall-win.sh +++ b/scripts/buildall-win.sh @@ -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 diff --git a/scripts/install-3rdparty-full-win1064.ps1 b/scripts/install-3rdparty-full-win1064.ps1 index a753dbe..4793a4a 100644 --- a/scripts/install-3rdparty-full-win1064.ps1 +++ b/scripts/install-3rdparty-full-win1064.ps1 @@ -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 # @@ -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." } @@ -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") @@ -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..." @@ -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..." @@ -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. diff --git a/scripts/nightly.sh b/scripts/nightly.sh index d03044c..997f436 100755 --- a/scripts/nightly.sh +++ b/scripts/nightly.sh @@ -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 diff --git a/scripts/run-cwipc-view-synthetic.bat b/scripts/run-cwipc-view-synthetic.bat new file mode 100644 index 0000000..7c055b1 --- /dev/null +++ b/scripts/run-cwipc-view-synthetic.bat @@ -0,0 +1,2 @@ +cwipc_view --synthetic +pause diff --git a/vcpkg b/vcpkg new file mode 160000 index 0000000..69baa84 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit 69baa842721d9083bb8278ca85c73dd328b1ebdc diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..a3a55d4 --- /dev/null +++ b/vcpkg-configuration.json @@ -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" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..8917a61 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,10 @@ +{ + "name": "cwipc", + "version": "7.5.0", + "dependencies": [ + "libjpeg-turbo", + "opencv4", + "pcl", + "realsense2" + ] +}