mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-07 02:27:47 +08:00
146 lines
5.4 KiB
YAML
146 lines
5.4 KiB
YAML
name: CMake-Windows
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- '**'
|
|
|
|
env:
|
|
BUILD_TYPE: Release
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
build:
|
|
name: ${{ matrix.build_name }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
build_name: [windows-2022, windows-2022-cuda]
|
|
include:
|
|
- build_name: windows-2022
|
|
os: windows-2022
|
|
extra_deps: ""
|
|
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_PYTHON=ON -DWITH_TORCH=OFF'
|
|
- build_name: windows-2022-cuda
|
|
os: windows-2022
|
|
extra_deps: ""
|
|
extra_cmake_def: '-DBUILD_AS_BUNDLE=ON -DWITH_PYTHON=ON -DWITH_TORCH=ON'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Restore test data
|
|
id: cache-testdata
|
|
uses: actions/cache@v4
|
|
with:
|
|
# SQLite DBs are binary-portable -> share the cache across
|
|
# linux / macos / windows. Key omits runner.os on purpose so all
|
|
# three OSes hit the same entry.
|
|
path: data/tests/*.db
|
|
key: testdata-${{ hashFiles('data/tests/manifest.txt') }}
|
|
|
|
- name: Fetch test data
|
|
if: steps.cache-testdata.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: bash scripts/fetch_test_data.sh
|
|
|
|
- name: Install Windows Dependencies
|
|
if: matrix.build_name == 'windows-2022'
|
|
uses: ./.github/actions/install-windows-deps
|
|
|
|
- name: Install Windows Dependencies with CUDA
|
|
if: matrix.build_name == 'windows-2022-cuda'
|
|
uses: ./.github/actions/install-windows-cuda-deps
|
|
|
|
- name: Configure CMake
|
|
run: |
|
|
cmake `
|
|
-B ${{github.workspace}}/build `
|
|
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
|
|
${{ matrix.extra_cmake_def }} `
|
|
-DBUILD_TESTING=ON `
|
|
-DVCPKG_MANIFEST_INSTALL=OFF `
|
|
-DVCPKG_TARGET_TRIPLET=x64-windows-release `
|
|
-DVCPKG_INSTALLED_DIR="${{env.VCPKG_EXPORT_PATH}}/installed" `
|
|
-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_EXPORT_PATH}}/scripts/buildsystems/vcpkg.cmake `
|
|
-DTorch_DIR=${{env.VCPKG_EXPORT_PATH}}/installed/x64-windows-release/tools/python3/Lib/site-packages/torch/share/cmake/Torch
|
|
|
|
- name: Build
|
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target ALL_BUILD
|
|
|
|
- name: Test
|
|
working-directory: ${{github.workspace}}/build
|
|
# PYTHONHOME points the embedded interpreter at vcpkg's bundled
|
|
# Python install (where Lib/, DLLs/ live). Without it Python emits
|
|
# "Could not find platform independent libraries <prefix>" at init
|
|
# and runs without a stdlib, breaking every numpy import.
|
|
# PYTHONNOUSERSITE=1: prevent the embedded Python interpreter from
|
|
# loading numpy / other site-packages from %APPDATA%\Python that
|
|
# were compiled against a different ABI than the build-time Python
|
|
# (numpy 1.x/2.x mismatch crashes in test_pydetector /
|
|
# test_pydescriptor / test_pymatcher).
|
|
env:
|
|
PYTHONHOME: ${{env.VCPKG_EXPORT_PATH}}/installed/x64-windows-release/tools/python3
|
|
PYTHONNOUSERSITE: 1
|
|
run: |
|
|
# The Windows CUDA runner ships a CUDA driver older than the runtime
|
|
# OpenCV/cv::cuda was built against. Lazy CUDA-init on first cv::cuda
|
|
# symbol call stalls some unit tests (test_util3d_features,
|
|
# test_localgrid) for >300s; which test hangs first is timing-dependent.
|
|
# Hide the GPU so the runtime short-circuits before any blocking call.
|
|
# Note: '$env:CUDA_VISIBLE_DEVICES = ""' on Windows *deletes* the
|
|
# variable (Win32 SetEnvironmentVariable treats empty as remove), so
|
|
# use "-1" — CUDA's documented sentinel for "no device visible".
|
|
if ('${{ matrix.build_name }}' -eq 'windows-2022-cuda') {
|
|
$env:CUDA_VISIBLE_DEVICES = "-1"
|
|
}
|
|
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --timeout 300
|
|
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --timeout 300 --rerun-failed
|
|
|
|
- name: Build Windows Package
|
|
shell: pwsh
|
|
run: |
|
|
if ("${{ github.event_name }}" -eq "pull_request") {
|
|
cpack --config build/CPackConfig.cmake -G ZIP -B build
|
|
} else {
|
|
cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} --target package
|
|
}
|
|
|
|
- name: Rename CUDA artifacts
|
|
if: matrix.build_name == 'windows-2022-cuda'
|
|
shell: pwsh
|
|
run: Get-ChildItem -Path "build" -Filter "RTABMap-*" | Rename-Item -NewName { $_.BaseName + "_cuda" + $_.Extension }
|
|
|
|
- name: Info
|
|
working-directory: ${{github.workspace}}/build/bin
|
|
run: |
|
|
./rtabmap-console --version
|
|
|
|
- name: Upload RTABMap Artifacts (ZIP)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: RTABMap-Binaries-${{ matrix.build_name }}-zip
|
|
path: |
|
|
build/RTABMap-*.zip
|
|
compression-level: 0
|
|
if-no-files-found: warn
|
|
retention-days: ${{ github.event_name == 'pull_request' && 1 || 90 }}
|
|
|
|
- name: Upload RTABMap Artifacts (Installer)
|
|
if: github.event_name != 'pull_request'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: RTABMap-Binaries-${{ matrix.build_name }}-exe
|
|
path: |
|
|
build/RTABMap-*.exe
|
|
compression-level: 0
|
|
if-no-files-found: warn
|
|
retention-days: ${{ github.event_name == 'pull_request' && 1 || 90 }}
|