Add .cmake files and fix LICENSE file path in make_sdist.sh.

Also make minor modifications to Python bindings code for GCC compatibility.

Fixes #191.

PiperOrigin-RevId: 435127640
Change-Id: I8bd3a35bbb2724a24341072ba8df3da4372f83d3
This commit is contained in:
Saran Tunyasuvunakool
2022-03-16 12:39:08 -07:00
parent 5aba2c9fc6
commit b7b7af06d9
7 changed files with 311 additions and 2 deletions
+5
View File
@@ -119,7 +119,12 @@ struct MjErrorIntercepter {
template <typename Return, typename... Args, typename Callable>
MUJOCO_ALWAYS_INLINE
static constexpr auto WrapFunc(Callable&& callable) {
#if defined(__GNUC__) && !defined(__clang__)
// GCC can't inline functions that call setjmp
return [callable](Args... args) mutable {
#else
return [callable](Args... args) MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE {
#endif
_mjPRIVATE__set_tls_error_fn(&MjErrorHandler);
// DON'T MIX RAII WITH SETJMP!
+4
View File
@@ -25,7 +25,11 @@
(defined(__GNUC__) && !defined(__clang__))
#define MUJOCO_ALWAYS_INLINE __attribute__((always_inline))
#define MUJOCO_ALWAYS_INLINE_LAMBDA MUJOCO_ALWAYS_INLINE
#if defined(__clang__)
#define MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE MUJOCO_ALWAYS_INLINE_LAMBDA mutable
#else
#define MUJOCO_ALWAYS_INLINE_LAMBDA_MUTABLE mutable MUJOCO_ALWAYS_INLINE_LAMBDA
#endif
#elif defined(_MSC_VER)
#define MUJOCO_ALWAYS_INLINE __forceinline
#if _MSC_VER >= 1927 && _MSVC_LANG >= 202002L