-
-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support installing .cmake and pkgconfig/.pc files for targets #1268
Comments
可以用 rule ,名字改下: add_rules("utils.install.cmake_importfiles") 也可以导出 pkg-config pc files add_rules("utils.install.pkgconfig_importfiles") |
cmake 的还没弄,我先把 pkgconfig 的加上了。。只需要添加 target("test")
set_kind("static")
add_files("src/*.cpp")
add_rules("utils.install.pkgconfig_importfiles")
test.pc
我们也可以不用内置的规则,自己通过 after_install 定制化一些安装参数 target("test")
set_kind("static")
add_files("src/*.cpp")
after_install(function (target, opt))
import("target.action.install.pkgconfig_importfiles")(target,
{includedirs = {"xxx"}, linkdirs = ..., links ..., filename = "xxxx.pc"})
end |
cmake 的我也加上了,不过没有详测过是否完全生效,你可以试试 @xq114 set_project("test")
target("test")
set_kind("static")
add_files("src/*.cpp")
add_rules("utils.install.cmake_importfiles") 对应的包名规则:
|
|
绝对路径导致的问题
|
我是参考了 现有的一些包的安装,ogg, libjpeg 什么的,我看都是 project::xxxx 两级命名,并且都是放在 lib/cmake/xxx 下
|
同样,我看现有第三方cmake工程安装的,prefixdir 等都是绝对路径,
跟绝对路径没关系,是 win 上 cmake 不支持 |
另外想要发布二进制预编译包必须用相对路径 |
我看到的都是分两级的,用来便于管理维护 一个project 包含多个 targets 的情况。。 像 tutorial 这种通常都是简单的基础工程,就一个 target,所以可能简化成 一级了。。
路径问题,我刚改进过了 |
现在可以成功编译了 |
理论上是可以搞,但目前需求不强烈,既然走了 xmake 包,并且还是提供给 xmake 项目用,那就直接集成到 xmake-repo 仓库或者自己的仓库,然后走 add_requires集成就好了 搞成类似 lib/cmake 的方式,以后安装一个系统包,并且要兼容其他构建工具,就会变成 ,.pc/cmake/xmake 导入文件各一份,装个库,光 import files 就是一坨(如果还有其他构建工具的话),现在已经被很多人喷分裂构建生态了。。 所以,能走 xmake-repo/add_requires 尽量走这个集成,不想过于污染系统库目录,导致充斥各种 lib/xmake 文件。。 现在 cmake一家独大,当然可以这么搞,xmake也这么弄,只会被别人喷 |
你在什么场景下需要该功能?
使用xmake编写的库,希望其他原来使用cmake的项目也可以不做太多改动的情况下使用
描述可能的解决方案
效果为install时在include、lib等文件夹外并列放一个cmake文件夹,文件夹里面放fooConfig.cmake等并通过相对路径标明此target的include/lib/syslink等信息
描述你认为的候选方案
缺点是不好指定特定的target,install的时候不能保证相对路径的正确
The text was updated successfully, but these errors were encountered: