Skip to content

Fix compat with opencv 5.x #2325

Fix compat with opencv 5.x

Fix compat with opencv 5.x #2325

Workflow file for this run

name: Ubuntu-dep-src
# https://www.jeffgeerling.com/blog/2020/running-github-actions-workflow-on-schedule-and-other-events
on:
pull_request:
types: [opened, reopened, synchronize]
schedule:
- cron: '0 2 * * SUN'
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre#comment133398800_72408109
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
# Function to get the most recent tag of a remote repository without having to clone it, excluding tag with 'pr' as in Pre Release
FUNCTION_GET_LATEST: 'git -c "versionsort.suffix=-" ls-remote --exit-code --refs --sort="version:refname" --tags ${GIT_ADDRESS} "*.*.*" | cut --delimiter="/" --fields=3 | grep -v -e pr | tail --lines=1'
jobs:
build-ubuntu-dep-src:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Print system information
run: lscpu
- name: Print OS information
run: lsb_release -a
- name: Install dependencies for ubuntu 20.04
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update && sudo apt-get install -y libdc1394-22-dev
- name: Install common dependencies for ubuntu
run: |
sudo apt-get update
sudo apt-get install -y libx11-dev libv4l-dev gfortran liblapack-dev libeigen3-dev
sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install -y mesa-common-dev mesa-utils freeglut3-dev libflann-dev libboost-all-dev
sudo apt-get install -y nlohmann-json3-dev
- name: Install dependencies for ubuntu-latest
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-dev libv4l-dev gfortran liblapack-dev libeigen3-dev
sudo apt-get update && sudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
- name: Build OpenBLAS from source
run: |
pwd
echo $GITHUB_WORKSPACE
GIT_ADDRESS=https://github.com/xianyi/OpenBLAS.git
LATEST_TAG=`eval ${FUNCTION_GET_LATEST}`
echo "Newest tag is ${LATEST_TAG}"
git clone --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/OpenBLAS
cd ${HOME}/OpenBLAS
mkdir install
make -j$(nproc)
make -j$(nproc) install PREFIX=$(pwd)/install
echo "OpenBLAS_HOME=$(pwd)/install" >> $GITHUB_ENV
echo $OpenBLAS_HOME
- name: Build VTK from source
# We set GIT_CLONE_PROTECTION_ACTIVE=false to avoid the issue described in
# https://github.com/git-lfs/git-lfs/issues/5749
run: |
pwd
echo "GIT_CLONE_PROTECTION_ACTIVE=false" >> $GITHUB_ENV
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_ADDRESS="https://github.com/Kitware/VTK.git"
LATEST_TAG=`eval ${FUNCTION_GET_LATEST}`
echo "Newest tag is ${LATEST_TAG}"
git clone --recursive --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/VTK
cd ${HOME}/VTK
mkdir build && cd build && mkdir install
cmake .. -DVTK_ANDROID_BUILD=OFF -DVTK_BUILD_DOCUMENTATION=OFF -DVTK_BUILD_EXAMPLES=OFF -DVTK_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release \
-DVTK_GROUP_ENABLE_Imaging=DONT_WANT -DVTK_GROUP_ENABLE_MPI=DONT_WANT -DVTK_GROUP_ENABLE_Web=DONT_WANT -DCMAKE_INSTALL_PREFIX=$(pwd)/install
make -j$(nproc) install
echo "VTK_DIR=$(pwd)/install" >> $GITHUB_ENV
echo $VTK_DIR
- name: Build OpenCV from source
run: |
pwd
GIT_ADDRESS="https://github.com/opencv/opencv.git"
LATEST_TAG=`eval ${FUNCTION_GET_LATEST}`
echo "Newest tag is ${LATEST_TAG}"
git clone --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/opencv
cd ${HOME}/opencv
mkdir build && cd build && mkdir install
cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install
make -j$(nproc) install
echo "OpenCV_DIR=$(pwd)/install" >> $GITHUB_ENV
echo $OpenCV_DIR
- name: Build librealsense2 from source
run: |
pwd
GIT_ADDRESS="https://github.com/IntelRealSense/librealsense.git"
LATEST_TAG=`eval ${FUNCTION_GET_LATEST}`
echo "Newest tag is ${LATEST_TAG}"
git clone --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/librealsense
cd ${HOME}/librealsense
mkdir build && cd build && mkdir install
cmake .. -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install
make -j$(nproc) install
echo "REALSENSE2_DIR=$(pwd)/install" >> $GITHUB_ENV
echo $REALSENSE2_DIR
- name: Build PCL from source
run: |
pwd
GIT_ADDRESS="https://github.com/PointCloudLibrary/pcl.git"
LATEST_TAG=`eval ${FUNCTION_GET_LATEST}`
echo "Newest tag is ${LATEST_TAG}"
git clone --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/pcl
cd ${HOME}/pcl
mkdir build && cd build && mkdir install
cmake .. -DBUILD_tools=OFF -DBUILD_global_tests=OFF -DPCL_DISABLE_GPU_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install
make -j$(nproc) install
echo "PCL_DIR=$(pwd)/install" >> $GITHUB_ENV
echo $PCL_DIR
- name: Clone visp-images
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}
- name: Configure CMake
run: |
pwd
mkdir build && cd build && mkdir install
cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/install
cat ViSP-third-party.txt
- name: Build visp-config script
working-directory: build
run: |
make -j$(nproc) developer_scripts
./bin/visp-config --cflags
./bin/visp-config --libs
- name: Build and install ViSP
working-directory: build
run: |
make -j$(nproc) install
echo "VISP_DIR=$(pwd)/install" >> $GITHUB_ENV
echo $VISP_DIR
- name: Run unit tests
working-directory: build
run: ctest -j$(nproc) --output-on-failure
- name: Clone camera_localization
run: |
git clone --depth 1 https://github.com/lagadic/camera_localization ${HOME}/camera_localization
- name: Build camera_localization with ViSP as 3rdparty
run: |
cd ${HOME}/camera_localization
mkdir camera_localization-build
cd camera_localization-build
cmake ..
make -j$(nproc)
- name: Clone visp_started
run: |
git clone --depth 1 https://github.com/lagadic/visp_started ${HOME}/visp_started
- name: Build visp_started with ViSP as 3rdparty
run: |
cd ${HOME}/visp_started
mkdir visp_started-build
cd visp_started-build
cmake ..
make -j$(nproc)