Skip to content

Commit

Permalink
CMake changes for using gz-gui9/qt6
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Feb 5, 2024
1 parent 7a460cd commit 9543bd2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,17 @@ set(GZ_FUEL_TOOLS_VER ${gz-fuel_tools10_VERSION_MAJOR})
# Find gz-gui
gz_find_package(gz-gui9 REQUIRED)
set(GZ_GUI_VER ${gz-gui9_VERSION_MAJOR})
gz_find_package (Qt5

set(QT_MAJOR_VERSION 6)
set(QT_MINOR_VERSION 0)
gz_find_package (Qt${QT_MAJOR_VERSION}
VERSION ${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}
COMPONENTS
Core
Quick
QuickControls2
REQUIRED
PKGCONFIG "Qt5Core Qt5Quick Qt5QuickControls2")
PKGCONFIG "Qt${QT_MAJOR_VERSION}Core Qt${QT_MAJOR_VERSION}Quick Qt${QT_MAJOR_VERSION}QuickControls2")

#--------------------------------------
# Find gz-physics
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/gui_system_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_AUTOMOC ON)

find_package(gz-sim9 REQUIRED COMPONENTS gui)

QT5_ADD_RESOURCES(resources_RCC ${PROJECT_NAME}.qrc)
qt_add_resources(resources_RCC ${PROJECT_NAME}.qrc)

add_library(${PROJECT_NAME} SHARED
${PROJECT_NAME}.cc
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/rendering_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(CMAKE_AUTOMOC ON)

find_package(gz-gui9 REQUIRED)

QT5_ADD_RESOURCES(resources_RCC ${GUI_PLUGIN}.qrc)
qt_add_resources(resources_RCC ${GUI_PLUGIN}.qrc)

add_library(${GUI_PLUGIN} SHARED
${GUI_PLUGIN}.cc
Expand Down
4 changes: 1 addition & 3 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(CMAKE_AUTORCC ON)
# located in different directories than the containing .cc file. For Qt header
# files in `include/gz/sim/gui`, we use qt5_wrap_cpp instead. There is
# no need to add entries for Qt header files in `src/gui/`.
qt5_wrap_cpp(gui_sources
qt_wrap_cpp(gui_sources
${PROJECT_SOURCE_DIR}/include/gz/sim/gui/GuiSystem.hh
)

Expand All @@ -51,8 +51,6 @@ target_link_libraries(${gui_target}
gz-gui${GZ_GUI_VER}::gz-gui${GZ_GUI_VER}
gz-transport${GZ_TRANSPORT_VER}::gz-transport${GZ_TRANSPORT_VER}
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
${Qt5Core_LIBRARIES}
${Qt5Widgets_LIBRARIES}
)

set(CMAKE_AUTOMOC OFF)
Expand Down
4 changes: 2 additions & 2 deletions src/gui/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function(gz_add_gui_library library_name)

cmake_parse_arguments(gz_add_gui_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

QT5_WRAP_CPP(${library_name}_headers_MOC ${gz_add_gui_library_QT_HEADERS})
QT5_ADD_RESOURCES(${library_name}_RCC ${library_name}.qrc)
qt_wrap_cpp(${library_name}_headers_MOC ${gz_add_gui_library_QT_HEADERS})
qt_add_resources(${library_name}_RCC ${library_name}.qrc)

if(MSVC)
# Warning #4251 is the "dll-interface" warning that tells you when types
Expand Down

0 comments on commit 9543bd2

Please sign in to comment.