Compiling mex (MATLAB Executable) files in CLion

已回答

Hello. I would like to know if there is any way to compile and debug the results of mex (MATLAB Executable) files in CLion.

The API is considerably different from normal C/C++ code (no main function etc.) and I am not aware of anyone who has managed to configure CLion to compile and run mex files.

There are a few guides on doing this with Visual Studio but most seem to be out of date and not applicable to CLion.

I would like to use the new Data API (for C++ mex files) for my project and there doesn't seem to be much documentation due to its being somewhat new.

I would be most grateful to anyone who can explain how to set up the configuration for CLion to work with mex files in the new MATLAB C++ API. (See https://www.mathworks.com/help/matlab/matlab-data-array.html)

Many thanks in advance to anyone who can help out.

0

Hello!

You need to use the find_package() CMake command in your CMakeLists.txt so that CMake is able to find Matlab: find_package(Matlab).

After that you can add a target compiling a MEX file using the matlab_add_mex() CMake command: https://cmake.org/cmake/help/v3.14/module/FindMatlab.html#command:matlab_add_mex.

0

请先登录再写评论。