-
-
Notifications
You must be signed in to change notification settings - Fork 818
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
請問如何使用模板來客製化config.h這類檔案? #271
Comments
这块目前的可定制化程度确实还不是很高,等后面有时间可以参考cmake改进下支持。。增加上模板设置支持。
即使采用模板替换,应该也会每次生成一个新文件才对吧。
自动生成的config.h应该仅在编译安装阶段生效,并不会纳入源码结构才对吧。。我自己的库使用都没把它提交到git,目前我也没改变库的源码结构。 |
舉個例子,像是 |
你说的这个 set_config_header 不也可以么,里面有不同平台的设置来区分,只不过目前提供给用户的自定义化程度不高而已,这块我后面改进下。 |
抱歉,應該是我用詞造成的誤會。
|
这块我反而觉得是xmake的优势,虽然是跟随target,但是你把 set_config_header 设置放到root域,那就是全局设置,影响所有target,也就是多target共用,另外它也可以单独只用于某个target。
这块的通用性确实没cmake设计的好,因为会追加一些.h特有的defines,后期确实可以参考cmake做的更加通用些。 |
这块我最近还在设计和构思中,暂时只有一个雏形,但是还有很多细节处理上怎么弄,还没想好,相关设计规划和开发进展见:#320 等之后我设计好整体api后,会开始实现,最近时间不多,进度上会稍慢些,请耐心等待。 |
meson has a API to skip config.h.in to output config.h: conf_data = configuration_data()
conf_data.set(
'BIN2C',
get_option('bin2c'),
description: 'use bin2c',
)
conf_file = configure_file(output: 'config.h', configuration: conf_data) Can xmake do same? |
|
call io.writefile to generate it in on_load/on_config by yourself. |
期望的功能如同 cmake 的 configure_file ,使用一個自定義模板然後僅僅變更其中一小部分。
目前查詢到在 xmake 中的 set_config_header 會建立全新的檔案。
理由是盡可能不變更第三方原代碼結構,以方便更新維護,以及符合授權。
The text was updated successfully, but these errors were encountered: