-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
disable_copy_cxx_files_in_python_package.patch
150 lines (141 loc) · 5.21 KB
/
disable_copy_cxx_files_in_python_package.patch
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
diff --git a/python/setup.py b/python/setup.py
index 4a4f1ee9f..0ffa7247b 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -159,9 +159,9 @@ def run(self):
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/python/mujoco/__init__.py b/python/mujoco/__init__.py
index 5fb63ec44..3db713d28 100644
--- a/python/mujoco/__init__.py
+++ b/python/mujoco/__init__.py
@@ -22,7 +22,7 @@
_SYSTEM = platform.system()
if _SYSTEM == 'Windows':
- ctypes.WinDLL(os.path.join(os.path.dirname(__file__), 'mujoco.dll'))
+ ctypes.WinDLL('mujoco.dll')
elif _SYSTEM == 'Darwin':
proc_translated = subprocess.run(
['sysctl', '-n', 'sysctl.proc_translated'], capture_output=True).stdout
@@ -53,8 +53,13 @@
else:
from mujoco.glfw import GLContext
-HEADERS_DIR = os.path.join(os.path.dirname(__file__), 'include/mujoco')
-PLUGINS_DIR = os.path.join(os.path.dirname(__file__), 'plugin')
+if _SYSTEM == 'Windows':
+ _MJ_INSTALL_DIR = os.path.join(os.environ.get('CONDA_PREFIX'), 'Library')
+else:
+ _MJ_INSTALL_DIR = os.environ.get('CONDA_PREFIX')
+
+HEADERS_DIR = os.path.join(_MJ_INSTALL_DIR, 'include/mujoco')
+PLUGINS_DIR = os.path.join(_MJ_INSTALL_DIR, 'bin/mujoco_plugin')
PLUGIN_HANDLES = []
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7473cf3c..75f29a143 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,7 @@ option(MUJOCO_BUILD_EXAMPLES "Build samples for MuJoCo" ON)
option(MUJOCO_BUILD_SIMULATE "Build simulate library for MuJoCo" ON)
option(MUJOCO_BUILD_TESTS "Build tests for MuJoCo" ON)
option(MUJOCO_TEST_PYTHON_UTIL "Build and test utility libraries for Python bindings" ON)
+option(MUJOCO_INSTALL_PLUGINS "Install MuJoCo plugins" OFF)
if(APPLE AND (MUJOCO_BUILD_EXAMPLES OR MUJOCO_BUILD_SIMULATE))
enable_language(OBJC)
diff --git a/plugin/elasticity/CMakeLists.txt b/plugin/elasticity/CMakeLists.txt
index 7d25ffcf5..2be85c56a 100644
--- a/plugin/elasticity/CMakeLists.txt
+++ b/plugin/elasticity/CMakeLists.txt
@@ -39,3 +39,17 @@ target_link_options(
${MUJOCO_MACOS_LINK_OPTIONS}
${EXTRA_LINK_OPTIONS}
)
+
+if(MUJOCO_INSTALL_PLUGINS)
+ if(WIN32)
+ install(TARGETS elasticity
+ ARCHIVE DESTINATION "$ENV{TEMP}"
+ LIBRARY DESTINATION "$ENV{TEMP}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ else()
+ install(TARGETS elasticity
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ endif()
+endif()
diff --git a/plugin/sensor/CMakeLists.txt b/plugin/sensor/CMakeLists.txt
index 4dac6d0a6..6c9908703 100644
--- a/plugin/sensor/CMakeLists.txt
+++ b/plugin/sensor/CMakeLists.txt
@@ -40,3 +40,17 @@ target_link_options(
${MUJOCO_MACOS_LINK_OPTIONS}
${EXTRA_LINK_OPTIONS}
)
+
+if(MUJOCO_INSTALL_PLUGINS)
+ if(WIN32)
+ install(TARGETS sensor
+ ARCHIVE DESTINATION "$ENV{TEMP}"
+ LIBRARY DESTINATION "$ENV{TEMP}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ else()
+ install(TARGETS sensor
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ endif()
+endif()
diff --git a/plugin/sdf/CMakeLists.txt b/plugin/sdf/CMakeLists.txt
index 3e216fc42d..482337b262 100644
--- a/plugin/sdf/CMakeLists.txt
+++ b/plugin/sdf/CMakeLists.txt
@@ -51,3 +51,18 @@ target_link_options(
${MUJOCO_MACOS_LINK_OPTIONS}
${EXTRA_LINK_OPTIONS}
)
+
+if(MUJOCO_INSTALL_PLUGINS)
+ if(WIN32)
+ install(TARGETS sdf
+ ARCHIVE DESTINATION "$ENV{TEMP}"
+ LIBRARY DESTINATION "$ENV{TEMP}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ else()
+ install(TARGETS sdf
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ endif()
+endif()
+
diff --git a/plugin/actuator/CMakeLists.txt b/plugin/actuator/CMakeLists.txt
index 6cc79944a4..a738f03e2e 100644
--- a/plugin/actuator/CMakeLists.txt
+++ b/plugin/actuator/CMakeLists.txt
@@ -39,3 +39,17 @@ target_link_options(
${MUJOCO_MACOS_LINK_OPTIONS}
${EXTRA_LINK_OPTIONS}
)
+
+if(MUJOCO_INSTALL_PLUGINS)
+ if(WIN32)
+ install(TARGETS actuator
+ ARCHIVE DESTINATION "$ENV{TEMP}"
+ LIBRARY DESTINATION "$ENV{TEMP}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ else()
+ install(TARGETS actuator
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin")
+ endif()
+endif()