Compiling standalone from pure source code using deploytool

조회 수: 1 (최근 30일)
Matt J
Matt J 2014년 7월 21일
댓글: Robert Cumming 2014년 7월 23일
I have MATLAB Compiler .prj project consisting of various .m, .c, and .cpp files. The .c and .cpp are each individual mex routine source code files. I'm trying to find a way to run a build within the deploytool GUI so that it will first convert all the .c and .cpp files to mex files, as if I had applied the mex() command to each of these files individually, and then build the total project incorporating the mex files along with the .m files.
Currently, I find that the only way to build the project is to replace each of the .c and .cpp files in the project with its mexed version (which I have to obtain by manually running mex on each one) before running the build. If I attempt to run a build naively on pure source code, compile errors result.
Is there any way to automate the build process so that the final standalone .exe can start with pure source code? It is painful to have to mex C/C++ files individually if I have many such files. Painful both to me and to future generations after me who might need to recompile this code.

채택된 답변

Robert Cumming
Robert Cumming 2014년 7월 22일
The way I do it is to create a project (in deploytool GUI) which will contain all the files you need (i.e. include the mex files) and save this project.
Then create a build function which has the following type of format:
function buildMyProject
mex command
mex command
etc...
% then call the deploytool from the commanline
deploytool -package youProject.prj
You may use -build instead of -package depending on version and your exe etc....
  댓글 수: 2
Matt J
Matt J 2014년 7월 22일
편집: Matt J 2014년 7월 22일
Thanks, Robert. That looks like exactly what I need.
I'm still curious, however, why building the project without pre-mexing the .c and .cpp files leads to compilation errors? Do you happen to know what compilation steps deploytool applies when given just the collection of .c and .cpp files that is different from pre-mexing?
Robert Cumming
Robert Cumming 2014년 7월 23일
I dont know for sure - but I suspect its to do with the deploytool not assuming the mex command for each .c and .cpp - as your mex compilation could be more complex.
I've always done it the way I described above (i.e. make the mex first).

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by