在为 Eigen 这个head-only 库编写 `mcpp.toml` 文件时,遇到了一个问题:不知道如何确定库的入口点。mcpp如何编译head-only库
Activity
Sunrisepeak commentedon Jun 28, 2026
header only 库比较简单编写, 只要指定 include 目录就可以了。
你可以给 mcpp-index 添加 eigen的支持 compat.eigen.lua
具体可以参考, 指定头文件目录即可
详细PR参考
tz12323 commentedon Jun 28, 2026
已完成对Eigen+blas的支持,详见个人仓库
https://github.com/tz12323/eigen.git。暂时不确定是否链接上了Eigen自带的blas,单Eigen调用成功。lapack暂时没有写对应的mcpp.toml在我自己调用这个包时,发现指定了features为blas后并没有在compile_command.json中找到EIGEN_USE_BLAS这个定义
Sunrisepeak commentedon Jun 28, 2026
@tz12323 eigen的库支持已经添加到了mcpp-index索引中
如果是自己定制的库, 可以像上面自己定义mcpp.toml实现, 默认官方的目前可以直接通过包名使用
默认使用
开启blas支持
[-]对head-only库的支持[/-][+]对head-only库的支持 - 例如Eigen[/+]tz12323 commentedon Jun 28, 2026
@Sunrisepeak 在调用安装compat.eigen并且启用blas这个features后,只在compile_command.json中找到了-DMCPP_FEATURE_BLAS这个宏定义,并没有找到-DEIGEN_USE_BLAS这个宏定义.说明了blas特性并没有被启用.
[-]对head-only库的支持 - 例如Eigen[/-][+]features无法添加cxxflags、defines,导致eigen编译无法使用-DEIGEN_USE_BLAS宏[/+]Sunrisepeak commentedon Jun 29, 2026
你想要把 eigen 作为 blas 的实现 还是要给 eigen提供 blas的实现
Sunrisepeak commentedon Jun 29, 2026
最新mcpp版本已经支持 更强大的 feature机制, 可以
xlings update mcpp -y更新到最新版本体验