Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brainstorm: Apple silicon support #663

Merged
merged 7 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added external/spm/spm_bsplinc.mexmaca64
Binary file not shown.
Binary file added external/spm/spm_bsplins.mexmaca64
Binary file not shown.
31 changes: 29 additions & 2 deletions toolbox/core/bst_plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,14 @@
PlugDesc(end+1) = GetStruct('spm12');
PlugDesc(end).Version = 'latest';
PlugDesc(end).AutoUpdate = 0;
PlugDesc(end).URLzip = 'https://www.fil.ion.ucl.ac.uk/spm/download/restricted/eldorado/spm12.zip';
switch(OsType)
case 'mac64arm'
PlugDesc(end).URLzip = 'https://github.com/spm/spm12/archive/refs/heads/maint.zip';
PlugDesc(end).Version = 'github-maint';
otherwise
PlugDesc(end).Version = 'latest';
PlugDesc(end).URLzip = 'https://www.fil.ion.ucl.ac.uk/spm/download/restricted/eldorado/spm12.zip';
end
PlugDesc(end).URLinfo = 'https://www.fil.ion.ucl.ac.uk/spm/';
PlugDesc(end).TestFile = 'spm.m';
PlugDesc(end).ReadmeFile = 'README.md';
Expand Down Expand Up @@ -1258,9 +1265,16 @@ function Configure(PlugDesc)
if ~isempty(errMsg)
return;
end
% Check if plugin is supported on Apple silicon
OsType = bst_get('OsType', 0);
if strcmpi(OsType, 'mac64arm') && ismember(PlugName, PluginsNotSupportAppleSilicon())
errMsg = ['Plugin ', PlugName ' is not supported on Apple silicon yet.'];
PlugDesc = [];
return;
end
% Check if there is a URL to download
if isempty(PlugDesc.URLzip)
errMsg = ['No download URL for ', bst_get('OsType', 0), ': ', PlugName ''];
errMsg = ['No download URL for ', OsType, ': ', PlugName ''];
return;
end
% Compiled version
Expand Down Expand Up @@ -1857,6 +1871,12 @@ function Configure(PlugDesc)
if ~isempty(errMsg)
return;
end
% Check if plugin is supported on Apple silicon
OsType = bst_get('OsType', 0);
if strcmpi(OsType, 'mac64arm') && ismember(PlugName, PluginsNotSupportAppleSilicon())
errMsg = ['Plugin ', PlugDesc.Name ' is not supported on Apple silicon yet.'];
return;
end
% Minimum Matlab version
if ~isempty(PlugDesc.MinMatlabVer) && (PlugDesc.MinMatlabVer > 0) && (bst_get('MatlabVersion') < PlugDesc.MinMatlabVer)
strMinVer = sprintf('%d.%d', ceil(PlugDesc.MinMatlabVer / 100), mod(PlugDesc.MinMatlabVer, 100));
Expand Down Expand Up @@ -2831,3 +2851,10 @@ function SetProgressLogo(PlugDesc)
end
end


%% ===== NOT SUPPORTED APPLE SILICON =====
% Return list of plugins not supported on Apple silicon
function pluginNames = PluginsNotSupportAppleSilicon()
pluginNames = {'brain2mesh', 'ct2mrireg', 'duneuro', 'iso2mesh', 'mcxlab-cl', 'mcxlab-cuda', ...
'openmeeg', 'xdf'};
end
6 changes: 6 additions & 0 deletions toolbox/core/bst_startup.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ function bst_startup(BrainstormHomeDir, GuiLevel, BrainstormDbDir)
disp('BST> Warning: For better graphics, use Matlab >= 2014b');
end

% Check for Apple silicon (started with R2023b)
if (MatlabVersion >= 2302) && strcmp(bst_get('OsType', 0), 'mac64arm')
disp(['BST> Warning: Running on Apple silicon, some functions and plugins are not supported yet:' 10 ...
' Use Matlab < 2023b or Matlab for Intel processor for full support']);
end


%% ===== FORCE COMPILATION OF SOME INTERFACE FILES =====
if (GuiLevel == 1)
Expand Down