Using JUCE classes in MATLAB MEX functions - has anyone out there used this setup?


Short question:

I just came across the relatively new C++11 MATLAB MEX API, allowing to write C++11 code that will get compiled by MATLAB as MATLAB-callable functions. This feature isn’t really new, however the new API looks a lot better compared to the old one.

Now for a project where I want to put some computational heavy pieces of DSP-code used in a MATLAB-simulation this new API got me started writing such a MEX function. I’d really like to use some JUCE container and DSP classes inside that function, but as I’m no pro at setting up JUCE-based projects that are not created through the Projucer, I’d like to hear if anyone out here did that before and what steps should be taken to compile the JUCE classes with MATLAB?

And even if no one did this before, any hints on how to set up a project that uses JUCE without the Projucer would be greatly appreciated. As far as I can see, calling mex MyMexFunction.cpp basically involves clang++ with a ton of arguments. Additional arguments might be added to the mex call, so I guess it will look somehow like mex MyMexFunctionWithJUCECode.cpp SomeJuceFile.cpp -I someJuceHeaders -L someCompiledJuceFiles…? Any guess what args should be added? I assume these should be the same args I’d add when compiling a simple JUCE project without any makefile directly from the command line.