Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying an order of Qt versions to consider #3

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ RUN --mount=type=bind,target=/tmp/rviz \
apt-get -q install --no-install-recommends -y \
# Some basic requirements
wget git sudo \
# Qt6 packages for Jammy
$(test "$ROS_DISTRO" = "one" && echo "qt6-base-dev qt6-base-dev-tools libqt6opengl6-dev") \
# Preferred build tools
clang clang-format-12 clang-tidy clang-tools ccache && \
#
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,31 @@ jobs:
distro: [noetic, jammy]
ogre: ["1.9", "1.12"]
include:
- qt: 5
cxxflags: -Werror
- distro: noetic
ogre: 1.9
env:
CLANG_TIDY: true
- distro: jammy
ogre: 1.12
qt: 6
cxxflags: -Wno-deprecated-declarations -Werror

env:
CXXFLAGS: "-DRVIZ_DEPRECATE_QT4_SLOTS -Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-strict-aliasing -Wno-sign-compare"
CXXFLAGS: "-DRVIZ_DEPRECATE_QT4_SLOTS -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-strict-aliasing -Wno-sign-compare ${{ matrix.cxxflags}}"
UPSTREAM_WORKSPACE: ${{ matrix.distro != 'jammy' && 'github:rhaschke/python_qt_binding#silent-external-warnings' || '' }}
AFTER_INSTALL_TARGET_DEPENDENCIES: apt install -qq -y libogre-${{ matrix.ogre }}-dev
CATKIN_LINT: true
CMAKE_ARGS: -DRVIZ_QT_VERSIONS="${{ matrix.qt }}"
CCACHE_DIR: ${{ github.workspace }}/.ccache
BASEDIR: /home/runner/work
DOCKER_IMAGE: rhaschke/ici:rviz-${{ matrix.distro }}-ros
CACHE_PREFIX: ${{ matrix.distro }}
# perform full clang-tidy check only on manual trigger (workflow_dispatch), PRs do check changed files, otherwise nothing
CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }}

name: "${{ matrix.distro }} • ogre ${{ matrix.ogre }}${{ matrix.env.CLANG_TIDY && (github.event_name != 'workflow_dispatch' && ' • clang-tidy (delta)' || ' • clang-tidy (all)') || '' }}"
name: "${{ matrix.distro }} • ogre ${{ matrix.ogre }} • Qt ${{ matrix.qt }}${{ matrix.env.CLANG_TIDY && (github.event_name != 'workflow_dispatch' && ' • clang-tidy (delta)' || ' • clang-tidy (all)') || '' }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,19 @@ find_package(OpenGL REQUIRED)

set(CMAKE_AUTOMOC ON)

find_package(Qt6 COMPONENTS Core Widgets OpenGL)
if (NOT Qt6_FOUND)
find_package(Qt5 COMPONENTS Core Widgets OpenGL)
set(QTVERSION ${Qt5_VERSION})
set(QT_LIBRARIES Qt5::Widgets)
else()
set(QTVERSION ${Qt6_VERSION})
set(QT_LIBRARIES Qt6::Widgets)
set(RVIZ_QT_VERSIONS "5;6" CACHE STRING "List of Qt versions to consider (in order)")
foreach(_current_version ${RVIZ_QT_VERSIONS})
find_package(Qt${_current_version} QUIET COMPONENTS Core Widgets OpenGL)
if (Qt${_current_version}_FOUND)
set(QTVERSION ${Qt${_current_version}_VERSION})
set(QT_LIBRARIES Qt${_current_version}::Widgets)
break() # early break from loop
else()
message(WARNING "Qt${_current_version} not found.")
endif()
endforeach()
if(NOT QTVERSION)
message(FATAL_ERROR "Failed to find a suitable Qt version.")
endif()
message(STATUS "Found Qt ${QTVERSION}")
add_definitions(-DQT_NO_KEYWORDS)
Expand Down
Loading