Change the default mex compiler with a GUI / script
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hamsterfiedel
am 22 Sep. 2015
Kommentiert: Richard Crozier
am 1 Nov. 2017
Hi, I'm building a gui and I want to be able to select the default mex compiler. I'm running Matlab R2013a. When I execute
mex -setup
I get
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win32.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc-win32 C 2.4.1 in \\[...]\APPS\Matlab\R2013A~1.10\sys\lcc
[2] Microsoft Software Development Kit (SDK) 7.1 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Software Development Kit (SDK) 7.1
Location: c:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n? y
Is it possible to change the compiler without having to access the Command Window? One option would be to first check for installed compilers, display them in a text and then select one.
The only problem I have is to get the available compilers to a set of strings and then change the compiler by a script.
so fare i have tried
my_var = evalc('mex -setup') %no response
my_var = eval('mex -setup') %Error using eval. Undefined function or variable 'setup'.
I really don't know how to continue.
Thank you for your help.
0 Kommentare
Akzeptierte Antwort
Jan
am 22 Sep. 2015
What do you want to achieve? Do you want to write a GUI-wrapper for mex -setup ? What is the benefit to hide the process in a GUI? Using the standard method through the command window is efficient and must not be done repeatedly.
I'm using a setup with different compilers. Therefore I activate a compiler at first using the mex -setup command. And then I rename the file "<prefdir>\mexopt.bat" to e.g. "<prefdir>\mexopt_MSVC2008_64.bat". Then I call the MSVC/64 compiler using:
mex('-f', fullfile(prefdir, 'mexopt_MSVC2008_64.bat'), 'myfunction.c')
By this way, I activate each compiler once only, and call the different compilers dynamically.
I've hidden this in a tiny function, to increase the usability.
3 Kommentare
Jan
am 23 Sep. 2015
Then searching for a specific string in prefdir \ mexopts.bat should be efficient. Modern Matlab versions allow to ask the mex command for the current setup - very useful! But unfortunately not available in older versions.
Richard Crozier
am 1 Nov. 2017
In recent Matlab versions the '-f' option is deprecated, is there another way to achieve this?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!