Commit ccd1d8f9 authored by Günter Windau's avatar Günter Windau

remove old lsl lib, added new lsl lib for macos only in root dir lliblsl,...

remove old lsl lib, added new lsl lib for macos only in root dir lliblsl, added init.d scripts for setting lsl path per architecture
parent f479b6f0
Please make sure that you have the most recent binaries from liblsl/bin/ in here.
\ No newline at end of file
#!/bin/sh
# Build Octave bindings on 64bit Linux
# You need the package liboctave-dev *or* matlab-support installed and
# either liblsl64.so or a link to it in the bin folder
# This builds with matlab by default, but you can suppress the check by
# setting OCT (e.g. OCT=1 ./build_linux.sh)
if [ ! -e bin/liblsl64.so ]; then
echo 'liblsl64.so not found in bin/'
exit 1;
fi
if [ -z "$OCT" ] && [ `which matlab-mex` ]; then
echo 'Building with matlab-mex'
buildcmd='matlab-mex'
elif [ `which mkoctfile` ]; then
echo 'Building with mkoctfile'
buildcmd='mkoctfile --mex'
else
echo 'No build command found, exiting...'
exit 1;
fi
cd bin
for i in ../mex/*.c; do $buildcmd -I../../liblsl/include -L. -llsl64 -ldl ../mex/$i; done
cd ..
octave-cli -p bin examples/LSLVersion.m
......@@ -21,6 +21,10 @@ for i = 1:size(pathdirs,1)
exclude_p=genpath(exclude_d);
rmpath(exclude_p);
exclude_d=[d '/liblsl'];
exclude_p=genpath(exclude_d);
rmpath(exclude_p);
% disp(['added directory ', d, ' to the MATLAB path']);
else
disp(['directory ', d, ' does not exist, not added to the MATLAB path']);
......
% Set up matlab path for the labstreaminglayer library
pathdirs = { ...
[ biofysica_root '/liblsl/maci64' ]
};
for i = 1:size(pathdirs,1)
d = pathdirs{i};
if exist(d,'dir')
p=genpath(d);
addpath(p);
exclude_d=[d '/init.d'];
exclude_p=genpath(exclude_d);
rmpath(exclude_p);
exclude_d=[d '/.svn'];
exclude_p=genpath(exclude_d);
rmpath(exclude_p);
exclude_d=[d '/.git'];
exclude_p=genpath(exclude_d);
rmpath(exclude_p);
exclude_d=[d '/liblsl'];
exclude_p=genpath(exclude_d);
rmpath(exclude_p);
% disp(['added directory ', d, ' to the MATLAB path']);
else
disp(['directory ', d, ' does not exist, not added to the MATLAB path']);
end
clear pathdirs d p exclude_d i exclude_p
end
{
"package": {
"name": "liblsl-Matlab",
"repo": "LSL",
"subject": "labstreaminglayer",
"desc": "Travis CI build",
"website_url": "https://github.com/labstreaminglayer/liblsl-matlab",
"issue_tracker_url": "https://github.com/labstreaminglayer/liblsl-matlab/issues",
"vcs_url": "https://github.com/labstreaminglayer/liblsl-matlab.git",
"github_use_tag_release_notes": true,
"licenses": ["MIT"],
"public_download_numbers": false,
"public_stats": false
},
"version": {
"name": "1.12",
"desc": "Matlab bindings for liblsl",
"released": "2018-05-02",
"vcs_tag": "",
"gpgSign": false
},
"files": [ {
"includePattern": "./((.)[^/]*\.tar\.bz2)",
"uploadPattern": "$1",
"matrixParams": { "override": 1 }
}],
"publish": true
}
language: c
env:
LSLDIST_URL="https://dl.bintray.com/labstreaminglayer/LSL/"
UBUNTU_DIST="trusty"
LSL_VERSION="1.1.2"
- CMakeArgs=""
script:
- cp ${LSL_INSTALL_ROOT}/lib/* bin/
- octave-cli --eval build_mex
- rm bin/*.o
- tar --transform "s/^\.\?/liblsl-matlab/" -cjf liblsl-matlab-${LSL_VERSION}.tar.bz2 . || true
matrix:
include:
- os: linux
addons:
apt:
packages:
- liboctave-dev
before_script:
- travis_retry wget --quiet ${LSLDIST_URL}/lsl-liblsl{,-dev}_${LSL_VERSION}-${UBUNTU_DIST}_amd64.deb
- for deb in *.deb; do dpkg -x ${deb} LSL; done
- export LSL_INSTALL_ROOT=LSL/usr
- os: osx
before_install:
- brew install octave
before_script:
- travis_retry wget --quiet ${LSLDIST_URL}/LSL-${LSL_VERSION}-Darwin-liblsl{,-dev}.tar.bz2
- mkdir LSL; for file in *.tar.bz2; do tar -xf ${file} -C LSL; done
- export LSL_INSTALL_ROOT=LSL
deploy:
skip_cleanup: true
provider: bintray
user: tstenner
key:
secure: "PoHMsNdp5UgFtAPljabOVC+6r5wjwHZwGgVDLEgKs0b+EwgkShj42Li03vQCz2u0cRkgHutv5cGCe8L5+ez4zyqnF98gXrgflbhcfdjhHEB6hp65kV2+9myNOPcrlsm+gR0Ex1kN1owfDRfBIasa6SMp2+4Ii4mxm/aiSaLnvaB1lM6zknNZMpW0lucdQVqKH+HatUaHRc0EB1KgzSRU7jKxA/XWqHQ8lRk2Hnk5bVOWCu755DLbKquuZUV1KmxvF5TolDahhwh/DuCFa/UJ9G2eHdt/1/7Pb2w1Dx+9oyW4D6kjbxuYLuUjeeRBnRg/XUNQ6HPywC9b4jMgyu7bRnfKgXmM323FYRp3iybuK8BQpv7QbRbX3s4VEjEp/LbPqLBIqiSShy2lRloNI2YfCFyaOunYVSPCavXslzyURdx/l/RiweZe9YDUq03GL8QNs2vMmnS5ieVIqW6X2PNGZqitV5nXNnTPfU+mJk51vzv32C1vQQFZTJ9qBg57GAfp3WfRI3MVfx62ix8Zc1TTjevSB1ISQKRuqv5zFrMsx+5Ymj7mZxokkGqYA1/OS9SxWISZ8+nd9veYB4ykKA3qZEvmF3vaC559pY00IpjlSoI38cQADsSd1EivMhM9JuIxFpOmnLtZJyk1AvW47hxXgXupf099Vfea3ycBElk7eqQ="
file: .bintray.json
This is the MATLAB interface for liblsl.
* You need to add this directory to your MATLAB path recursively
* Using the MATLAB GUI, use File/Set Path...
* Alternatively, in a script, use `addpath(genpath('path/to/liblsl-Matlab'));`
* The bin/ directory needs to contain an up-to-date build of the library file for your MATLAB version.
* e.g. liblsl64.dll for 64-bit MATLAB on Windows.
* e.g. `liblsl64.dylib` and `liblsl64.1.4.0.dylib` for 64-bit MATLAB on MacOS.
* e.g. `liblsl64.so` and `liblsl64.so.1.4.0` for 64-bit MATLAB in Linux
* Once this taken care of, see the example files in the examples/ directory for how to use this interface in a MATLAB program.
### Troubleshooting
If you get an error similar to `lsl_loadlib_ undefined`, then you may need to run the `build_mex.m` script from within the liblsl-Matlab directory. In Linux, you may need to run `build_linux.sh` instead.
On MacOS, you may still get an error similar to `Invalid MEX-file [...] lsl_loadlib_.mexmaci64; Reason: image not found.`. To fix this run the following command in a Terminal window from within the liblsl-Matlab directory: `install_name_tool -add_rpath "@loader_path/" bin/lsl_loadlib_.mexmaci64`
This is the MATLAB interface for liblsl.
* You need to add this directory to your MATLAB path recursively
* Using the MATLAB GUI, use File/Set Path...
* Alternatively, in a script, use `addpath(genpath('path/to/liblsl-Matlab'));`
* The `bin/` directory needs to contain an up-to-date build of the library file for your MATLAB version.
* see [here](https://github.com/sccn/labstreaminglayer/blob/master/doc/BUILD.md#note-about-architectures--binaries) for more information which library you need
* download precompiled libraries from the [liblsl release page](https://github.com/sccn/liblsl/releases)
* e.g. `liblsl64.dll` for 64-bit MATLAB on Windows.
* e.g. `liblsl64.dylib` and `liblsl64.1.4.0.dylib` for 64-bit MATLAB on MacOS.
* e.g. `liblsl64.so` and `liblsl64.so.1.4.0` for 64-bit MATLAB in Linux
* Once this taken care of, see the example files in the examples/ directory for how to use this interface in a MATLAB program.
### Troubleshooting
If you get an error similar to `lsl_loadlib_ undefined`, then you may need to run the `build_mex.m` script from within the liblsl-Matlab directory.
(From the command line: `matlab -nodesktop -nosplash -r 'build_mex'`)
On MacOS, you may still get an error similar to `Invalid MEX-file [...] lsl_loadlib_.mexmaci64; Reason: image not found.`. To fix this run the following command in a Terminal window from within the liblsl-Matlab directory: `install_name_tool -add_rpath "@loader_path/" bin/lsl_loadlib_.mexmaci64`
version: 1.12.0.{build}
pull_requests:
do_not_increment_build_number: true
shallow_clone: true
environment:
LSLVERSION: 1.12
OCTAVE_VER: 4.4.0-w64
VCVER: 14.0
install:
- cmd: >-
appveyor DownloadFile https://ftp.gnu.org/gnu/octave/windows/octave-%OCTAVE_VER%.7z -FileName octave.7z
7z x octave.7z -o"c:\dev" -y
build_script:
- cmd: >-
call "C:\Program Files (x86)\Microsoft Visual Studio %VCVER%\VC\vcvarsall.bat" x64
appveyor DownloadFile https://bintray.com/labstreaminglayer/LSL/download_file?file_path=liblsl_x64_%LSLVERSION%.zip -FileName liblsl.zip
7z x liblsl.zip
cp LSL/lib/liblsl64.dll bin/
c:\dev\octave-%OCTAVE_VER%\bin\octave-gui.exe --eval build_mex
del bin\*.o
artifacts:
- path: .
name: ${APPVEYOR_PROJECT_NAME}_x64_${APPVEYOR_BUILD_VERSION}
deploy:
- provider: BinTray
username: tstenner
api_key:
secure: Fo9tIQnGjVnCXB3euItvYrt85A5O9FPqq7LEpsdOuwW+eOg1rwA5Q1HLp4yWDXAl
subject: labstreaminglayer
version: 1.12
repo: LSL
package: liblsl-matlab
override: true
% Build mex bindings
% For Octave on Linux, you need the package liboctave-dev installed
% You also need the liblsl64 binary in the bin folder and a configured
% C compiler (mex -setup)
libs = '-llsl64';
if ispc
dllext = 'dll';
elseif ismac
dllext = 'dylib';
elseif isunix
dllext = 'so';
libs = ['-llsl64 -ldl'];
end
if isempty(dir(['bin/liblsl64.', dllext]))
error(['liblsl64.' dllext ' not found in bin/']);
end
ext = ['.' mexext];
files = dir('mex/*.c');
cd('bin');
for i = 1:length(files)
f = files(i);
[~, base, ~] = fileparts(f.name);
targetstats = dir([base, ext]);
if isempty(targetstats) || f.datenum > targetstats.datenum
mex('-I../../liblsl/include','-L.', libs, ['../mex/', f.name]);
else
disp([base, ext, ' up to date']);
end
end
cd('..');
% Build mex bindings
% For Octave on Linux, you need the package liboctave-dev installed
% You also need the liblsl64 binary in the bin folder and a configured
% C compiler (mex -setup)
libs = {'-llsl64'};
if ispc
dllext = 'dll';
elseif ismac
dllext = 'dylib';
elseif isunix
dllext = 'so';
libs = {'-llsl64','-ldl'};
end
if isempty(dir(['bin/liblsl64.', dllext]))
error(['liblsl64.' dllext ' not found in bin/']);
end
ext = ['.' mexext];
files = dir('mex/*.c');
cd('bin');
for i = 1:length(files)
f = files(i);
[~, base, ~] = fileparts(f.name);
targetstats = dir([base, ext]);
if isempty(targetstats) || f.datenum > targetstats.datenum
mex('-I../../liblsl/include','-L.', libs{:}, ['../mex/', f.name]);
else
disp([base, ext, ' up to date']);
end
end
if ismac
system('install_name_tool -add_rpath "@loader_path/" lsl_loadlib_.mexmaci64')
end
cd('..');
%% instantiate the library
lib = lsl_loadlib();
% create a new StreamInfo and declare some meta-data (in accordance with XDF format)
info = lsl_streaminfo(lib,'MetaTester','EEG',8,100,'cf_float32','myuid56872');
chns = info.desc().append_child('channels');
for label = {'C3','C4','Cz','FPz','POz','CPz','O1','O2'}
ch = chns.append_child('channel');
ch.append_child_value('label',label{1});
ch.append_child_value('unit','microvolts');
ch.append_child_value('type','EEG');
end
info.desc().append_child_value('manufacturer','SCCN');
cap = info.desc().append_child('cap');
cap.append_child_value('name','EasyCap');
cap.append_child_value('size','54');
cap.append_child_value('labelscheme','10-20');
% create outlet for the stream
outlet = lsl_outlet(info);
% === the following could run on another computer ===
% resolve the stream and open an inlet
lib = lsl_loadlib();
result = {};
while isempty(result)
result = lsl_resolve_byprop(lib,'type','EEG'); end
inlet = lsl_inlet(result{1});
% get the full stream info (including custom meta-data) and dissect it
inf = inlet.info();
fprintf('The stream''s XML meta-data is: \n');
fprintf([inf.as_xml() '\n']);
fprintf(['The manufacturer is: ' inf.desc().child_value('manufacturer') '\n']);
fprintf(['The cap circumference is: ' inf.desc().child('cap').child_value('size') '\n']);
fprintf('The channel labels are as follows:\n');
ch = inf.desc().child('channels').child('channel');
for k = 1:inf.channel_count()
fprintf([' ' ch.child_value('label') '\n']);
ch = ch.next_sibling();
end
%% instantiate the library
lib = lsl_loadlib();
% create a new StreamInfo and declare some meta-data (in accordance with XDF format)
info = lsl_streaminfo(lib,'MetaTester','EEG',8,100,'cf_float32','myuid56872');
chns = info.desc().append_child('channels');
for label = {'C3','C4','Cz','FPz','POz','CPz','O1','O2'}
ch = chns.append_child('channel');
ch.append_child_value('label',label{1});
ch.append_child_value('unit','microvolts');
ch.append_child_value('type','EEG');
end