开发者

Is it possible to generate a .h macros file from bjam?

开发者 https://www.devze.com 2022-12-19 16:55 出处:网络
I need to dynamically generate some macros into a .h configuration file that C programs can i开发者_开发技巧nclude in order to check which options are enabled, in a fashion similar to what is possible

I need to dynamically generate some macros into a .h configuration file that C programs can i开发者_开发技巧nclude 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消