File: setup.m

package info (click to toggle)
openems 0.0.35+dfsg.1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,288 kB
  • sloc: cpp: 40,259; yacc: 580; lex: 350; makefile: 258; sh: 169; ruby: 19
file content (40 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download
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
function setup()
% function setup()
%
% setup openEMS Matlab/octave interface
%
% openEMS matlab/octave interface
% -----------------------
% author: Thorsten Liebig (2011-2017)

disp('setting up openEMS matlab/octave interface')

% cd to directory of this file and restore current path at the end
current_path = pwd;
dir  = fileparts( mfilename('fullpath') );
cd(dir);

if isOctave()
    disp('compiling oct files')
    fflush(stdout);
    if isunix
        [res, fn_so] = unix('find /usr/lib     -name libhdf5.so');
        [res, fn_h]  = unix('find /usr/include -name hdf5.h');
        if length(fn_so)>0 && length(fn_h)>0
            [hdf5lib_dir, hdf5lib_fn] = fileparts(fn_so);
            disp(["HDF5 library path found at: " hdf5lib_dir])

            [hdf5inc_dir, hdf5inc_fn] = fileparts(fn_h);
            disp(["HDF5 include path found at: " hdf5inc_dir])
            mkoctfile(["-L" hdf5lib_dir " -I" hdf5inc_dir],"-lhdf5", "h5readatt_octave.cc")
        else
            mkoctfile -lhdf5 h5readatt_octave.cc
        end
    else
        mkoctfile -lhdf5 h5readatt_octave.cc
    end
else
    disp('Matlab does not need this function. It is Octave only.')
end

cd(current_path);