How do I get the compiler's directory from a subsystem without "CompilerDir" property, while performing the build process?

I have a make hook script that runs to link several parts of a model together. I need my external program to know what is the compiler directory's path. I normally use get_param(gcs,'CompilerDr'), but this model has many subsystems, and sometimes gcs will latch to a subsystem instead of the top level model. Subsystems don't have this property, therefore the make hook fails.
What alternatives are there to get "CompilerDir"?

 Accepted Answer

If you are using the following command:
get_param(gcs, 'CompilerDir');
In a make hook for a model with several subsystems, your make hook will fail.
There is an alternative, which is to get the information about the compiler from the given arguments:
buildArgs = args.buildInfo.BuildArgs;
compilerObj = buildArgs.findobj('Group', 'BUILD_ARG', 'Key', 'COMPILER_DIR');
compilerDir = erase(compilerObj.Value, '"');
This will resolve the issues in the make hook.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Release

R2019a

Community Treasure Hunt

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

Start Hunting!