Skip to content

Commit

Permalink
use qt version for windows workaround
Browse files Browse the repository at this point in the history
Signed-off-by: wep21 <[email protected]>
  • Loading branch information
wep21 committed Oct 14, 2024
1 parent 9124d0c commit 444cfdf
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 59 deletions.
9 changes: 2 additions & 7 deletions rviz2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ find_package(rviz_common REQUIRED)

find_package(rviz_ogre_vendor REQUIRED)

if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
else()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
endif()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
# TODO(wjwwood): this block is to setup the windeployqt tool, could be removed later.
if(Qt${QT_VERSION_MAJOR}_FOUND AND WIN32 AND TARGET Qt${QT_VERSION_MAJOR}::qmake AND NOT TARGET Qt${QT_VERSION_MAJOR}::windeployqt)
get_target_property(_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
Expand Down
9 changes: 3 additions & 6 deletions rviz_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,13 @@ find_package(ament_cmake REQUIRED)
# do find_package(rviz_ogre_vendor) first to make sure the custom OGRE is found
find_package(rviz_ogre_vendor REQUIRED)

if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
if(${QT_VERSION} VERSION_LESS 5.15.0)
function(qt_wrap_cpp out)
qt5_wrap_cpp(_sources ${ARGN})
set("${out}" ${_sources} PARENT_SCOPE)
endfunction()
else()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
endif()

find_package(geometry_msgs REQUIRED)
Expand Down
9 changes: 2 additions & 7 deletions rviz_common/rviz_common-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,5 @@

# find package Qt5 because otherwise using the rviz_common::rviz_common
# exported target will complain that the Qt5::Widgets target does not exist
if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
else()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
endif()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
9 changes: 3 additions & 6 deletions rviz_default_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,13 @@ find_package(rviz_common REQUIRED)
find_package(rviz_rendering REQUIRED)
find_package(rviz_ogre_vendor REQUIRED)

if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
if(${QT_VERSION} VERSION_LESS 5.15.0)
function(qt_wrap_cpp out)
qt5_wrap_cpp(_sources ${ARGN})
set("${out}" ${_sources} PARENT_SCOPE)
endfunction()
else()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
endif()

find_package(geometry_msgs REQUIRED)
Expand Down
9 changes: 2 additions & 7 deletions rviz_default_plugins/rviz_default_plugins-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,5 @@

# find package Qt5 because otherwise using the rviz_default_plugins::rviz_default_plugins
# exported target will complain that the Qt5::Widgets target does not exist
if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
else()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
endif()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
9 changes: 3 additions & 6 deletions rviz_rendering/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@ find_package(ament_cmake_ros REQUIRED)
find_package(rviz_ogre_vendor REQUIRED)
find_package(rviz_assimp_vendor REQUIRED)

if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
if(${QT_VERSION} VERSION_LESS 5.15.0)
function(qt_wrap_cpp out)
qt5_wrap_cpp(_sources ${ARGN})
set("${out}" ${_sources} PARENT_SCOPE)
endfunction()
else()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
endif()

find_package(ament_index_cpp REQUIRED)
Expand Down
9 changes: 2 additions & 7 deletions rviz_rendering/rviz_rendering-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,5 @@

# find package Qt5 because otherwise using the rviz_rendering::rviz_rendering
# exported target will complain that the Qt5::Widgets target does not exist
if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
else()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
endif()
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)
9 changes: 3 additions & 6 deletions rviz_rendering_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@ find_package(ament_cmake REQUIRED)
if(BUILD_TESTING)
# do find_package(rviz_ogre_vendor) first to make sure the custom OGRE is found
find_package(rviz_ogre_vendor REQUIRED)
if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
if(${QT_VERSION} VERSION_LESS 5.15.0)
function(qt_wrap_cpp out)
qt5_wrap_cpp(_sources ${ARGN})
set("${out}" ${_sources} PARENT_SCOPE)
endfunction()
else()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
endif()
find_package(rviz_rendering REQUIRED)
find_package(resource_retriever REQUIRED)
Expand Down
9 changes: 2 additions & 7 deletions rviz_visual_testing_framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,8 @@ endif()

find_package(ament_cmake REQUIRED)
find_package(geometry_msgs REQUIRED)
if(MSVC)
set(QT_VERSION_MAJOR 5)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
else()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
endif()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
find_package(rclcpp REQUIRED)
find_package(rcutils REQUIRED)
find_package(rviz_common REQUIRED)
Expand Down

0 comments on commit 444cfdf

Please sign in to comment.