|
18 | 18 | % UMFPACK, Copyright (c) 2005-2022, Timothy A. Davis, All Rights Reserved.
|
19 | 19 | % SPDX-License-Identifier: GPL-2.0+
|
20 | 20 |
|
| 21 | +have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ; |
| 22 | + |
21 | 23 | metis_path = '../../CHOLMOD/SuiteSparse_metis' ;
|
22 | 24 | with_cholmod = exist (metis_path, 'dir') ;
|
23 | 25 |
|
24 | 26 | details = 0 ; % set to 1 to print out each mex command as it's executed
|
25 | 27 |
|
26 | 28 | flags = '' ;
|
27 | 29 | is64 = ~isempty (strfind (computer, '64')) ;
|
28 |
| -if (is64) |
| 30 | +if (is64 && ~have_octave) |
29 | 31 | flags = ' -largeArrayDims' ;
|
30 | 32 | end
|
31 | 33 |
|
32 |
| -% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much |
33 |
| -if (~verLessThan ('matlab', '8.3.0')) |
| 34 | +if (have_octave) |
| 35 | + flags = ['--silent', flags] ; |
| 36 | +elseif (~verLessThan ('matlab', '8.3.0')) |
| 37 | + % MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much |
34 | 38 | flags = ['-silent ' flags] ;
|
35 | 39 | end
|
36 | 40 |
|
|
41 | 45 |
|
42 | 46 | v = version ;
|
43 | 47 |
|
44 |
| -fprintf ('Compiling UMFPACK for MATLAB Version %s\n', v) ; |
| 48 | +if (have_octave) |
| 49 | + fprintf ('Compiling UMFPACK for Octave Version %s\n', v) ; |
| 50 | +else |
| 51 | + fprintf ('Compiling UMFPACK for MATLAB Version %s\n', v) ; |
| 52 | +end |
45 | 53 |
|
46 | 54 | if (ispc)
|
47 | 55 | obj = 'obj' ;
|
|
57 | 65 |
|
58 | 66 | % This is exceedingly ugly. The MATLAB mex command needs to be told where to
|
59 | 67 | % find the LAPACK and BLAS libraries, which is a real portability nightmare.
|
60 |
| - |
61 | 68 | if (ispc)
|
62 | 69 | % BLAS/LAPACK functions have no underscore on Windows
|
63 | 70 | flags = [flags ' -DBLAS_NO_UNDERSCORE'] ;
|
64 |
| - if (verLessThan ('matlab', '7.5')) |
65 |
| - lapack = 'libmwlapack.lib' ; |
66 |
| - elseif (verLessThan ('matlab', '9.5')) |
67 |
| - lapack = 'libmwlapack.lib libmwblas.lib' ; |
| 71 | + |
| 72 | + if (have_octave) |
| 73 | + lapack = '-llapack -lblas' ; |
68 | 74 | else
|
69 |
| - lapack = '-lmwlapack -lmwblas' ; |
| 75 | + if (verLessThan ('matlab', '7.5')) |
| 76 | + lapack = 'libmwlapack.lib' ; |
| 77 | + elseif (verLessThan ('matlab', '9.5')) |
| 78 | + lapack = 'libmwlapack.lib libmwblas.lib' ; |
| 79 | + else |
| 80 | + lapack = '-lmwlapack -lmwblas' ; |
| 81 | + end |
70 | 82 | end
|
| 83 | + |
71 | 84 | else
|
72 | 85 | % BLAS/LAPACK functions have an underscore suffix
|
73 | 86 | flags = [flags ' -DBLAS_UNDERSCORE'] ;
|
74 |
| - if (verLessThan ('matlab', '7.5')) |
75 |
| - lapack = '-lmwlapack' ; |
| 87 | + |
| 88 | + if (have_octave) |
| 89 | + lapack = '-llapack -lblas' ; |
76 | 90 | else
|
77 |
| - lapack = '-lmwlapack -lmwblas' ; |
| 91 | + if (verLessThan ('matlab', '7.5')) |
| 92 | + lapack = '-lmwlapack' ; |
| 93 | + else |
| 94 | + lapack = '-lmwlapack -lmwblas' ; |
| 95 | + end |
78 | 96 | end
|
79 | 97 | end
|
80 | 98 |
|
81 |
| -if (is64 && ~verLessThan ('matlab', '7.8')) |
82 |
| - % versions 7.8 and later on 64-bit platforms use a 64-bit BLAS |
83 |
| - fprintf ('with 64-bit BLAS\n') ; |
84 |
| - flags = [flags ' -DBLAS64'] ; |
| 99 | +if (is64) |
| 100 | + |
| 101 | + if (have_octave) |
| 102 | + fprintf ('with 64-bit BLAS\n') ; |
| 103 | + flags = [flags ' -DBLAS64'] ; |
| 104 | + elseif (~verLessThan ('matlab', '7.8')) |
| 105 | + % versions 7.8 and later on 64-bit platforms use a 64-bit BLAS |
| 106 | + fprintf ('with 64-bit BLAS\n') ; |
| 107 | + flags = [flags ' -DBLAS64'] ; |
| 108 | + else |
| 109 | + % other versions of MATLAB use a 32-bit BLAS |
| 110 | + flags = [flags ' -DBLAS32'] ; |
| 111 | + end |
85 | 112 | else
|
86 | 113 | % other versions of MATLAB use a 32-bit BLAS
|
87 | 114 | flags = [flags ' -DBLAS32'] ;
|
88 | 115 | end
|
89 | 116 |
|
| 117 | +if (have_octave) |
| 118 | + flags = [flags ' -DOCTAVE -DNRECIPROCAL'] |
| 119 | +end |
| 120 | + |
90 | 121 | if (~(ispc || ismac))
|
91 | 122 | % for POSIX timing routine
|
92 | 123 | lapack = [lapack ' -lrt'] ;
|
93 | 124 | end
|
94 |
| - |
95 | 125 | %-------------------------------------------------------------------------------
|
96 | 126 | % Source and include directories
|
97 | 127 | %-------------------------------------------------------------------------------
|
|
0 commit comments