Skip to content

Commit dc6ae95

Browse files
Fix suffix used for Python libraries in rclpy and rosbag2-py on Windows (#97)
* Fix suffix used for Python libraries * Update ros-galactic-rclpy.patch * Update ros-galactic-rosbag2-py.patch * Trigger CI * Update ros-galactic-rclpy.patch * Rebuild packages * Update ros-galactic-rclpy.patch * Update ros-galactic-rclpy.patch * Update vinca_win.yaml Co-authored-by: Tobias Fischer <info@tobiasfischer.info>
1 parent b3656f1 commit dc6ae95

3 files changed

Lines changed: 52 additions & 29 deletions

File tree

patch/ros-galactic-rclpy.patch

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 9d0379d..37a7a18 100644
2+
index 9d0379d..53302d6 100644
33
--- a/CMakeLists.txt
44
+++ b/CMakeLists.txt
55
@@ -14,6 +14,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -11,7 +11,7 @@ index 9d0379d..37a7a18 100644
1111
find_package(ament_cmake REQUIRED)
1212
find_package(ament_cmake_python REQUIRED)
1313
find_package(rcl REQUIRED)
14-
@@ -25,27 +27,10 @@ find_package(rcutils REQUIRED)
14+
@@ -25,27 +27,9 @@ find_package(rcutils REQUIRED)
1515
find_package(rmw REQUIRED)
1616
find_package(rmw_implementation_cmake REQUIRED)
1717

@@ -25,9 +25,9 @@ index 9d0379d..37a7a18 100644
2525
- # pybind11 will setup the build for debug now.
2626
- set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
2727
-endif()
28-
+find_package(Python COMPONENTS Interpreter Development)
29-
28+
-
3029
-find_package(pybind11_vendor REQUIRED)
30+
+find_package(Python COMPONENTS Interpreter Development)
3131
find_package(pybind11 REQUIRED)
3232

3333
-if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -40,7 +40,7 @@ index 9d0379d..37a7a18 100644
4040
function(clean_windows_flags target)
4141
# Hack to avoid pybind11 issue.
4242
#
43-
@@ -109,11 +94,13 @@ endif()
43+
@@ -109,11 +93,13 @@ endif()
4444

4545
# Set the build location and install location for a CPython extension
4646
function(configure_build_install_location _library_name)
@@ -59,26 +59,24 @@ index 9d0379d..37a7a18 100644
5959

6060
# Install library for actual use
6161
install(TARGETS ${_library_name}
62-
@@ -128,10 +115,17 @@ add_library(rclpy_common SHARED
62+
@@ -128,10 +114,15 @@ add_library(rclpy_common SHARED
6363
)
6464
target_link_libraries(rclpy_common PUBLIC
6565
pybind11::pybind11
6666
- ${PYTHON_LIBRARIES}
6767
rcl::rcl
6868
rmw::rmw
6969
)
70-
+
7170
+if(NOT APPLE)
7271
+ target_link_libraries(rclpy_common PUBLIC ${Python_LIBRARIES})
7372
+else()
7473
+ set_target_properties(rclpy_common PROPERTIES
7574
+ LINK_FLAGS "-undefined dynamic_lookup")
7675
+endif()
77-
+
7876
target_include_directories(rclpy_common PUBLIC
7977
src/rclpy_common/include
8078
)
81-
@@ -147,7 +141,7 @@ install(TARGETS rclpy_common
79+
@@ -147,7 +138,7 @@ install(TARGETS rclpy_common
8280
)
8381

8482
# Split from main extension and converted to pybind11
@@ -87,22 +85,23 @@ index 9d0379d..37a7a18 100644
8785
src/rclpy/_rclpy_action.cpp
8886
src/rclpy/_rclpy_handle.cpp
8987
src/rclpy/_rclpy_logging.cpp
90-
@@ -177,6 +171,8 @@ pybind11_add_module(_rclpy_pybind11 SHARED
88+
@@ -177,6 +168,10 @@ pybind11_add_module(_rclpy_pybind11 SHARED
9189
src/rclpy/utils.cpp
9290
src/rclpy/wait_set.cpp
9391
)
9492
+set_target_properties(_rclpy_pybind11 PROPERTIES PREFIX "")
95-
+
93+
+if(WIN32)
94+
+ set_target_properties(_rclpy_pybind11 PROPERTIES SUFFIX ".pyd")
95+
+endif()
9696
target_include_directories(_rclpy_pybind11 PRIVATE
9797
src/rclpy/
9898
)
99-
@@ -187,18 +183,23 @@ target_link_libraries(_rclpy_pybind11 PRIVATE
99+
@@ -187,18 +182,24 @@ target_link_libraries(_rclpy_pybind11 PRIVATE
100100
rclpy_common
101101
rcpputils::rcpputils
102102
rcutils::rcutils
103103
+ pybind11::module
104104
)
105-
+
106105
configure_build_install_location(_rclpy_pybind11)
107106
clean_windows_flags(_rclpy_pybind11)
108107

@@ -112,7 +111,9 @@ index 9d0379d..37a7a18 100644
112111
src/rclpy/_rclpy_signal_handler.c
113112
)
114113
+set_target_properties(_rclpy_signal_handler PROPERTIES PREFIX "")
115-
+
114+
+if(WIN32)
115+
+ set_target_properties(_rclpy_signal_handler PROPERTIES SUFFIX ".pyd")
116+
+endif()
116117
target_link_libraries(_rclpy_signal_handler PRIVATE
117118
rclpy_common
118119
rcl::rcl

patch/ros-galactic-rosbag2-py.patch

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ index a5284cad..8f925de2 100644
1111
src/rosbag2_py/_reader.cpp
1212
)
1313
ament_target_dependencies(_reader PUBLIC
14-
@@ -77,8 +77,12 @@ ament_target_dependencies(_reader PUBLIC
14+
@@ -77,8 +77,15 @@ ament_target_dependencies(_reader PUBLIC
1515
"rosbag2_storage"
1616
)
1717
clean_windows_flags(_reader)
1818
+set_target_properties(_reader PROPERTIES PREFIX "")
19+
+if(WIN32)
20+
+ set_target_properties(_reader PROPERTIES SUFFIX ".pyd")
21+
+endif()
1922
+target_link_libraries(_reader PRIVATE
2023
+ pybind11::module
2124
+)
@@ -25,11 +28,14 @@ index a5284cad..8f925de2 100644
2528
src/rosbag2_py/_storage.cpp
2629
src/rosbag2_py/format_bag_metadata.cpp
2730
)
28-
@@ -87,8 +91,12 @@ ament_target_dependencies(_storage PUBLIC
31+
@@ -87,8 +91,15 @@ ament_target_dependencies(_storage PUBLIC
2932
"rosbag2_storage"
3033
)
3134
clean_windows_flags(_storage)
3235
+set_target_properties(_storage PROPERTIES PREFIX "")
36+
+if(WIN32)
37+
+ set_target_properties(_storage PROPERTIES SUFFIX ".pyd")
38+
+endif()
3339
+target_link_libraries(_storage PRIVATE
3440
+ pybind11::module
3541
+)
@@ -39,11 +45,14 @@ index a5284cad..8f925de2 100644
3945
src/rosbag2_py/_writer.cpp
4046
)
4147
ament_target_dependencies(_writer PUBLIC
42-
@@ -97,8 +105,12 @@ ament_target_dependencies(_writer PUBLIC
48+
@@ -97,8 +105,15 @@ ament_target_dependencies(_writer PUBLIC
4349
"rosbag2_storage"
4450
)
4551
clean_windows_flags(_writer)
4652
+set_target_properties(_writer PROPERTIES PREFIX "")
53+
+if(WIN32)
54+
+ set_target_properties(_writer PROPERTIES SUFFIX ".pyd")
55+
+endif()
4756
+target_link_libraries(_writer PRIVATE
4857
+ pybind11::module
4958
+)
@@ -53,11 +62,14 @@ index a5284cad..8f925de2 100644
5362
src/rosbag2_py/_info.cpp
5463
)
5564
ament_target_dependencies(_info PUBLIC
56-
@@ -106,8 +118,12 @@ ament_target_dependencies(_info PUBLIC
65+
@@ -106,8 +118,15 @@ ament_target_dependencies(_info PUBLIC
5766
"rosbag2_storage"
5867
)
5968
clean_windows_flags(_info)
6069
+set_target_properties(_info PROPERTIES PREFIX "")
70+
+if(WIN32)
71+
+ set_target_properties(_info PROPERTIES SUFFIX ".pyd")
72+
+endif()
6173
+target_link_libraries(_info PRIVATE
6274
+ pybind11::module
6375
+)
@@ -67,11 +79,14 @@ index a5284cad..8f925de2 100644
6779
src/rosbag2_py/_transport.cpp
6880
)
6981
ament_target_dependencies(_transport PUBLIC
70-
@@ -117,8 +133,12 @@ ament_target_dependencies(_transport PUBLIC
82+
@@ -117,8 +133,15 @@ ament_target_dependencies(_transport PUBLIC
7183
"rosbag2_transport"
7284
)
7385
clean_windows_flags(_transport)
7486
+set_target_properties(_transport PROPERTIES PREFIX "")
87+
+if(WIN32)
88+
+ set_target_properties(_transport PROPERTIES SUFFIX ".pyd")
89+
+endif()
7590
+target_link_libraries(_transport PRIVATE
7691
+ pybind11::module
7792
+)
@@ -81,11 +96,14 @@ index a5284cad..8f925de2 100644
8196
src/rosbag2_py/_reindexer.cpp
8297
)
8398
ament_target_dependencies(_reindexer PUBLIC
84-
@@ -126,6 +146,10 @@ ament_target_dependencies(_reindexer PUBLIC
99+
@@ -126,6 +146,13 @@ ament_target_dependencies(_reindexer PUBLIC
85100
"rosbag2_storage"
86101
)
87102
clean_windows_flags(_reindexer)
88103
+set_target_properties(_reindexer PROPERTIES PREFIX "")
104+
+if(WIN32)
105+
+ set_target_properties(_reindexer PROPERTIES SUFFIX ".pyd")
106+
+endif()
89107
+target_link_libraries(_reindexer PRIVATE
90108
+ pybind11::module
91109
+)

vinca_win.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ conda_index:
55
- robostack.yaml
66
- packages-ignore.yaml
77

8-
build_number: 3
8+
build_number: 4
99

1010
mutex_package: ros2-distro-mutex 0.2 galactic
1111

1212
skip_all_deps: false
1313

1414
# If full rebuild, the build number of the existing package has
1515
# to match the selected build number for skipping
16-
full_rebuild: true
16+
full_rebuild: false
1717

1818
packages_skip_by_deps:
1919
- iceoryx_utils
@@ -34,13 +34,15 @@ skip_existing:
3434
- https://conda.anaconda.org/robostack-experimental/
3535

3636
packages_select_by_deps:
37-
- ros_workspace
38-
- ros_environment
39-
- ros_base
40-
- rviz2 # needs to be built separately as otherwise build timeouts occur
41-
- desktop # see above
42-
- moveit
43-
- navigation2
37+
- rclpy
38+
- rosbag2-py
39+
# - ros_workspace
40+
# - ros_environment
41+
# - ros_base
42+
# - rviz2 # needs to be built separately as otherwise build timeouts occur
43+
# - desktop # see above
44+
# - moveit
45+
# - navigation2
4446
# - joint-state-broadcaster
4547
# - joint-state-publisher
4648
# - joint-trajectory-controller
@@ -54,4 +56,6 @@ packages_select_by_deps:
5456
# - vision-opencv
5557
# - ackermann-msgs
5658

59+
5760
patch_dir: patch
61+

0 commit comments

Comments
 (0)