v4 mex:
* renamed build.m to build_matlab.m, and made various enhancements * this script now makes Matlab quit after compilation (necessary for autobuilding) git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1901 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
e08cad8265
commit
d64d9fe734
|
@ -23,14 +23,14 @@ build-stamp:
|
|||
# Building Matlab 7.4 MEX files
|
||||
ifeq ($(shell test -d $(MATLAB74_ROOT) && echo yes), yes)
|
||||
$(MATLAB74_ROOT)/etc/lmboot
|
||||
cd mex/sources && $(MATLAB74_ROOT)/bin/matlab -nodisplay < build.m
|
||||
cd mex/sources && $(MATLAB74_ROOT)/bin/matlab -nodisplay -r build_matlab
|
||||
$(MATLAB74_ROOT)/etc/lmdown
|
||||
endif
|
||||
|
||||
# Building Matlab 7.5 MEX files
|
||||
ifeq ($(shell test -d $(MATLAB75_ROOT) && echo yes), yes)
|
||||
$(MATLAB75_ROOT)/etc/lmboot
|
||||
cd mex/sources && $(MATLAB75_ROOT)/bin/matlab -nodisplay < build.m
|
||||
cd mex/sources && $(MATLAB75_ROOT)/bin/matlab -nodisplay -r build_matlab
|
||||
$(MATLAB75_ROOT)/etc/lmdown
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
% Build file for Dynare MEX Librairies
|
||||
% Copyright Dynare Team (2007)
|
||||
% Build file for Dynare MEX Librairies under Matlab
|
||||
% Copyright Dynare Team (2007-2008)
|
||||
% GNU Public License
|
||||
|
||||
MATLAB = ver('matlab');
|
||||
|
||||
% Get Matlab version number in numeric format
|
||||
% FIXME:
|
||||
% It's not satisfactory to convert string versions into numbers, and to
|
||||
% compare these numbers:
|
||||
% - conversion will fail if version = 1.2.3
|
||||
% - it will give 7.10 < 7.9
|
||||
MATLAB = ver('matlab');
|
||||
VERSION = str2num(MATLAB.Version);
|
||||
|
||||
MATLAB_PATH = matlabroot;
|
||||
|
@ -18,13 +18,9 @@ COMPILE_OPTIONS = '';
|
|||
if strcmpi('GLNX86', computer) || strcmpi('GLNXA64', computer) ...
|
||||
|| strcmpi('MACI', computer) || strcmpi('MAC', computer)
|
||||
% GNU/Linux (x86-32 or x86-64) or MacOS (Intel or PPC)
|
||||
if strcmpi('GLNXA64', computer) % 64 bits ?
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims'];
|
||||
end
|
||||
LAPACK_PATH = '-lmwlapack';
|
||||
if VERSION <= 7.4
|
||||
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED -DNO_BLAS_H -DNO_LAPACK_H' ];
|
||||
else
|
||||
BLAS_PATH = '-lmwblas';
|
||||
end
|
||||
|
@ -34,7 +30,6 @@ elseif strcmpi('PCWIN', computer)
|
|||
LAPACK_PATH = ['"' LIBRARY_PATH 'libmwlapack.lib"'];
|
||||
if VERSION <= 7.4
|
||||
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED -DNO_BLAS_H -DNO_LAPACK_H' ];
|
||||
else
|
||||
BLAS_PATH = ['"' LIBRARY_PATH 'libmwblas.lib"'];
|
||||
end
|
||||
|
@ -42,6 +37,21 @@ else
|
|||
error('Unsupported platform')
|
||||
end
|
||||
|
||||
% mwSize and mwIndex appeared in Matlab 7.3
|
||||
if VERSION < 7.3
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ];
|
||||
end
|
||||
|
||||
% Large array dims for 64 bits platforms appeared in Matlab 7.3
|
||||
if strcmpi('GLNXA64', computer) && VERSION >= 7.3
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims' ];
|
||||
end
|
||||
|
||||
% blas.h and lapack.h appeared in Matlab 7.5
|
||||
if VERSION < 7.5
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DNO_BLAS_H -DNO_LAPACK_H' ];
|
||||
end
|
||||
|
||||
if VERSION <= 7.4
|
||||
OUTPUT_DIR = '../2007a';
|
||||
else
|
||||
|
@ -51,7 +61,7 @@ end
|
|||
% Comment next line to suppress compilation debugging info
|
||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -v' ];
|
||||
|
||||
COMPILE_COMMAND = [ 'mex ' COMPILE_OPTIONS ' -outdir ' OUTPUT_DIR ' ' ];
|
||||
COMPILE_COMMAND = [ 'mex ' COMPILE_OPTIONS ' -outdir ' OUTPUT_DIR ];
|
||||
|
||||
disp('Compiling mjdgges...')
|
||||
eval([ COMPILE_COMMAND ' mjdgges/mjdgges.c ' LAPACK_PATH ]);
|
||||
|
@ -61,6 +71,11 @@ disp('Compiling A_times_B_kronecker_C...')
|
|||
eval([ COMPILE_COMMAND ' kronecker/A_times_B_kronecker_C.cc ' BLAS_PATH ]);
|
||||
disp('Compiling gensylv...')
|
||||
eval([ COMPILE_COMMAND ' -DMATLAB -Igensylv/cc gensylv/matlab/gensylv.cpp' ...
|
||||
' gensylv/cc/*.cpp ' BLAS_PATH ' ' LAPACK_PATH ]);
|
||||
' gensylv/cc/*.cpp ' BLAS_PATH ' ' LAPACK_PATH ]);
|
||||
disp('Compiling simulate...')
|
||||
eval([ COMPILE_COMMAND ' -DMATLAB -Isimulate -I../../preprocessor/include simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc simulate/linbcg.cc']);
|
||||
eval([ COMPILE_COMMAND ' -DMATLAB -Isimulate -I../../preprocessor/include simulate/simulate.cc simulate/Interpreter.cc simulate/Mem_Mngr.cc simulate/SparseMatrix.cc simulate/linbcg.cc' ]);
|
||||
|
||||
% Forcing exit is necessary when autobuilding MEX files for Debian packages.
|
||||
% In interactive mode, if anything fails during the compilation process,
|
||||
% this line will not be reached and the user will see the error message.
|
||||
exit
|
Loading…
Reference in New Issue