Skip to content

Commit

Permalink
Fix #346
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias-Fischer committed Apr 19, 2023
1 parent 1edbf07 commit 544b222
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 23 deletions.
19 changes: 14 additions & 5 deletions patch/ros-noetic-python-qt-binding.patch
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ index 0000000..9353bab
+define-macros = [@SIP_EXTRA_DEFINES@]
+exceptions = true
diff --git a/cmake/sip_helper.cmake b/cmake/sip_helper.cmake
index a055cf5..5e058a7 100644
index a055cf5..8f32039 100644
--- a/cmake/sip_helper.cmake
+++ b/cmake/sip_helper.cmake
@@ -18,7 +18,7 @@ execute_process(
Expand Down Expand Up @@ -99,7 +99,7 @@ index a055cf5..5e058a7 100644
#
# Run the SIP generator and compile the generated code into a library.
#
@@ -89,32 +98,98 @@ function(build_sip_binding PROJECT_NAME SIP_FILE)
@@ -89,32 +98,107 @@ function(build_sip_binding PROJECT_NAME SIP_FILE)
# SIP configure doesn't handle CMake targets
catkin_replace_imported_library_targets(LIBRARIES ${LIBRARIES})

Expand Down Expand Up @@ -135,7 +135,15 @@ index a055cf5..5e058a7 100644
+ set(SIP_LIBARIES "")
+ set(SIP_LIBRARY_DIRS "")
+
+ foreach(_x ${LIBRARIES} ${PYTHON_LIBRARIES})
+ if(APPLE)
+ set(LIBRARIES_TO_LOOP ${LIBRARIES})
+ else()
+ set(LIBRARIES_TO_LOOP ${LIBRARIES} ${PYTHON_LIBRARIES})
+ endif()
+
+ # message(WARNING "test LIBRARIES_TO_LOOP: ${LIBRARIES_TO_LOOP}")
+
+ foreach(_x ${LIBRARIES_TO_LOOP})
+ get_filename_component(_x_NAME "${_x}" NAME_WLE)
+ get_filename_component(_x_DIR "${_x}" DIRECTORY)
+ get_filename_component(_x "${_x_DIR}/${_x_NAME}" ABSOLUTE)
Expand All @@ -157,12 +165,13 @@ index a055cf5..5e058a7 100644
+ endif()
+ endforeach()
+ string(REGEX REPLACE "^," "" SIP_LIBARIES ${SIP_LIBARIES})
+ # message(WARNING "test SIP_LIBARIES: ${SIP_LIBARIES}")
+ foreach(_x ${LIBRARY_DIRS})
+ set(SIP_LIBRARY_DIRS "${SIP_LIBRARY_DIRS},\"${_x}\"")
+ endforeach()
+ string(REGEX REPLACE "^," "" SIP_LIBRARY_DIRS ${SIP_LIBRARY_DIRS})
+
+ message(WARNING "test lib dir: ${SIP_LIBRARY_DIRS}")
+ # message(WARNING "test lib dir: ${SIP_LIBRARY_DIRS}")
+ # TODO:
+ # I don't know what to do about LDFLAGS_OTHER
+ # what's the equivalent construct in sip5?
Expand All @@ -173,7 +182,7 @@ index a055cf5..5e058a7 100644
+ )
+ add_custom_command(
+ OUTPUT ${sip_LIBRARY_DIR}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMAND ${PYTHON_EXECUTABLE} -m pip install . --target ${sip_LIBRARY_DIR} --no-deps --verbose
+ COMMAND ${PYTHON_EXECUTABLE} -m pip install . --target ${sip_LIBRARY_DIR} --no-deps --verbose --upgrade
+ DEPENDS ${sip_SIP_CONFIGURE} ${SIP_FILE} ${sip_DEPENDS}
+ WORKING_DIRECTORY ${sip_BINARY_DIR}/sip
+ COMMENT "Running SIP-build generator for ${PROJECT_NAME} Python bindings..."
Expand Down
38 changes: 20 additions & 18 deletions patch/ros-noetic-qt-gui-cpp.patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
diff --git a/src/qt_gui_cpp/CMakeLists.txt b/src/qt_gui_cpp/CMakeLists.txt
index 9e9a0b92..82a91a9d 100644
--- a/src/qt_gui_cpp/CMakeLists.txt
+++ b/src/qt_gui_cpp/CMakeLists.txt
@@ -1,6 +1,6 @@
set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
-find_package(Qt5Widgets REQUIRED)
+find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
diff --git a/src/qt_gui_cpp_sip/CMakeLists.txt b/src/qt_gui_cpp_sip/CMakeLists.txt
index 370457fe..081e631d 100644
index 370457fe..5fbae184 100644
--- a/src/qt_gui_cpp_sip/CMakeLists.txt
+++ b/src/qt_gui_cpp_sip/CMakeLists.txt
@@ -26,12 +26,31 @@ set(qt_gui_cpp_sip_DEPENDENT_FILES
@@ -26,12 +26,33 @@ set(qt_gui_cpp_sip_DEPENDENT_FILES
${qt_gui_cpp_HDRS_DIR}/settings.h
)

+find_package(Python REQUIRED COMPONENTS Interpreter Development)
+find_package(TinyXML REQUIRED)
+
+
+
# maintain context for different named target
set(qt_gui_cpp_sip_INCLUDE_DIRS ${qt_gui_cpp_INCLUDE_DIRS} "${CMAKE_CURRENT_SOURCE_DIR}/../../include" ${catkin_INCLUDE_DIRS})
-set(qt_gui_cpp_sip_LIBRARIES ${qt_gui_cpp_LIBRARIES} ${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES})
-set(qt_gui_cpp_sip_LIBRARY_DIRS ${qt_gui_cpp_LIBRARY_DIRS} ${CATKIN_DEVEL_PREFIX}/lib)
+set(_qt_gui_cpp_sip_LIBRARIES ${qt_gui_cpp_LIBRARIES} ${PROJECT_NAME} ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${TinyXML_LIBRARIES} Python::Python)
+set(_qt_gui_cpp_sip_LIBRARIES ${qt_gui_cpp_LIBRARIES} ${PROJECT_NAME} ${Boost_LIBRARIES} ${TinyXML_LIBRARIES})
+
+if(NOT APPLE)
+ set(_qt_gui_cpp_sip_LIBRARIES ${_qt_gui_cpp_sip_LIBRARIES} Python::Python)
+endif()
+
+message(WARNING "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
+set(qt_gui_cpp_sip_LIBRARY_DIRS ${CMAKE_BINARY_DIR} ${qt_gui_cpp_LIBRARY_DIRS} ${CATKIN_DEVEL_PREFIX}/lib /usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/)
Expand All @@ -36,7 +50,7 @@ index 370457fe..081e631d 100644
find_package(python_qt_binding REQUIRED)
include(${python_qt_binding_EXTRAS_DIR}/sip_helper.cmake)

@@ -47,11 +66,11 @@ if(sip_helper_FOUND)
@@ -47,11 +68,11 @@ if(sip_helper_FOUND)
)

if(APPLE)
Expand All @@ -60,15 +74,3 @@ index ef3c52d7..cd02078d 100644

%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
diff --git a/src/qt_gui_cpp/CMakeLists.txt b/src/qt_gui_cpp/CMakeLists.txt
index 9e9a0b92..82a91a9d 100644
--- a/src/qt_gui_cpp/CMakeLists.txt
+++ b/src/qt_gui_cpp/CMakeLists.txt
@@ -1,6 +1,6 @@
set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
find_package(PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" REQUIRED)
-find_package(Qt5Widgets REQUIRED)
+find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
14 changes: 14 additions & 0 deletions patch/ros-noetic-rospack.patch
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ index 91dc79d..3d74661 100644
#add_definitions(-Wall)

set(API_BACKCOMPAT_V1 "YES" CACHE BOOL "Whether to enable backwards compatibility with old C++ API")
@@ -34,7 +34,12 @@ add_library(rospack
src/rospack_cmdline.cpp
src/utils.cpp
)
-target_link_libraries(rospack ${TinyXML2_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
+target_link_libraries(rospack ${TinyXML2_LIBRARIES} ${Boost_LIBRARIES})
+if(NOT APPLE)
+ target_link_libraries(rospack ${PYTHON_LIBRARIES})
+else()
+ set_target_properties(rospack PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
+endif()

add_executable(rospackexe src/rospack_main.cpp)
# Set the name, and make it a "global" executable
4 changes: 4 additions & 0 deletions vinca_osx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ skip_existing:
- https://conda.anaconda.org/robostack-staging/

packages_select_by_deps:
- rviz
- rospack
- python-qt-binding
- qt-gui-cpp
- actionlib
- foxglove_bridge
- ros-babel-fish
Expand Down
4 changes: 4 additions & 0 deletions vinca_osx_arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ packages_select_by_deps:
##
# TODO OSX-ARM64
##
- rviz
- rospack
- python-qt-binding
- qt-gui-cpp
- actionlib
- foxglove_bridge
- ros-babel-fish
Expand Down

0 comments on commit 544b222

Please sign in to comment.