xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.87k stars 776 forks source link

Allow custom intermediate directory layout in dependir/objectir/targetdir #5278

Closed xq114 closed 2 months ago

xq114 commented 3 months ago

你在什么场景下需要该功能?

目前xmake生成的中间目录结构统一为plat/arch/mode形式,例如.deps//windows/x64/release/...。目录结构的用途是区分config不让不同config的文件混在一起,然而实际上固定的目录结构并不能达成这一目标(很多时候plat/arch/mode都是定死的,产生区别的是其他config),需要灵活指定中间目录结构。

描述可能的解决方案

增加一个api设置中间目录结构;最好可以在on_config脚本域指定,这样可以实现一些复杂一点的操作,例如根据所有config计算一个hash作为中间目录

描述你认为的候选方案

No response

其他信息

No response

Issues-translate-bot commented 3 months ago

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


In what scenario do you need this feature?

Currently, the intermediate directory structure generated by xmake is unified in the form of plat/arch/mode, such as .deps//windows/x64/release/.... The purpose of the directory structure is to distinguish configs and prevent files from different configs from mixing together. However, in fact, a fixed directory structure cannot achieve this goal (many times plat/arch/mode are fixed, and the difference is other configs) , need to flexibly specify the intermediate directory structure.

Describe possible solutions

Add an API to set the intermediate directory structure; it is best to specify it in the on_config script field, which can achieve some more complex operations, such as calculating a hash as an intermediate directory based on all configs

Describe your alternatives

No response

other information

No response

waruqi commented 3 months ago

加了个 build.intermediate_directory policy,可以禁用生成中间目录。set_policy("build.intermediate_directory", false)

https://github.com/xmake-io/xmake/pull/5283

然后,你直接 set_targetdir/set_objectdir/set_dependir 设置就行了。。但只能在 on_load 里面改,on_config 不行,太滞后