Skip to content

Task05 Syrma Timur ITMO #323

Task05 Syrma Timur ITMO

Task05 Syrma Timur ITMO #323

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: Install linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y g++ cmake unzip wget
bash .github/scripts/linux/install_opencv.sh
bash .github/scripts/linux/install_opencl_cpu_driver.sh
bash .github/scripts/linux/install_eigen3.sh
bash .github/scripts/linux/install_ceres_solver.sh
- name: Install macos dependencies
if: runner.os == 'macOS'
run: |
bash .github/scripts/macos/install_openmp.sh
bash .github/scripts/macos/install_opencv.sh
bash .github/scripts/macos/install_eigen3.sh
bash .github/scripts/macos/install_ceres_solver.sh
- name: Install windows dependencies
if: runner.os == 'Windows'
shell: pwsh
run: |
.github/scripts/windows/install_opencv.ps1
.github/scripts/windows/install_eigen3.ps1
.github/scripts/windows/install_ceres_solver.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" \
-DCMAKE_PREFIX_PATH="/opt/ceres-solver220"
- name: Configure CMake (macOS)
if: runner.os == 'macOS'
run: |
OMP_PREFIX="$(brew --prefix libomp)"
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DOpenCV_DIR="/opt/opencv-4.11.0/lib/cmake/opencv4" \
-DOpenMP_C_FLAGS="-Xclang -fopenmp -I${OMP_PREFIX}/include" \
-DOpenMP_CXX_FLAGS="-Xclang -fopenmp -I${OMP_PREFIX}/include" \
-DOpenMP_C_LIB_NAMES="omp" \
-DOpenMP_CXX_LIB_NAMES="omp" \
-DOpenMP_omp_LIBRARY="${OMP_PREFIX}/lib/libomp.dylib" \
-DCMAKE_PREFIX_PATH="/opt/ceres-solver220"
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$OpenCV_DIR = Get-Content .deps/opencv_dir.txt
$env:VCPKG_INSTALLATION_ROOT = ""
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
-DOpenCV_DIR="$OpenCV_DIR" `
-DEigen3_DIR="C:\eigen-3.4.0\share\eigen3\cmake" `
-DCMAKE_PREFIX_PATH="C:\ceres-solver220" `
-DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET="x64-windows" `
-DCMAKE_CONFIGURATION_TYPES="Debug;RelWithDebInfo"
- name: Build (any OS)
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Run test_ceres_solver (Linux/macOS)
if: runner.os != 'Windows'
run: ./build/test_ceres_solver
- name: Run test_sfm_ba (Linux/macOS)
if: runner.os != 'Windows'
run: ./build/test_sfm_ba
- 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 }
# Ceres vcpkg DLLs (glog, gflags, suitesparse, etc.)
$vcpkgBin = "C:\vcpkg\installed\x64-windows\bin"
if (Test-Path $vcpkgBin) {
Copy-Item "$vcpkgBin\*.dll" $exeDir -Force
}
- name: Run test_depth_maps_pm (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: .\build\${{ env.BUILD_TYPE }}\test_depth_maps_pm.exe