Skip to content

Commit

Permalink
Reenable PySide2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Jan 3, 2023
1 parent 5340258 commit 020e69e
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 103 deletions.
3 changes: 1 addition & 2 deletions src/python_bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}")
Expand Down
154 changes: 73 additions & 81 deletions src/python_bindings/shiboken/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <rviz/my_class.h>
# - in typesystem.xml, like <object-type name="rviz::MyClass"/>
# 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 <rviz/my_class.h>
# - in typesystem.xml, like <object-type name="rviz::MyClass"/>

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()
2 changes: 1 addition & 1 deletion src/python_bindings/shiboken/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define NULL 0
#endif

#include "pyside_global.h"
#include "pyside2_global.h"

#include <QtCore/QtCore>
#include <QtGui/QtGui>
Expand Down
39 changes: 20 additions & 19 deletions src/python_bindings/shiboken/typesystem.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
<typesystem package="librviz_shiboken">
<load-typesystem name="typesystem_core.xml" generate="no"/>
<load-typesystem name="typesystem_gui.xml" generate="no"/>
<namespace-type name="rviz"/>
<object-type name="rviz::VisualizationFrame"/>
<object-type name="rviz::VisualizationManager"/>
<object-type name="rviz::Display"/>
<object-type name="rviz::DisplayGroup"/>
<object-type name="rviz::OgreLogging"/>
<object-type name="rviz::Property"/>
<object-type name="rviz::BoolProperty"/>
<object-type name="rviz::PanelDockWidget"/>
<object-type name="rviz::ViewManager"/>
<object-type name="rviz::ViewController"/>
<object-type name="rviz::Tool"/>
<object-type name="rviz::ToolManager"/>
<object-type name="rviz::Config">
<enum-type name="Type"/>
<object-type name="MapIterator"/>
</object-type>
<object-type name="rviz::YamlConfigReader"/>
<object-type name="rviz::YamlConfigWriter"/>
<namespace-type name="rviz">
<object-type name="VisualizationFrame"/>
<object-type name="VisualizationManager"/>
<object-type name="Display"/>
<object-type name="DisplayGroup"/>
<object-type name="OgreLogging"/>
<object-type name="Property"/>
<object-type name="BoolProperty"/>
<object-type name="PanelDockWidget"/>
<object-type name="ViewManager"/>
<object-type name="ViewController"/>
<object-type name="Tool"/>
<object-type name="ToolManager"/>
<object-type name="Config">
<enum-type name="Type"/>
<object-type name="MapIterator"/>
</object-type>
<object-type name="YamlConfigReader"/>
<object-type name="YamlConfigWriter"/>
</namespace-type>
</typesystem>

0 comments on commit 020e69e

Please sign in to comment.