From e7d1158f86fbc008d9242a0ce52ab33c1c4e09e5 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Sat, 18 Jul 2020 17:30:27 +0200 Subject: [PATCH] Reenable PySide2 support --- src/python_bindings/CMakeLists.txt | 3 +- src/python_bindings/shiboken/CMakeLists.txt | 154 ++++++++++---------- src/python_bindings/shiboken/global.h | 2 +- src/python_bindings/shiboken/typesystem.xml | 39 ++--- 4 files changed, 95 insertions(+), 103 deletions(-) diff --git a/src/python_bindings/CMakeLists.txt b/src/python_bindings/CMakeLists.txt index aedb7ad06b..9e01cca447 100644 --- a/src/python_bindings/CMakeLists.txt +++ b/src/python_bindings/CMakeLists.txt @@ -1,7 +1,6 @@ set(rviz_BINDINGS "") -# TODO(wjwwood): re-enabled PySide2 support when it is fixed. -# add_subdirectory(shiboken) +add_subdirectory(shiboken) add_subdirectory(sip) message(STATUS "Python binding generators: ${rviz_BINDINGS}") diff --git a/src/python_bindings/shiboken/CMakeLists.txt b/src/python_bindings/shiboken/CMakeLists.txt index 7bf671cb1a..70db6ee50b 100644 --- a/src/python_bindings/shiboken/CMakeLists.txt +++ b/src/python_bindings/shiboken/CMakeLists.txt @@ -10,92 +10,84 @@ find_package(python_qt_binding REQUIRED) include(${python_qt_binding_EXTRAS_DIR}/shiboken_helper.cmake) if(shiboken_helper_FOUND) - set(_configure_shiboken TRUE) - if(Shiboken_VERSION VERSION_GREATER "1.1.1") - if(APPLE AND Shiboken_VERSION VERSION_GREATER "1.2.1") - # This appears to no longer be a problem at least with Shiboken 1.2.2 on OS X and Boost 1.57. - set(_configure_shiboken TRUE) - else() - # shiboken 1.1.2 and higher will segfault until https://bugreports.qt-project.org/browse/PYSIDE-218 is fixed - set(_configure_shiboken FALSE) - message(WARNING "Shiboken version ${Shiboken_VERSION} would segfault when trying to process rviz (see https://bugreports.qt-project.org/browse/PYSIDE-218). Therefore shiboken bindings are being skipped.") - endif() - endif() - if(_configure_shiboken) - list(APPEND rviz_BINDINGS "shiboken") - set(rviz_BINDINGS "${rviz_BINDINGS}" PARENT_SCOPE) + list(APPEND rviz_BINDINGS "shiboken") + set(rviz_BINDINGS "${rviz_BINDINGS}" PARENT_SCOPE) - # To add a new rviz class to the bindings, add it: - # - in rviz_shiboken_SRCS below, like rviz_myclass_wrapper.cpp - # - in rviz_HDRS below, like ../rviz/my_class.h - # - in global.h, like #include - # - in typesystem.xml, like + # To add a new rviz class to the bindings, add it: + # - in rviz_shiboken_SRCS below, like rviz_myclass_wrapper.cpp + # - in rviz_HDRS below, like ../rviz/my_class.h + # - in global.h, like #include + # - in typesystem.xml, like - set(rviz_shiboken_SRCS - librviz_shiboken/librviz_shiboken_module_wrapper.cpp - librviz_shiboken/rviz_visualizationframe_wrapper.cpp - librviz_shiboken/rviz_visualizationmanager_wrapper.cpp - librviz_shiboken/rviz_display_wrapper.cpp - librviz_shiboken/rviz_displaygroup_wrapper.cpp - librviz_shiboken/rviz_ogrelogging_wrapper.cpp - librviz_shiboken/rviz_property_wrapper.cpp - librviz_shiboken/rviz_boolproperty_wrapper.cpp - librviz_shiboken/rviz_paneldockwidget_wrapper.cpp - librviz_shiboken/rviz_viewmanager_wrapper.cpp - librviz_shiboken/rviz_viewcontroller_wrapper.cpp - librviz_shiboken/rviz_tool_wrapper.cpp - librviz_shiboken/rviz_toolmanager_wrapper.cpp - librviz_shiboken/rviz_config_wrapper.cpp - librviz_shiboken/rviz_config_mapiterator_wrapper.cpp - librviz_shiboken/rviz_yamlconfigreader_wrapper.cpp - librviz_shiboken/rviz_yamlconfigwriter_wrapper.cpp - librviz_shiboken/rviz_wrapper.cpp - ) + set(rviz_shiboken_SRCS + librviz_shiboken/librviz_shiboken_module_wrapper.cpp + librviz_shiboken/rviz_visualizationframe_wrapper.cpp + librviz_shiboken/rviz_visualizationmanager_wrapper.cpp + librviz_shiboken/rviz_display_wrapper.cpp + librviz_shiboken/rviz_displaygroup_wrapper.cpp + librviz_shiboken/rviz_ogrelogging_wrapper.cpp + librviz_shiboken/rviz_property_wrapper.cpp + librviz_shiboken/rviz_boolproperty_wrapper.cpp + librviz_shiboken/rviz_paneldockwidget_wrapper.cpp + librviz_shiboken/rviz_viewmanager_wrapper.cpp + librviz_shiboken/rviz_viewcontroller_wrapper.cpp + librviz_shiboken/rviz_tool_wrapper.cpp + librviz_shiboken/rviz_toolmanager_wrapper.cpp + librviz_shiboken/rviz_config_wrapper.cpp + librviz_shiboken/rviz_config_mapiterator_wrapper.cpp + librviz_shiboken/rviz_yamlconfigreader_wrapper.cpp + librviz_shiboken/rviz_yamlconfigwriter_wrapper.cpp + librviz_shiboken/rviz_wrapper.cpp + ) + foreach(_FILE ${rviz_shiboken_SRCS}) + set_property(SOURCE ${_FILE} PROPERTY SKIP_AUTOGEN ON) + endforeach() - set(rviz_shiboken_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src) + set(rviz_shiboken_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/src) - set(rviz_HDRS - ${rviz_shiboken_INCLUDE_DIR}/rviz/visualization_frame.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/visualization_manager.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/view_manager.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/view_controller.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/display.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/display_group.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/properties/property.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/properties/bool_property.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/panel_dock_widget.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/tool.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/tool_manager.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/ogre_helpers/ogre_logging.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/config.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/yaml_config_reader.h - ${rviz_shiboken_INCLUDE_DIR}/rviz/yaml_config_writer.h - ) + set(rviz_HDRS + ${rviz_shiboken_INCLUDE_DIR}/rviz/visualization_frame.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/visualization_manager.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/view_manager.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/view_controller.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/display.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/display_group.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/properties/property.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/properties/bool_property.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/panel_dock_widget.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/tool.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/tool_manager.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/ogre_helpers/ogre_logging.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/config.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/yaml_config_reader.h + ${rviz_shiboken_INCLUDE_DIR}/rviz/yaml_config_writer.h + ) - shiboken_generator( - librviz - global.h - typesystem.xml - ${PROJECT_SOURCE_DIR}/src/python_bindings/shiboken - "${rviz_shiboken_SRCS}" - "${rviz_HDRS}" - "${rviz_shiboken_INCLUDE_DIR}" - "${CMAKE_CURRENT_BINARY_DIR}" - ) + include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}) - include_directories(rviz_shiboken - ${rviz_shiboken_INCLUDE_DIR}/rviz - ${rviz_shiboken_INCLUDE_DIR}/rviz/properties - ${rviz_shiboken_INCLUDE_DIR}/rviz/ogre_helpers - ) - shiboken_include_directories(rviz_shiboken "${rviz_shiboken_QT_COMPONENTS}") - add_library(rviz_shiboken ${rviz_shiboken_SRCS}) - set_target_properties(rviz_shiboken PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${PYTHON_INSTALL_DIR}/rviz) - target_link_libraries(rviz_shiboken ${PROJECT_NAME}) - shiboken_target_link_libraries(rviz_shiboken "${rviz_shiboken_QT_COMPONENTS}") + shiboken_generator( + librviz + global.h + typesystem.xml + ${PROJECT_SOURCE_DIR}/src/python_bindings/shiboken + "${rviz_shiboken_SRCS}" + "${rviz_HDRS}" + "${rviz_shiboken_INCLUDE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}" + ) - install(TARGETS rviz_shiboken - LIBRARY DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}) - endif() + include_directories(rviz_shiboken + ${rviz_shiboken_INCLUDE_DIR}/rviz + ${rviz_shiboken_INCLUDE_DIR}/rviz/properties + ${rviz_shiboken_INCLUDE_DIR}/rviz/ogre_helpers + ) + shiboken_include_directories(rviz_shiboken "${rviz_shiboken_QT_COMPONENTS}") + add_library(rviz_shiboken ${rviz_shiboken_SRCS}) + set_target_properties(rviz_shiboken PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/${PYTHON_INSTALL_DIR}/rviz) + target_link_libraries(rviz_shiboken ${PROJECT_NAME}) + shiboken_target_link_libraries(rviz_shiboken "${rviz_shiboken_QT_COMPONENTS}") + + install(TARGETS rviz_shiboken + LIBRARY DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}) endif() diff --git a/src/python_bindings/shiboken/global.h b/src/python_bindings/shiboken/global.h index c2a7bf1b14..39a0a6d35c 100644 --- a/src/python_bindings/shiboken/global.h +++ b/src/python_bindings/shiboken/global.h @@ -37,7 +37,7 @@ #define NULL 0 #endif -#include "pyside_global.h" +#include "pyside2_global.h" #include #include diff --git a/src/python_bindings/shiboken/typesystem.xml b/src/python_bindings/shiboken/typesystem.xml index 41a3ee49c6..ad390119a5 100644 --- a/src/python_bindings/shiboken/typesystem.xml +++ b/src/python_bindings/shiboken/typesystem.xml @@ -2,23 +2,24 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +