Skip to content

Commit c448371

Browse files
committed
mujoco updated to 3.3.6
1 parent 8bb749f commit c448371

File tree

2 files changed

+63
-66
lines changed

2 files changed

+63
-66
lines changed

install.m

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function install()
2-
% Copyright 2022-2023 The MathWorks, Inc.
2+
% Copyright 2022-2025 The MathWorks, Inc.
33

44
%% Run this script once and follow the instructions
55
% Make sure you run this script from this folder.
66

7-
MJ_VER = '2.3.5';
7+
MJ_VER = '3.3.6';
88
GLFW_VER = '3.3.7';
99
urlsList = fileread("tools/links.json");
1010
blockPath = './blocks/';
@@ -85,37 +85,76 @@ function install()
8585

8686
%% Local functions
8787
function downloadfolder = downloader(urlsList, name, version)
88-
libraryFolder = 'lib';
89-
downloadfolder = fullfile(pwd, libraryFolder, computer('arch'), name);
88+
libraryFolder = 'lib';
89+
downloadfolder = fullfile(pwd, libraryFolder, computer('arch'), name);
90+
91+
if strcmp(name, 'mujoco')
92+
% Generate MuJoCo URL based on version and architecture
93+
downloadLink = generateMujocoUrl(version);
94+
else
95+
% Use JSON for other libraries (GLFW)
9096
urlJson = jsondecode(urlsList);
97+
downloadLink = '';
9198
for i=1:length(urlJson.files)
9299
obj = urlJson.files(i);
93100
if strcmp(obj.name, name) && strcmp(obj.version, version) && strcmp(obj.arch, computer('arch'))
94101
downloadLink = obj.downloadLink;
102+
break;
95103
end
96104
end
97-
disp(' ')
98-
disp('Download URL is:');
99-
disp(downloadLink);
100-
101-
if isfolder(downloadfolder)
102-
disp(' ')
103-
disp('folder exists already. it will be overwritten');
105+
106+
if isempty(downloadLink)
107+
error('Download link not found for %s version %s on %s', name, version, computer('arch'));
104108
end
109+
end
110+
111+
disp(' ')
112+
disp('Download URL is:');
113+
disp(downloadLink);
105114

106-
[~,~,ext]=fileparts(downloadLink);
107-
downloadFile = fullfile(libraryFolder, strcat('download', ext));
108-
status = mkdir(libraryFolder); %#ok<NASGU>
109-
websave(downloadFile, downloadLink);
110-
if strcmp(ext,'.zip')
111-
unzip(downloadFile, downloadfolder);
112-
elseif strcmp(ext, '.gz')
113-
untar(downloadFile, downloadfolder);
114-
else
115-
error('unknown extension. Unable to extract archive');
116-
end
115+
if isfolder(downloadfolder)
117116
disp(' ')
118-
disp(name + ' downloaded and extracted to this path:');
119-
disp(downloadfolder)
117+
disp('folder exists already. it will be overwritten');
118+
end
119+
120+
[~,~,ext]=fileparts(downloadLink);
121+
downloadFile = fullfile(libraryFolder, strcat('download', ext));
122+
status = mkdir(libraryFolder); %#ok<NASGU>
123+
websave(downloadFile, downloadLink);
124+
if strcmp(ext,'.zip')
125+
unzip(downloadFile, downloadfolder);
126+
elseif strcmp(ext, '.gz')
127+
untar(downloadFile, downloadfolder);
128+
else
129+
error('unknown extension. Unable to extract archive');
120130
end
131+
disp(' ')
132+
disp(name + ' downloaded and extracted to this path:');
133+
disp(downloadfolder)
134+
end
135+
136+
function url = generateMujocoUrl(version)
137+
baseUrl = 'https://github.com/deepmind/mujoco/releases/download/';
138+
139+
switch computer('arch')
140+
case 'win64'
141+
platform = 'windows-x86_64';
142+
ext = '.zip';
143+
case 'glnxa64'
144+
platform = 'linux-x86_64';
145+
ext = '.tar.gz';
146+
case 'maci64'
147+
platform = 'macos-universal2';
148+
ext = '.dmg';
149+
case 'maca64'
150+
% For Apple Silicon Macs
151+
platform = 'macos-universal2';
152+
ext = '.dmg';
153+
otherwise
154+
error('Unsupported architecture: %s', computer('arch'));
155+
end
156+
157+
% Construct the URL: version/mujoco-version-platform.ext
158+
url = sprintf('%s%s/mujoco-%s-%s%s', baseUrl, version, version, platform, ext);
159+
end
121160
end

tools/links.json

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,5 @@
11
{
22
"files": [
3-
{
4-
"name": "mujoco",
5-
"arch": "win64",
6-
"version": "2.1.5",
7-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.1.5/mujoco-2.1.5-windows-x86_64.zip"
8-
},
9-
{
10-
"name": "mujoco",
11-
"arch": "glnxa64",
12-
"version": "2.1.5",
13-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.1.5/mujoco-2.1.5-linux-x86_64.tar.gz"
14-
},
15-
{
16-
"name": "mujoco",
17-
"arch": "maci64",
18-
"version": "2.1.5",
19-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.1.5/mujoco-2.1.5-macos-universal2.dmg"
20-
},
21-
{
22-
"name": "mujoco",
23-
"arch": "win64",
24-
"version": "2.3.2",
25-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.3.2/mujoco-2.3.2-windows-x86_64.zip"
26-
},
27-
{
28-
"name": "mujoco",
29-
"arch": "glnxa64",
30-
"version": "2.3.2",
31-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.3.2/mujoco-2.3.2-linux-x86_64.tar.gz"
32-
},
33-
{
34-
"name": "mujoco",
35-
"arch": "win64",
36-
"version": "2.3.5",
37-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.3.5/mujoco-2.3.5-windows-x86_64.zip"
38-
},
39-
{
40-
"name": "mujoco",
41-
"arch": "glnxa64",
42-
"version": "2.3.5",
43-
"downloadLink": "https://github.com/deepmind/mujoco/releases/download/2.3.5/mujoco-2.3.5-linux-x86_64.tar.gz"
44-
},
453
{
464
"name": "glfw",
475
"arch": "win64",

0 commit comments

Comments
 (0)