Skip to content

Commit 8f11e74

Browse files
committed
update win patch
Signed-off-by: wep21 <[email protected]>
1 parent 0a77a01 commit 8f11e74

File tree

1 file changed

+138
-14
lines changed

1 file changed

+138
-14
lines changed
Lines changed: 138 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,114 @@
1+
diff --git a/3rdparty/endian/endian.h b/3rdparty/endian/endian.h
2+
new file mode 100644
3+
index 00000000..9c5500b2
4+
--- /dev/null
5+
+++ b/3rdparty/endian/endian.h
6+
@@ -0,0 +1,103 @@
7+
+//
8+
+// endian.h
9+
+//
10+
+// https://gist.github.com/panzi/6856583
11+
+//
12+
+// I, Mathias Panzenböck, place this file hereby into the public domain. Use
13+
+// it at your own risk for whatever you like. In case there are
14+
+// jurisdictions that don't support putting things in the public domain you
15+
+// can also consider it to be "dual licensed" under the BSD, MIT and Apache
16+
+// licenses, if you want to. This code is trivial anyway. Consider it an
17+
+// example on how to get the endian conversion functions on different
18+
+// platforms.
19+
+
20+
+#ifndef PORTABLE_ENDIAN_H__
21+
+#define PORTABLE_ENDIAN_H__
22+
+
23+
+// Byte order
24+
+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__CYGWIN__)
25+
+# include <endian.h>
26+
+#elif defined(__APPLE__)
27+
+# include <libkern/OSByteOrder.h>
28+
+
29+
+# define htobe16(x) OSSwapHostToBigInt16(x)
30+
+# define htole16(x) OSSwapHostToLittleInt16(x)
31+
+# define be16toh(x) OSSwapBigToHostInt16(x)
32+
+# define le16toh(x) OSSwapLittleToHostInt16(x)
33+
+
34+
+# define htobe32(x) OSSwapHostToBigInt32(x)
35+
+# define htole32(x) OSSwapHostToLittleInt32(x)
36+
+# define be32toh(x) OSSwapBigToHostInt32(x)
37+
+# define le32toh(x) OSSwapLittleToHostInt32(x)
38+
+
39+
+# define htobe64(x) OSSwapHostToBigInt64(x)
40+
+# define htole64(x) OSSwapHostToLittleInt64(x)
41+
+# define be64toh(x) OSSwapBigToHostInt64(x)
42+
+# define le64toh(x) OSSwapLittleToHostInt64(x)
43+
+
44+
+# define __BYTE_ORDER BYTE_ORDER
45+
+# define __BIG_ENDIAN BIG_ENDIAN
46+
+# define __LITTLE_ENDIAN LITTLE_ENDIAN
47+
+# define __PDP_ENDIAN PDP_ENDIAN
48+
+#elif defined(__OpenBSD__)
49+
+# include <sys/endian.h>
50+
+#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
51+
+# include <sys/endian.h>
52+
+
53+
+# define be16toh(x) betoh16(x)
54+
+# define le16toh(x) letoh16(x)
55+
+
56+
+# define be32toh(x) betoh32(x)
57+
+# define le32toh(x) letoh32(x)
58+
+
59+
+# define be64toh(x) betoh64(x)
60+
+# define le64toh(x) letoh64(x)
61+
+#elif defined(_WIN32)
62+
+# include <stdlib.h>
63+
+# if BYTE_ORDER == LITTLE_ENDIAN
64+
+# if defined(_MSC_VER)
65+
+# define htobe16(x) _byteswap_ushort(x)
66+
+# define htole16(x) (x)
67+
+# define be16toh(x) _byteswap_ushort(x)
68+
+# define le16toh(x) (x)
69+
+
70+
+# define htobe32(x) _byteswap_ulong(x)
71+
+# define htole32(x) (x)
72+
+# define be32toh(x) _byteswap_ulong(x)
73+
+# define le32toh(x) (x)
74+
+
75+
+# define htobe64(x) _byteswap_uint64(x)
76+
+# define htole64(x) (x)
77+
+# define be64toh(x) _byteswap_uint64(x)
78+
+# define le64toh(x) (x)
79+
+# elif defined(__GNUC__) || defined(__clang__)
80+
+# define htobe16(x) __builtin_bswap16(x)
81+
+# define htole16(x) (x)
82+
+# define be16toh(x) __builtin_bswap16(x)
83+
+# define le16toh(x) (x)
84+
+
85+
+# define htobe32(x) __builtin_bswap32(x)
86+
+# define htole32(x) (x)
87+
+# define be32toh(x) __builtin_bswap32(x)
88+
+# define le32toh(x) (x)
89+
+
90+
+# define htobe64(x) __builtin_bswap64(x)
91+
+# define htole64(x) (x)
92+
+# define be64toh(x) __builtin_bswap64(x)
93+
+# define le64toh(x) (x)
94+
+# else
95+
+# error Compiler is not supported
96+
+# endif
97+
+# else
98+
+# error Byte order is not supported
99+
+# endif
100+
+
101+
+# define __BYTE_ORDER BYTE_ORDER
102+
+# define __BIG_ENDIAN BIG_ENDIAN
103+
+# define __LITTLE_ENDIAN LITTLE_ENDIAN
104+
+# define __PDP_ENDIAN PDP_ENDIAN
105+
+#else
106+
+# error Platform is not supported
107+
+#endif
108+
+
109+
+#endif // PORTABLE_ENDIAN_H__
1110
diff --git a/CMakeLists.txt b/CMakeLists.txt
2-
index 05b59e628..78a197a44 100644
111+
index 5b54eb0b..df9f3079 100644
3112
--- a/CMakeLists.txt
4113
+++ b/CMakeLists.txt
5114
@@ -9,9 +9,12 @@ option(
@@ -18,24 +127,39 @@ index 05b59e628..78a197a44 100644
18127

19128
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
20129
message("${PROJECT_NAME}: You did not request a specific build type: selecting 'RelWithDebInfo'.")
21-
22-
diff --git a/src/hardware_interface.cpp b/src/hardware_interface.cpp
23-
index 216d7d462..b500aadc7 100644
24-
--- a/src/hardware_interface.cpp
25-
+++ b/src/hardware_interface.cpp
26-
@@ -45,3 +45,4 @@
27-
+#include "ur_robot_driver/hardware_interface.hpp"
28-
#include "ur_client_library/exceptions.h"
29-
#include "ur_client_library/ur/tool_communication.h"
30-
#include "ur_client_library/ur/version_information.h"
31-
130+
@@ -37,6 +40,10 @@ find_package(ur_msgs REQUIRED)
131+
132+
include_directories(include)
133+
134+
+if(MSVC)
135+
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/endian)
136+
+endif()
137+
+
138+
set(THIS_PACKAGE_INCLUDE_DEPENDS
139+
controller_manager
140+
controller_manager_msgs
32141
diff --git a/include/ur_robot_driver/hardware_interface.hpp b/include/ur_robot_driver/hardware_interface.hpp
33-
index 14bdd29ea..330e4161e 100644
142+
index 3ff25ebe..46d6c221 100644
34143
--- a/include/ur_robot_driver/hardware_interface.hpp
35144
+++ b/include/ur_robot_driver/hardware_interface.hpp
36-
@@ -66,3 +66,5 @@
145+
@@ -63,6 +63,8 @@
146+
#include "geometry_msgs/msg/transform_stamped.hpp"
147+
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
148+
37149
+typedef unsigned int uint;
38150
+
39151
namespace ur_robot_driver
40152
{
41153
enum class PausingState
154+
diff --git a/src/hardware_interface.cpp b/src/hardware_interface.cpp
155+
index 621321e6..990dc690 100644
156+
--- a/src/hardware_interface.cpp
157+
+++ b/src/hardware_interface.cpp
158+
@@ -42,6 +42,7 @@
159+
#include <utility>
160+
#include <vector>
161+
162+
+#include "ur_robot_driver/hardware_interface.hpp"
163+
#include "ur_client_library/exceptions.h"
164+
#include "ur_client_library/ur/tool_communication.h"
165+
#include "ur_client_library/ur/version_information.h"

0 commit comments

Comments
 (0)