Skip to content

Commit 6823d98

Browse files
reos-rcrozierandrew-platt
authored andcommitted
create_FAST_SFunc.m: need linux-specific mex call COMPFLAGS windows only -MT option differrent in gcc
1 parent e8ec53f commit 6823d98

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

glue-codes/simulink/src/create_FAST_SFunc.m

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
%
1313
% Run `mex -setup` in Matlab to configure a C compiler if you have not already done so.
1414

15-
1615
mexname = 'FAST_SFunc'; % base name of the resulting mex file
1716

1817
built_with_visualStudio = true; %if the libraries were built with cmake, set to false
@@ -60,14 +59,31 @@
6059
fprintf( '\n----------------------------\n' );
6160
fprintf( 'Creating %s\n\n', [outDir filesep mexname '.' mexext] );
6261

63-
mex('-largeArrayDims', ...
64-
... % '-v', ... %add this line for "verbose" output (for debugging)
65-
['-L' libDir], ...
66-
['-l' libName], ...
67-
['-I' includeDir], ...
68-
'-I../../../modules/supercontroller/src', ... % needed for visual studio builds to find "SuperController_Types.h"
69-
'-I../../../modules/openfoam/src', ... % needed for visual studio builds to find "OpenFOAM_Types.h"
70-
'-outdir', outDir, ...
71-
['COMPFLAGS=$COMPFLAGS -MT -DS_FUNCTION_NAME=' mexname], ...
72-
'-output', mexname, ...
73-
'FAST_SFunc.c');
62+
if ispc () % Windows PC
63+
64+
mex('-largeArrayDims', ...
65+
... % '-v', ... %add this line for "verbose" output (for debugging)
66+
['-L' libDir], ...
67+
['-l' libName], ...
68+
['-I' includeDir], ...
69+
'-I../../../modules/supercontroller/src', ... % needed for visual studio builds to find "SuperController_Types.h"
70+
'-I../../../modules/openfoam/src', ... % needed for visual studio builds to find "OpenFOAM_Types.h"
71+
'-outdir', outDir, ...
72+
['COMPFLAGS=$COMPFLAGS -MT -DS_FUNCTION_NAME=' mexname], ...
73+
'-output', mexname, ...
74+
'FAST_SFunc.c');
75+
76+
else % mac/unix
77+
78+
mex('-largeArrayDims', ...
79+
'-v', ... %add this line for "verbose" output (for debugging)
80+
['-L', libDir], ...
81+
['-l', libName], ...
82+
['-I', includeDir], ...
83+
'-outdir', outDir, ...
84+
['CFLAGS=$CFLAGS -DS_FUNCTION_NAME=' mexname], ...
85+
... ['CXXFLAGS=$CXXFLAGS -DS_FUNCTION_NAME=' mexname], ...
86+
'-output', mexname, ...
87+
'FAST_SFunc.c');
88+
89+
end

0 commit comments

Comments
 (0)