Filter löschen
Filter löschen

Using Relative Paths with Matlab Coder

9 Ansichten (letzte 30 Tage)
Hamza Yerlikaya
Hamza Yerlikaya am 22 Okt. 2019
Beantwortet: Anakin Zheng am 24 Okt. 2019
I am trying to generate C code for a Matlab function. It uses mongoose web server for communication. If I place the .h/.c files in the same folder as the .m file I can compile everything fine using using matlab to an exe:
coder.cinclude('mongoose.h');
coder.updateBuildInfo('addSourceFiles','mongoose.c');
coder.cinclude('rest.h');
coder.updateBuildInfo('addSourceFiles','rest.c');
I would like to keep my .c files and .m files separate, so moving C files to a folder named native/ causes compilation to fail as expected. Thus, I tell Matlab where to find them using:
customDir = '/full/path/to/native';
coder.updateBuildInfo('addIncludePaths', customDir);
coder.updateBuildInfo('addSourcePaths', customDir);
Which works. However it works only with absolute paths and not with relative paths. This is a problem since each contributor to this projects keeps the source folder in a different location. What is the proper way to tell Matlab native file locations using relative paths to Matlab working directory?

Antworten (1)

Anakin Zheng
Anakin Zheng am 24 Okt. 2019
Hi Hamza,
Post codegen command might be a way to do it here.
Every contributor can have their own post codegen command.

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by