From 2488d1c5b2ee7803e71580a86a8a6925df159b7a Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 27 May 2022 19:28:45 +0200 Subject: [PATCH] Do not define TINYOBJLOADER_IMPLEMENTATION when building with CMake --- src/user/CMakeLists.txt | 1 + src/user/user_mesh.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/user/CMakeLists.txt b/src/user/CMakeLists.txt index 0727c5a9..7432ad9b 100644 --- a/src/user/CMakeLists.txt +++ b/src/user/CMakeLists.txt @@ -25,3 +25,4 @@ set(MUJOCO_USER_SRCS ) target_sources(mujoco PRIVATE ${MUJOCO_USER_SRCS}) +target_compile_definitions(mujoco PRIVATE MUJOCO_DO_NOT_DEFINE_TINYOBJLOADER_IMPLEMENTATION) diff --git a/src/user/user_mesh.cc b/src/user/user_mesh.cc index f3aa3f00..c086ffe6 100644 --- a/src/user/user_mesh.cc +++ b/src/user/user_mesh.cc @@ -25,7 +25,11 @@ #include #include +// This macro is defined when MuJoCo is built with CMake, +// not defined when MuJoCo is built with other build systems +#ifndef MUJOCO_DO_NOT_DEFINE_TINYOBJLOADER_IMPLEMENTATION #define TINYOBJLOADER_IMPLEMENTATION +#endif #include #include "cc/array_safety.h"