How to build a boost dependent project using regular makefiles?

爷,独闯天下 提交于 2019-12-01 00:37:50

问题


I'm working on a c++ project, and we recently needed to include a small part of boost in it. The boost part is really minimal (Boost::Python), thus, using bjam to build everything looks like an overkill (besides, everyone working on the project feels comfortable with make, and has no knowloedge of jam).

I made quite some tests already, but I cant find a way to include the formerly mentioned library in my makefile and make the build succesful.

All your help is deeply apreciated. :)


回答1:


I had the same problem and found a solution in this tutorial. You 1) need to compile the source into an object file with the -fPIC gcc option, and 2) compile this object into a library with the -shared gcc option. Of course you have also to link against the Boost.Python library (generally -lboost_python, however for my debian system it is for example -lboost_python-mt-py25, I have also to add -I/usr/include/pythyon25). In my makefile I end up doing those two steps in one command. See also p. 13 of this presentation.




回答2:


You can use Boost's bcp utility to extract only the subset of Boost you need. That will minimize your build time & size.

That doesn't answer your question, though. You may want to consider building the Boost.Python libraries separately and checking them directly into your source control system. Then nobody would need to build them.




回答3:


If you're uncomfortable with bjam, you might want to consider using Boost.Cmake.
Alternatively you should at least be able to see more easily what they are doing then with the bjam files.




回答4:


Run bjam from the makefile, just for building that part



来源:https://stackoverflow.com/questions/2003506/how-to-build-a-boost-dependent-project-using-regular-makefiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!