Skip to content

Commit a21584c

Browse files
committed
Allow build_mex to find system liblsl; fixup for Apple Silicon.
1 parent 7da4d3c commit a21584c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Instead, you can download the source, the dependencies, and build yourself. This
1212

1313
1. Clone or download a zip of this repository from https://github.com/labstreaminglayer/liblsl-Matlab
1414
* If you downloaded the zip, extract it somewhere convenient.
15-
2. Add an up-to-date build of the liblsl binary to the `liblsl-Matlab/bin/` directory.
15+
2. Ensure you have an up-to-date build of the liblsl library binary available.
1616
* Option 1: Do nothing and it will download automatically when first required.
1717
* This might fail, or even if it succeeds in downloading the file, you might still get errors trying to load the library. Try Option 2 next.
18-
* Option 2: Download precompiled libraries from the [liblsl release page](https://github.com/sccn/liblsl/releases)
18+
* Option 2: Download precompiled libraries from the [liblsl release page](https://github.com/sccn/liblsl/releases) and place it in the `liblsl-Matlab/bin` folder.
1919
* See [here](https://labstreaminglayer.readthedocs.io/info/faqs.html#binaries) for more information about which library you need.
2020
* This doesn't always work, unfortunately. Try option 3.
2121
* Option 3: Build it yourself.

build_mex.m

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@
3232
[~, base, ~] = fileparts(f.name);
3333
targetstats = dir([base, ext]);
3434
if isempty(targetstats) || f.datenum > targetstats.datenum
35-
mex(['-I', lsl_include_dir], '-L.', libs{:}, ['../mex/', f.name]);
35+
mex(['-I', lsl_include_dir], '-L.', ['-L', fileparts(lsl_fname)], ...
36+
libs{:}, ['../mex/', f.name]);
3637
else
3738
disp([base, ext, ' up to date']);
3839
end
3940
end
4041
if ismac
41-
system('install_name_tool -add_rpath "@loader_path/" lsl_loadlib_.mexmaci64')
42+
targ_lib = dir('lsl_loadlib_.mexmac*');
43+
system(['install_name_tool -add_rpath "@loader_path/" ', targ_lib.name]);
4244
end
4345

4446
cd(orig_path);

0 commit comments

Comments
 (0)