Build Python bindings in build.yml.

We currently skip building the Python bindings on Windows since MSVC takes an hour+ on them. Internally, we use Clang for our Windows build, so are not affected by this issue.

PiperOrigin-RevId: 450914163
Change-Id: I329aab28f3a2aeb1896242a8712f89d8ecff2f92
This commit is contained in:
Saran Tunyasuvunakool
2022-05-25 07:01:19 -07:00
committed by Copybara-Service
parent 223874c4ca
commit aefab0e9dc
5 changed files with 110 additions and 41 deletions
+2 -6
View File
@@ -28,8 +28,7 @@ namespace mujoco::python {
namespace {
namespace py = ::pybind11;
MUJOCO_ALWAYS_INLINE
void ZeroDenominatorCheck(double b) {
inline void ZeroDenominatorCheck(double b) {
if (b == 0) {
PyErr_SetString(PyExc_ZeroDivisionError, "division by zero");
throw py::error_already_set();
@@ -37,14 +36,12 @@ void ZeroDenominatorCheck(double b) {
}
template <typename T>
MUJOCO_ALWAYS_INLINE
T FloorDiv(T a, T b) {
inline T FloorDiv(T a, T b) {
ZeroDenominatorCheck(b);
return std::floor(static_cast<double>(a) / static_cast<double>(b));
}
template <typename Trait>
MUJOCO_ALWAYS_INLINE
void DefEnum(py::module_& m) {
py::enum_<typename Trait::type> e(m, Trait::name);
for (const auto& [name, enumerator] : Trait::values) {
@@ -137,7 +134,6 @@ void DefEnum(py::module_& m) {
}
template <typename Tuple>
MUJOCO_ALWAYS_INLINE
void DefAllEnums(py::module_& m, Tuple&& tuple) {
using TupleNoRef = std::remove_reference_t<Tuple>;
if constexpr (std::tuple_size_v<TupleNoRef> != 0) {
-5
View File
@@ -55,11 +55,6 @@
_Pragma("clang diagnostic ignored \"-Wunused-lambda-capture\"")
#define MUJOCO_DIAG_UNIGNORE_UNUSED_LAMBDA_CAPTURE \
_Pragma("clang diagnostic pop")
#elif defined(__GNUC__)
#define MUJOCO_DIAG_IGNORE_UNUSED_LAMBDA_CAPTURE \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunused-lambda-capture\"")
#define MUJOCO_DIAG_UNIGNORE_UNUSED_LAMBDA_CAPTURE _Pragma("GCC diagnostic pop")
#else
#define MUJOCO_DIAG_IGNORE_UNUSED_LAMBDA_CAPTURE
#define MUJOCO_DIAG_UNIGNORE_UNUSED_LAMBDA_CAPTURE