How can I modify the build information for mex code generation with the codegen function?
조회 수: 1 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 6월 20일
편집: MathWorks Support Team
2021년 3월 9일
I would like to define a custom toolchain that I can use to set compiler and linker options, among other settings. However, after performing the command:
>> cfg = coder.config('mex')
I do not see any such option.
I would like to specify compiler and linker flags, or otherwise edit the build configuration using the codegen command. How can I do this without manually editing the makefile for mex code generation?
채택된 답변
MathWorks Support Team
2021년 3월 9일
편집: MathWorks Support Team
2021년 3월 9일
Codegen('mex') does not support custom toolchains, as noted in the documentation at the following link:
Compiler settings are inherited from the "mex -setup" command.
Instead, you can use the Post-Code-generation command to pass a custom Build Information Object to the "codegen" command.
For example, you could add a link flag with the following function:
function setbuildargs(buildInfo)
linkFlags = {'-lpthread'};
buildInfo.addLinkFlags(linkFlags);
cfg = coder.config('mex');
end
That function can then be used to pass the build information object via the PostCodeGenCommand:
>> cfg.PostCodeGenCommand = 'setbuildargs(buildInfo)';
More information and further examples can be found in the documentation at the following link:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Build Configuration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!