add mex compilation code