summarylogtreecommitdiffstats
path: root/mujoco.patch
blob: b65d6bd35afbe5ade999bb926b6424eab4de9e9d (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
diff --git a/cmake/MujocoDependencies.cmake b/cmake/MujocoDependencies.cmake
index d919b6e..68485aa 100644
--- a/cmake/MujocoDependencies.cmake
+++ b/cmake/MujocoDependencies.cmake
@@ -106,9 +106,9 @@ find_package(Git REQUIRED)
 
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ON
   PACKAGE_NAME
-  qhull
+  Qhull
   LIBRARY_NAME
   qhull
   GIT_REPO
@@ -130,18 +130,22 @@ findorfetch(
   "true"
   EXCLUDE_FROM_ALL
 )
-# MuJoCo includes a file from libqhull_r which is not exported by the qhull include directories.
-# Add it to the target.
-target_include_directories(
-  qhullstatic_r INTERFACE $<BUILD_INTERFACE:${qhull_SOURCE_DIR}/src/libqhull_r>
-)
-target_compile_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
+if(NOT TARGET qhullstatic_r)
+  add_library(qhullstatic_r INTERFACE)
+  target_link_libraries(qhullstatic_r INTERFACE Qhull::qhull_r)
+  # Workaround as headers are installed in <prefix>/include/libqhull_r/something.h
+  # but mujoco include them as #include <something.h>
+  get_property(qhull_include_dirs TARGET Qhull::qhull_r PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+  foreach(qhull_include_dir IN LISTS qhull_include_dirs)
+    target_include_directories(qhullstatic_r INTERFACE ${qhull_include_dirs}/libqhull_r)
+  endforeach()
+  target_include_directories(qhullstatic_r INTERFACE )
+endif()
 
 set(tinyxml2_BUILD_TESTING OFF)
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ON
   PACKAGE_NAME
   tinyxml2
   LIBRARY_NAME
@@ -154,12 +158,10 @@ findorfetch(
   tinyxml2
   EXCLUDE_FROM_ALL
 )
-target_compile_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
 
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ON
   PACKAGE_NAME
   tinyobjloader
   LIBRARY_NAME
@@ -177,7 +179,7 @@ set(ENABLE_DOUBLE_PRECISION ON)
 set(CCD_HIDE_ALL_SYMBOLS ON)
 findorfetch(
   USE_SYSTEM_PACKAGE
-  OFF
+  ON
   PACKAGE_NAME
   ccd
   LIBRARY_NAME
@@ -190,8 +192,6 @@ findorfetch(
   ccd
   EXCLUDE_FROM_ALL
 )
-target_compile_options(ccd PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS})
-target_link_options(ccd PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS})
 
 # libCCD has an unconditional `#define _CRT_SECURE_NO_WARNINGS` on Windows.
 # TODO(stunya): Remove this after https://github.com/danfis/libccd/pull/77 is merged.
@@ -217,7 +217,7 @@ if(MUJOCO_BUILD_TESTS)
   set(ABSL_BUILD_TESTING OFF)
   findorfetch(
     USE_SYSTEM_PACKAGE
-    OFF
+    ON
     PACKAGE_NAME
     absl
     LIBRARY_NAME
@@ -244,7 +244,7 @@ if(MUJOCO_BUILD_TESTS)
 
   findorfetch(
     USE_SYSTEM_PACKAGE
-    OFF
+    ON
     PACKAGE_NAME
     GTest
     LIBRARY_NAME
@@ -278,7 +278,7 @@ if(MUJOCO_BUILD_TESTS)
 
   findorfetch(
     USE_SYSTEM_PACKAGE
-    OFF
+    ON
     PACKAGE_NAME
     benchmark
     LIBRARY_NAME
@@ -297,6 +297,9 @@ endif()
 
 if(MUJOCO_TEST_PYTHON_UTIL)
   add_compile_definitions(EIGEN_MPL2_ONLY)
+  find_package(Eigen3 REQUIRED)
+  # Doing that so the next if is not triggered
+  add_library(eigen ALIAS Eigen3::Eigen)
   if(NOT TARGET eigen)
     # Support new IN_LIST if() operator.
     set(CMAKE_POLICY_DEFAULT_CMP0057 NEW)
diff --git a/sample/cmake/SampleDependencies.cmake b/sample/cmake/SampleDependencies.cmake
index 3534929..6732055 100644
--- a/sample/cmake/SampleDependencies.cmake
+++ b/sample/cmake/SampleDependencies.cmake
@@ -26,8 +26,8 @@ option(MUJOCO_SAMPLES_USE_SYSTEM_MUJOCO "Use installed MuJoCo version."
 )
 unset(DEFAULT_USE_SYSTEM_MUJOCO)
 
-option(MUJOCO_SAMPLES_USE_SYSTEM_MUJOCO "Use installed MuJoCo version." OFF)
-option(MUJOCO_SAMPLES_USE_SYSTEM_GLFW "Use installed GLFW version." OFF)
+option(MUJOCO_SAMPLES_USE_SYSTEM_MUJOCO "Use installed MuJoCo version." ON)
+option(MUJOCO_SAMPLES_USE_SYSTEM_GLFW "Use installed GLFW version." ON)
 
 set(MUJOCO_DEP_VERSION_glfw
     7d5a16ce714f0b5f4efa3262de22e4d948851525 # 3.3.6
@@ -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})
@@ -78,7 +78,7 @@ findorfetch(
   USE_SYSTEM_PACKAGE
   MUJOCO_SAMPLES_USE_SYSTEM_GLFW
   PACKAGE_NAME
-  glfw
+  glfw3
   LIBRARY_NAME
   glfw
   GIT_REPO
diff --git a/simulate/cmake/SimulateDependencies.cmake b/simulate/cmake/SimulateDependencies.cmake
index 9fba6a2..6404d29 100644
--- a/simulate/cmake/SimulateDependencies.cmake
+++ b/simulate/cmake/SimulateDependencies.cmake
@@ -26,8 +26,8 @@ option(MUJOCO_SIMULATE_USE_SYSTEM_MUJOCO "Use installed MuJoCo version."
 )
 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_glfw
     7d5a16ce714f0b5f4efa3262de22e4d948851525 # 3.3.6
@@ -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})
@@ -78,7 +78,7 @@ findorfetch(
   USE_SYSTEM_PACKAGE
   MUJOCO_SIMULATE_USE_SYSTEM_GLFW
   PACKAGE_NAME
-  glfw
+  glfw3
   LIBRARY_NAME
   glfw
   GIT_REPO