summarylogtreecommitdiffstats
path: root/mujoco.patch
blob: b4c10fadefc9159ca42dd856a139938a2e32d629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff --git a/python/mujoco/CMakeLists.txt b/python/mujoco/CMakeLists.txt
index 90fab4eb..03162872 100644
--- a/python/mujoco/CMakeLists.txt
+++ b/python/mujoco/CMakeLists.txt
@@ -132,7 +132,7 @@ endif()
 set(MUJOCO_PYTHON_ABSL_TARGETS absl::core_headers absl::flat_hash_map absl::span)
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ON
   PACKAGE_NAME
   absl
   LIBRARY_NAME
@@ -165,7 +165,7 @@ endforeach()
 add_compile_definitions(EIGEN_MPL2_ONLY)
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ON
   PACKAGE_NAME
   Eigen3
   LIBRARY_NAME
@@ -183,6 +183,7 @@ findorfetch(
 option(MUJOCO_PYTHON_USE_SYSTEM_PYBIND11 "Use installed pybind11 version." OFF)
 findorfetch(
   USE_SYSTEM_PACKAGE
+  ON
   MUJOCO_PYTHON_USE_SYSTEM_PYBIND11
   PACKAGE_NAME
   pybind11
diff --git a/python/mujoco/__init__.py b/python/mujoco/__init__.py
index d551daa2..8dc9892e 100644
--- a/python/mujoco/__init__.py
+++ b/python/mujoco/__init__.py
@@ -198,8 +198,8 @@ _specs.MjSpec.to_zip = to_zip
 _structs.MjData.bind = _bind_data
 _structs.MjModel.bind = _bind_model
 
-HEADERS_DIR = os.path.join(os.path.dirname(__file__), 'include/mujoco')
-PLUGINS_DIR = os.path.join(os.path.dirname(__file__), 'plugin')
+HEADERS_DIR = '/usr/include/mujoco'
+PLUGINS_DIR = '/usr/lib/mujoco/plugins'
 
 PLUGIN_HANDLES = []
 
diff --git a/python/setup.py b/python/setup.py
index cebdec84..ec798295 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -151,15 +151,16 @@ class BuildCMakeExtension(build_ext.build_ext):
         self._mujoco_include_path,
         self._mujoco_plugins_path,
         self._mujoco_framework_path,
-    ) = self._find_mujoco()
+    #) = self._find_mujoco()
+    ) = ("/usr/lib","/usr/include/mujoco","/usr/lib/mujoco/plugins",None)
     self._configure_cmake()
     for ext in self.extensions:
       assert ext.name.startswith(EXT_PREFIX)
       assert '.' not in ext.name[len(EXT_PREFIX) :]
       self.build_extension(ext)
-    self._copy_external_libraries()
-    self._copy_mujoco_headers()
-    self._copy_plugin_libraries()
+    #self._copy_external_libraries()
+    #self._copy_mujoco_headers()
+    #self._copy_plugin_libraries()
     if self._is_apple:
       self._copy_mjpython()
 
diff --git a/simulate/CMakeLists.txt b/simulate/CMakeLists.txt
index 4a615018..5a0fbd0e 100644
--- a/simulate/CMakeLists.txt
+++ b/simulate/CMakeLists.txt
@@ -81,6 +81,7 @@ if(MUJOCO_HARDEN)
 endif()
 
 # Fetch lodepng dependency.
+find_package(lodepng REQUIRED)
 if(NOT TARGET lodepng)
   FetchContent_Declare(
     lodepng
@@ -116,8 +117,13 @@ if(APPLE)
 endif()
 target_include_directories(
   platform_ui_adapter PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
-                             $<TARGET_PROPERTY:glfw,INTERFACE_INCLUDE_DIRECTORIES>
 )
+# Upstream MuJoCo is carefully not linking glfw here, and so it is just include its directories
+# to avoid dealing with two copies of glfw. In conda-forge (or in any C++/Python distribution)
+# pyglfw will depend on the same glfw copy linked here, so we can just link glfw normally
+# This avoids the tricky cmake bug https://gitlab.kitware.com/cmake/cmake/-/issues/19072
+# target_include_directories(platform_ui_adapter PUBLIC glfw)
+target_link_libraries(platform_ui_adapter PUBLIC glfw)
 target_link_libraries(platform_ui_adapter PUBLIC mujoco::mujoco)
 if(SIMULATE_GLFW_DYNAMIC_SYMBOLS)
   target_compile_definitions(platform_ui_adapter PUBLIC mjGLFW_DYNAMIC_SYMBOLS)
diff --git a/simulate/cmake/SimulateDependencies.cmake b/simulate/cmake/SimulateDependencies.cmake
index 7885f5f9..1b69b018 100644
--- a/simulate/cmake/SimulateDependencies.cmake
+++ b/simulate/cmake/SimulateDependencies.cmake
@@ -22,12 +22,12 @@ else()
 endif()
 
 option(MUJOCO_SIMULATE_USE_SYSTEM_MUJOCO "Use installed MuJoCo version."
-       ${DEFAULT_USE_SYSTEM_MUJOCO}
+       ON
 )
 unset(DEFAULT_USE_SYSTEM_MUJOCO)
 
-option(MUJOCO_SIMULATE_USE_SYSTEM_MUJOCO "Use installed MuJoCo version." OFF)
-option(MUJOCO_SIMULATE_USE_SYSTEM_GLFW "Use installed GLFW version." OFF)
+option(MUJOCO_SIMULATE_USE_SYSTEM_MUJOCO "Use installed MuJoCo version." ON)
+option(MUJOCO_SIMULATE_USE_SYSTEM_GLFW "Use installed GLFW version." ON)
 
 set(MUJOCO_DEP_VERSION_glfw3
     7b6aead9fb88b3623e3b3725ebb42670cbe4c579 # 3.4
@@ -59,7 +59,7 @@ findorfetch(
 )
 
 option(MUJOCO_EXTRAS_STATIC_GLFW
-       "Link MuJoCo sample apps and simulate libraries against GLFW statically." ON
+       "Link MuJoCo sample apps and simulate libraries against GLFW statically." OFF
 )
 if(MUJOCO_EXTRAS_STATIC_GLFW)
   set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})