Skip to content

Commit

Permalink
Merge pull request #1538 from rolalaro/ogre-1_12
Browse files Browse the repository at this point in the history
Compatibility with more recent versions of Ogre
  • Loading branch information
fspindle authored Jan 18, 2025
2 parents 2f13b74 + cae757c commit f6faf50
Show file tree
Hide file tree
Showing 28 changed files with 1,328 additions and 559 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/ubuntu-ogre-apt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Ubuntu-ogre-apt

# 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

jobs:
build-ubuntu-ogre-apt:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-latest]
compiler: [ {CC: /usr/bin/gcc-9, CXX: /usr/bin/g++-9}, {CC: /usr/bin/gcc-10, CXX: /usr/bin/g++-10}, {CC: /usr/bin/clang, CXX: /usr/bin/clang++} ]
standard: [ 11, 17 ]
ogre: [ogre-1.9, ogre-1.12]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Print system information
run: lscpu

- name: Print OS information
run: lsb_release -a

- name: Print compiler information
run: dpkg --list | grep compiler

- name: Install ViSP dependencies
run: sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-dev libv4l-dev liblapack-dev libopenblas-dev libeigen3-dev libopencv-dev nlohmann-json3-dev

- name: Install Ogre 1.9
if: matrix.ogre == 'ogre-1.9' && matrix.standard != '17'
run: sudo apt-get update && sudo apt-get install -y libogre-1.9-dev

- name: Install Ogre 1.12
if: matrix.ogre == 'ogre-1.12'
run: sudo apt-get update && sudo apt-get install -y libogre-1.12-dev

- 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: Clone visp_sample
run: |
git clone --depth 1 /~https://github.com/lagadic/visp_sample ${HOME}/visp_sample
- name: Configure CMake
run: |
mkdir build
cd build
CC=${{ matrix.compiler.CC }}
CXX=${{ matrix.compiler.CXX }}
CXX_STANDARD=${{ matrix.standard }}
echo "CC: $CC"
echo "CXX: $CXX"
echo "Standard: $CXX_STANDARD"
cmake .. -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/usr/local -DCMAKE_VERBOSE_MAKEFILE=ON -DUSE_CXX_STANDARD=$CXX_STANDARD
cat ViSP-third-party.txt
- name: Compile
working-directory: build
run: |
make -j$(nproc) install
- name: Run unit tests
working-directory: build
run: ctest -j$(nproc) --output-on-failure

- name: ViSP as 3rdparty with cmake
run: |
cd ${HOME}/visp_sample
mkdir visp_sample-build
cd visp_sample-build
CC=${{ matrix.compiler.CC }}
CXX=${{ matrix.compiler.CXX }}
cmake .. -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DVISP_DIR=/tmp/usr/local/lib/cmake/visp -DCMAKE_VERBOSE_MAKEFILE=ON
make -j$(nproc)
- name: ViSP as 3rdparty with visp.pc and pkg-config
run: |
cd ${HOME}/visp_sample
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/usr/local/lib/pkgconfig
CC=${{ matrix.compiler.CC }}
CXX=${{ matrix.compiler.CXX }}
pkg-config --cflags visp
pkg-config --libs visp
make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp.pc
make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp.pc clean
- name: ViSP as 3rdparty with visp-config
run: |
cd ${HOME}/visp_sample
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/usr/local/lib/pkgconfig
export VISP_INSTALL_PREFIX=/tmp/usr/local
CC=${{ matrix.compiler.CC }}
CXX=${{ matrix.compiler.CXX }}
$VISP_INSTALL_PREFIX/bin/visp-config --cflags
$VISP_INSTALL_PREFIX/bin/visp-config --libs
make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp-config
make CXX=${{ matrix.compiler.CXX }} -j$(nproc) -f Makefile.visp-config clean
119 changes: 119 additions & 0 deletions .github/workflows/ubuntu-ogre-src.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Ubuntu-ogre-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-ogre-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: Install Ogre dependencies
run: |
sudo apt-get update && sudo apt-get install -y libgles2-mesa-dev libvulkan-dev glslang-dev libxrandr-dev libxaw7-dev libx11-dev libzzip-dev libsdl2-dev
- name: Build Ogre from source
run: |
pwd
GIT_ADDRESS="/~https://github.com/OGRECave/ogre"
LATEST_TAG=`eval ${FUNCTION_GET_LATEST}`
echo "Newest tag is ${LATEST_TAG}"
git clone --depth 1 --branch ${LATEST_TAG} ${GIT_ADDRESS} ${HOME}/ogre
cd ${HOME}/ogre
mkdir build && cd build && mkdir install
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install
make -j$(nproc) install
echo "OGRE_DIR=$(pwd)/install" >> $GITHUB_ENV
echo $OGRE_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 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)
21 changes: 17 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ set(VISP_SOVERSION "${VISP_VERSION_MAJOR}.${VISP_VERSION_MINOR}")
# Package revision number
set(VISP_REVISION "1")

# Try to locate visp-images and, if it exists, its version
vp_find_dataset(VISP_DATASET_FOUND VISP_DATASET_LOCATION
VISP_DATASET_VERSION
VISP_DATASET_VERSION_MAJOR
VISP_DATASET_VERSION_MINOR
VISP_DATASET_VERSION_PATCH)

#-----------------------------------------------------------------------------
# TO BE CHECKED BEFORE NEXT RELEASE
#
Expand Down Expand Up @@ -984,6 +991,7 @@ include(cmake/VISPExtraTargets.cmake)
include(cmake/OgreTools.cmake)
if(USE_OGRE)
vp_set_ogre_media()
set(VISP_HAVE_OGRE_VERSION "(${OGRE_VERSION_MAJOR}<<16 | ${OGRE_VERSION_MINOR}<<8 | ${OGRE_VERSION_PATCH})") # for vpConfig.h
endif()

#----------------------------------------------------------------------
Expand Down Expand Up @@ -1436,10 +1444,6 @@ if(USE_JPEG)
endif()
endif()
endif()
if(USE_OIS)
vp_parse_header("${OIS_INCLUDE_DIR}/OISPrereqs.h" OIS_VERSION_LINES OIS_VERSION_MAJOR OIS_VERSION_MINOR OIS_VERSION_PATCH)
set(OIS_VERSION "${OIS_VERSION_MAJOR}.${OIS_VERSION_MINOR}.${OIS_VERSION_PATCH}")
endif()
if(USE_EIGEN3)
# Additionnal check to be sure that Eigen3 include dir os well detected
if(NOT EXISTS ${EIGEN3_INCLUDE_DIR})
Expand Down Expand Up @@ -1904,6 +1908,15 @@ endif()
if(USE_YARP)
status(" Yarp dir:" "${YARP_DIR}")
endif()
if(USE_OGRE)
if(NOT ${OGRE_DIR} STREQUAL "")
status(" Ogre dir:" "${OGRE_DIR}")
else()
status(" Ogre inc dir:" "${OGRE_INCLUDE_DIR}")
status(" Ogre Main lib:" "${OGRE_LIBRARY_REL}")
status(" Ogre plugin dir:" "${OGRE_PLUGIN_DIR_REL}")
endif()
endif()

# ========================== auxiliary ==========================
status("")
Expand Down
79 changes: 79 additions & 0 deletions cmake/FindOIS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#############################################################################
#
# ViSP, open source Visual Servoing Platform software.
# Copyright (C) 2005 - 2025 by Inria. All rights reserved.
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See the file LICENSE.txt at the root directory of this source
# distribution for additional information about the GNU GPL.
#
# For using ViSP with software that can not be combined with the GNU
# GPL, please contact Inria about acquiring a ViSP Professional
# Edition License.
#
# See https://visp.inria.fr for more information.
#
# This software was developed at:
# Inria Rennes - Bretagne Atlantique
# Campus Universitaire de Beaulieu
# 35042 Rennes Cedex
# France
#
# If you have questions regarding the use of this file, please contact
# Inria at visp@inria.fr
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Description:
# Try to find OIS 3rd party used by vpAROgre class
# Once run this will define:
#
# OIS_FOUND
# OIS_INCLUDE_DIRS
# OIS_LIBRARIES
# OIS_VERSION
#
#############################################################################

find_path(OIS_INCLUDE_DIR
NAMES ois/OIS.h
PATHS
$ENV{OIS_DIR}/include/ois
${OIS_DIR}/include/ois
/usr/include
/usr/local/include
)

find_library(OIS_LIBRARY
NAMES OIS
PATHS
$ENV{OIS_DIR}/lib
${OIS_DIR}/lib
/usr/lib
/usr/local/lib
)

if(OIS_LIBRARY AND OIS_INCLUDE_DIR)
set(OIS_INCLUDE_DIRS ${OIS_INCLUDE_DIR})
set(OIS_LIBRARIES ${OIS_LIBRARY})
set(OIS_FOUND TRUE)

get_filename_component(OIS_LIB_DIR ${OIS_LIBRARY} PATH)
vp_get_version_from_pkg("OIS" "${OIS_LIB_DIR}/pkgconfig" OIS_VERSION)

if(NOT OIS_VERSION)
vp_parse_header("${OIS_INCLUDE_DIR}/ois/OISPrereqs.h" OIS_VERSION_LINES OIS_VERSION_MAJOR OIS_VERSION_MINOR OIS_VERSION_PATCH)
set(OIS_VERSION "${OIS_VERSION_MAJOR}.${OIS_VERSION_MINOR}.${OIS_VERSION_PATCH}")
endif()
else()
set(OIS_FOUND FALSE)
endif()

mark_as_advanced(
OIS_INCLUDE_DIR
OIS_LIBRARY
)
3 changes: 1 addition & 2 deletions cmake/FindVicon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
# VICON_FOUND
# VICON_INCLUDE_DIRS
# VICON_LIBRARIES
# VICON_VERSION
#
#############################################################################

Expand Down Expand Up @@ -70,4 +69,4 @@ endif()
mark_as_advanced(
VICON_INCLUDE_DIR
VICON_LIBRARY
)
)
Loading

0 comments on commit f6faf50

Please sign in to comment.