From 1c95f6eac6051f784b26040b707580464e5cc95a Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Sat, 30 Dec 2023 13:18:40 -0600 Subject: [PATCH] MATLAB in Windows: set NO_SSIZE_T for METIS --- KLU/MATLAB/klu_make.m | 5 +++++ ParU/MATLAB/paru_make.m | 5 +++++ SPQR/MATLAB/spqr_make.m | 18 ++++-------------- UMFPACK/MATLAB/umfpack_make.m | 20 ++++++++------------ 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/KLU/MATLAB/klu_make.m b/KLU/MATLAB/klu_make.m index 26bfc1e836..29fedd61f4 100644 --- a/KLU/MATLAB/klu_make.m +++ b/KLU/MATLAB/klu_make.m @@ -31,6 +31,11 @@ d = ['-silent ' d] ; end +if (ispc) + % MSVC does not define ssize_t + d = [d ' -DNO_SSIZE_T'] ; +end + fprintf ('Compiling KLU ') ; kk = 0 ; diff --git a/ParU/MATLAB/paru_make.m b/ParU/MATLAB/paru_make.m index 6a5350f25d..72f9aec9ea 100644 --- a/ParU/MATLAB/paru_make.m +++ b/ParU/MATLAB/paru_make.m @@ -60,6 +60,11 @@ % use all of CHOLMOD except for the Modify module flags = [flags ' -DNMODIFY -DBLAS64' ] ; +if (ispc) + % MSVC does not define ssize_t + flags = [flags ' -DNO_SSIZE_T'] ; +end + suitesparse_src = { ... '../../SuiteSparse_config/SuiteSparse_config', ... '../../AMD/Source/amd_l1', ... diff --git a/SPQR/MATLAB/spqr_make.m b/SPQR/MATLAB/spqr_make.m index 3c2f3dc5ad..715b82ae91 100644 --- a/SPQR/MATLAB/spqr_make.m +++ b/SPQR/MATLAB/spqr_make.m @@ -25,16 +25,6 @@ v = version ; fprintf ('Compiling SuiteSparseQR on MATLAB Version %s\n', v); -try - % ispc does not appear in MATLAB 5.3 - pc = ispc ; - mac = ismac ; -catch %#ok - % if ispc fails, assume we are on a Windows PC if it's not unix - pc = ~isunix ; - mac = 0 ; -end - flags = '' ; is64 = (~isempty (strfind (computer, '64'))) ; if (is64) @@ -49,7 +39,7 @@ flags = ['-silent ' flags] ; end -if (pc) +if (ispc) % MSVC does not define ssize_t flags = [flags ' -DNO_SSIZE_T'] ; end @@ -76,7 +66,7 @@ % find the LAPACK and BLAS libraries, which is a real portability nightmare. % The correct option is highly variable and depends on the MATLAB version. -if (pc) +if (ispc) % BLAS/LAPACK functions have no underscore on Windows flags = [flags ' -DBLAS_NO_UNDERSCORE'] ; if (verLessThan ('matlab', '6.5')) @@ -115,7 +105,7 @@ % GPU not yet supported for the spqr MATLAB mexFunction % flags = [flags ' -DSPQR_HAS_CUDA'] ; -if (~(pc || mac)) +if (~(ispc || ismac)) % for POSIX timing routine lib = [lib ' -lrt'] ; end @@ -440,7 +430,7 @@ % SuiteSparseQR mexFunctions spqr_mex_cpp_src = { 'spqr', 'spqr_qmult', 'spqr_solve', 'spqr_singletons' } ; -if (pc) +if (ispc) obj_extension = '.obj' ; else obj_extension = '.o' ; diff --git a/UMFPACK/MATLAB/umfpack_make.m b/UMFPACK/MATLAB/umfpack_make.m index 4f0ee83ea3..5cdbdc5083 100644 --- a/UMFPACK/MATLAB/umfpack_make.m +++ b/UMFPACK/MATLAB/umfpack_make.m @@ -34,20 +34,16 @@ flags = ['-silent ' flags] ; end -v = version ; -try - % ispc does not appear in MATLAB 5.3 - pc = ispc ; - mac = ismac ; -catch - % if ispc fails, assume we are on a Windows PC if it's not unix - pc = ~isunix ; - mac = 0 ; +if (ispc) + % MSVC does not define ssize_t + flags = [flags ' -DNO_SSIZE_T'] ; end +v = version ; + fprintf ('Compiling UMFPACK for MATLAB Version %s\n', v) ; -if (pc) +if (ispc) obj = 'obj' ; else obj = 'o' ; @@ -62,7 +58,7 @@ % This is exceedingly ugly. The MATLAB mex command needs to be told where to % find the LAPACK and BLAS libraries, which is a real portability nightmare. -if (pc) +if (ispc) % BLAS/LAPACK functions have no underscore on Windows flags = [flags ' -DBLAS_NO_UNDERSCORE'] ; if (verLessThan ('matlab', '7.5')) @@ -91,7 +87,7 @@ flags = [flags ' -DBLAS32'] ; end -if (~(pc || mac)) +if (~(ispc || ismac)) % for POSIX timing routine lapack = [lapack ' -lrt'] ; end