是否可以从 bjam 生成 .h 宏文件?

发布于 2024-08-19 21:26:09 字数 143 浏览 4 评论 0 原文

我需要将一些宏动态生成到 C 程序可以包含的 .h 配置文件中,以便检查启用了哪些选项,其方式类似于 CMake 的 CONFIGURE_FILE 宏。但在查看文档和网络后,我找不到有用的东西。是否可以从 bjam 生成这样的文件并正确处理依赖项?如果是这样,你会怎么做?

I need to dynamically generate some macros into a .h configuration file that C programs can include in order to check which options are enabled, in a fashion similar to what is possible with CMake's CONFIGURE_FILE macro. But after looking in the doc and the web, I could not find something useful. Is it possible to generate such a file from bjam and have the dependencies handled correctly? If so, how would you do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方圜几里 2024-08-26 21:26:09

是的,这是可能的。实现方法归结为为标头定义 make 目标并使用 bjam 中的 @() 文件输出操作支持。您将在标头目标上设置一组配置变量,操作将使用它们来生成文件。这就是我在我编写的库扩展之一中所做的事情(请参阅 GIF 库扩展)。我还编写了一些用于自动执行某些任务的基本支持,但最终功能仍然相同,即在 ext.jam 实用程序中创建文本文件。允许更轻松地定义根据 Boost Build 功能而更改的标头配置文件(请参阅 Irrlicht 3D 库扩展)。基本上,您可以使用 make 目标做任何您能想到的事情,因为它的实现完全取决于您。

Yes it's possible.. The way to do it boils down to defining a make target for the header and using the @() file output action support in bjam. You would set up a set of configuration variables on the header target and the action would use them to generated the file. That is what I do in one of the library extensions I wrote (see GIF lib extension). I also wrote some basic support for automating some of the tasks, but it still ends up being functionally the same, to create text files in the ext.jam utility. To allow easier definition of header configuration files that change based on Boost Build features (see Irrlicht 3D lib extension). Basically you can do just about anything you can think of with the make target since it's implementation is entirely up to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文