Skip to content

Task02 Ворошилов Максим СПбГУ #102

Task02 Ворошилов Максим СПбГУ

Task02 Ворошилов Максим СПбГУ #102

Workflow file for this run

name: CMake
on: [push, pull_request]
env:
BUILD_TYPE: RelWithDebInfo
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build and install OpenCV (Linux)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y g++ cmake unzip wget
bash .github/scripts/linux/install_opencv.sh
- name: Install OpenCL CPU driver
if: runner.os == 'Linux'
run: |
bash .github/scripts/linux/install_opencl_cpu_driver.sh
- name: Build and install OpenCV + OpenMP (macOS)
if: runner.os == 'macOS'
run: |
bash .github/scripts/macos/install_openmp.sh
bash .github/scripts/macos/install_opencv.sh
- name: Build and install OpenCV (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: .github/scripts/windows/install_opencv.ps1
- name: Configure CMake (Linux)
if: runner.os == 'Linux'
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DOpenCV_DIR="/opt/opencv-4.11.0/lib/cmake/opencv4"
- name: Configure CMake (macOS)
if: runner.os == 'macOS'
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DOpenCV_DIR="/opt/opencv-4.11.0/lib/cmake/opencv4" \
-DOpenMP_ROOT="$(brew --prefix libomp)"
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$OpenCV_DIR = Get-Content .deps/opencv_dir.txt
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DOpenCV_DIR="$OpenCV_DIR" `
-DCMAKE_CONFIGURATION_TYPES="Debug;RelWithDebInfo"
- name: Build (any OS)
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Run test_matching (Linux/macOS)
if: runner.os != 'Windows'
run: ./build/test_matching
- name: Copy OpenCV/gtest DLLs (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$cfg = "${{ env.BUILD_TYPE }}"
$exeDir = Join-Path $pwd "build\$cfg"
# OpenCV DLLs (from your install script output)
$ocvBin = Get-Content .deps/opencv_bin.txt
Copy-Item "$ocvBin\opencv_world*.dll" $exeDir -Force
# gtest DLLs (exclude destination dir to avoid copying onto itself)
Get-ChildItem -Path build -Recurse -Filter "gtest*.dll" |
Where-Object { $_.DirectoryName -ne $exeDir } |
Group-Object Name |
ForEach-Object { Copy-Item $_.Group[0].FullName $exeDir -Force }
- name: Run test_matching (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: .\build\${{ env.BUILD_TYPE }}\test_matching.exe