how to generate a mex file for .cpp or .cu file?

how to generate a mex file for .cpp or .cu file?