Code::Blocks build from bash

大城市里の小女人 提交于 2019-12-13 08:52:18

问题


I'm developing a C++ application in Code::Blocks. My program has a few dependencies and has to run under Linux and Windows, this is why I use Code::Blocks.

Now I'd like to include Travis CI for testing the builds. On the Travis server, where I have no X11, I won't be able to run Code::Blocks. How can I build my project without Code::Blocks. (Is there a possibility to create "a Makefile" out of the .cbp-file?

This page (Code::Blocks Wiki) mentions there is a --build flag, but you need Code::Blocks & X11. Is there a server way without X11?


回答1:


You can not run anything which require X11 on Travis, and as far as I know, there is no way to launch a build using Code::Blocks without requiring X11.

The best choice would be to set up your project differently, for example using a Makefile. You will be able to configure Code::Blocks to use your Makefile and also to build on Travis using the make command.

You can also consider using CMake (especially if you are not familiar with Makefile syntax, but not only). This will let you configure your project in a more high level way (compared to a Makefile), and then you will be able to generate a Makefile or a project for the IDE of your choice.




回答2:


I used cbp2make (C::B Forum entry). It is quite simple

cbp2make -in project.cbp -out Makefile

and it worked immediatly, even with a more complex configuration than a simple command line project in Code::Blocks.

It also generates the same build targets as in Code::Blocks. For example make Release would work.

The debian package list shows only a few dependencies, so X11 is not required.



来源:https://stackoverflow.com/questions/26386335/codeblocks-build-from-bash

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