Skip to content
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

安装 target a 时,依赖的 target b 的头文件未被安装 #5822

Closed
ivanallen opened this issue Nov 14, 2024 · 4 comments
Closed

安装 target a 时,依赖的 target b 的头文件未被安装 #5822

ivanallen opened this issue Nov 14, 2024 · 4 comments
Labels

Comments

@ivanallen
Copy link

Xmake 版本

xmake v2.9.6 dev.3b4a8be

操作系统版本和架构

Linux a7b5f95675d7 5.14.0-70.13.1.el9_0.x86_64 #1 SMP PREEMPT Wed May 25 21:01:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

描述问题

target a 依赖了 target b,a 和 b 都有 add_headerfiles。当指定安装 target a 时,target b 导出的头文件没有被安装。

在 xmake 2.9.3 时,b 的头文件会一起被安装。升级到 xmake 2.9.6 时好像 break 掉了。

期待的结果

target 的依赖会一起被安装。

工程配置

add_rules("mode.debug", "mode.release")

add_includedirs("src")

target("sub")
   set_kind("static")
   add_files("src/sub.cpp")
   add_headerfiles("src/sub.h")

target("add")
   set_kind("static")
   add_files("src/add.cpp")
   add_headerfiles("src/add.h")
   add_deps("sub")

target("test")
    set_kind("binary")
    add_files("src/main.cpp")
    add_deps("add")

附加信息和错误日志

[root@a7b5f95675d7 test]# xmake install -v -o output add
installing add ..
installing add to output ..
> copy build/linux/x86_64/release/libadd.a to output/lib
> copy src/add.h to output/include/add.h
install ok!
[root@a7b5f95675d7 test]#
@ivanallen ivanallen added the bug label Nov 14, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: When installing target a, the header file of dependent target b is not installed.

@waruqi
Copy link
Member

waruqi commented Nov 14, 2024

不是 bug,之前安装的逻辑有点混乱,2.9.6 上捋顺改进了下。。

目前新策略,xmake install xxx 只会安装指定的 xxx target 和它实际需要的依赖动态库。

如果 target a 是 binary ,它的所有依赖的 target headerfiles 不会安装, 没必要。安装 binary a ,它本身不会用到头文件。
如果 target a 是 static/shared,它会安装所有依赖的 target public headerfiles ,但你需要标记 add_headerfiles(..., {public = true}) 标记对 target a 导出 headerfiles 安装,否则私有的 headerfiles 也不会安装

@ivanallen
Copy link
Author

它会安装所有

感谢。我修改为 add_headerfiles("src/sub.h", {public = true}) 后没问题了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It will install all

grateful. There was no problem after I modified it to add_headerfiles("src/sub.h", {public = true})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants