Edit mex configuration programmatically

조회 수: 6 (최근 30일)
Jim Hokanson
Jim Hokanson 2014년 6월 18일
답변: Jim Hokanson 2014년 6월 18일
Hi all,
I'd like to be able to edit the mex configuration programatically. There are some recent changes to the configuration options, having moved from mexopts.bat (windows) to xml files. For now let's assume I'm using the newer approach. You can query information regarding the compiler configuration using:
mex.getCompilerConfigurations
There doesn't seem to be a way to use this information to change anything.
My use case is the following. I'd like to use the flag /MDt instead of /MD for Visual Studio 2012. If I do:
COMPFLAGS="$COMPFLAGS /MDt"
The /MD flag that is present overrides the /MDt directive I passed in. Thus it seems that I need to actually remove the /MD flag in the options file.
Any suggestions?
Thanks, Jim
  댓글 수: 1
James Tursa
James Tursa 2014년 6월 18일
편집: James Tursa 2014년 6월 18일
In the past, I have actually opened up the old mexopts.bat file and copied it to a new file with modifications, then used that new file. I don't know how to do something similar under the new scheme where there is apparently no mexopts.bat file to work with.

댓글을 달려면 로그인하십시오.

답변 (2개)

James Tursa
James Tursa 2014년 6월 18일
Can you go into the mexopts directory, copy all of the setup files for the compiler you are using into new files with slightly different names, then edit those new files to get the /MDt option you want? Maybe that will let the mex command see that to use. Under the new scheme, I don't know how to coax the mex command to use that option set though. Maybe make it alphabetically first in the file listing? I don't have a recent version of MATLAB to experiment with for this unfortunately. Maybe you will have to simply edit the existing mexopts files instead of creating copies.

Jim Hokanson
Jim Hokanson 2014년 6월 18일
So the current solution I have in mind is roughly the following:
  1. back up the default file
  2. replace the default with my file
  3. execute the code
  4. restore the default file
I was hoping there was a better more obvious way of doing this, but perhaps not :/

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by