Task03 Павел Ральников СПбГУ #274
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| - 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 | |
| - name: Install windows dependencies | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| .github/scripts/windows/install_opencv.ps1 | |
| .github/scripts/windows/install_eigen3.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_sfm (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: ./build/test_sfm | |
| - 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_sfm (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: .\build\${{ env.BUILD_TYPE }}\test_sfm.exe |