MexCmake

版本 1.0 (238.6 KB) 作者: cui,xingxing
使用Cmake打包matlab-mex库文件
96.0 次下载
更新时间 2021/10/14

View MexCmake on File Exchange

基于CMake交叉编译C++得到适用与Matlab的Mex加速库文件

提供基于CMake的方式编译C++代码,代替mex函数打包,配置简单,通用,可修改,不依赖于特定的编译器,平台,工具IDE等,本示例展示了使用一个readBinFile.cpp文件如何通过交叉编译为对应平台的mex文件(即不同平台对应的库文件)。

编译后缀文件

  • windows: *.mexw64
  • Unix: *.mexa64
  • Mac: *.mexmaci64

requirements

  • desktop Matlab 2018a or later
  • or the only contents of the folder MATLAB_ROOT/extern
    Only one of the above two is required, where the MATLAB_ROOT path is the result of executing matlabroot from the matlab command window.

how to compile

mkdir build
cd build
cmake -G"MinGW Makefiles" ..
make 
make install

即可得到对应平台的mex文件

how to use mex file in matlab

Copy the mex file to the current working directory of matlab and execute the following statement to parse the image.

outImg = myGccMex("dataImgUnrealori.bin");
imshow(outImg)

引用格式

cui,xingxing (2024). MexCmake (https://github.com/cuixingxing150/MexCmake/releases/tag/v1.0), GitHub. 检索来源 .

MATLAB 版本兼容性
创建方式 R2021a
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库