简体   繁体   English

为基于C ++ / Qt的项目构建服务器/持续集成建议

[英]Build server / continuous integration recommendation for C++ / Qt-based projects

I'm looking to implement a build server for Qt-based C++ projects. 我正在寻找为基于Qt的C ++项目实现构建服务器。 The server needs to check out the necessary code / assets from Subversion, build the executable files, assemble the artifacts for installation projects, and build the installation media files. 服务器需要从Subversion检出必要的代码/资产,构建可执行文件,组装安装项目的工件,以及构建安装媒体文件。 The target platforms and (rough) toolchains are: 目标平台和(粗略)工具链是:

  • Windows (32- and 64-bit): qmake, nmake, msbuild, wix toolchain. Windows(32位和64位): qmake,nmake,msbuild,wix工具链。 The end result is an installer EXE and DVD image. 最终结果是安装程序EXE和DVD映像。
  • Mac OS X: qmake, make, custom bash scripts to assemble package. Mac OS X: qmake,make,自定义bash脚本来组装包。 The end result is an application bundle within a disk image and a DVD image. 最终结果是磁盘映像和DVD映像中的应用程序包。
  • Ubuntu (32- and 64-bit): qmake, make, debuild-based scripts. Ubuntu(32位和64位): qmake,make,debuild-based脚本。 The end result is a collection of DEB files and a DVD image. 最终结果是DEB文件和DVD图像的集合。
  • Fedora (32- and 64-bit): qmake, make, rpmbuild-based scripts. Fedora(32位和64位): qmake,make,基于rpmbuild的脚本。 The end result is a collection of RPM files and a DVD image. 最终结果是RPM文件和DVD映像的集合。

So that's at least 4 build agents (maybe more if 32- and 64-bit can't be done on the same box) and 7 configurations. 因此,至少有4个构建代理(如果32位和64位不能在同一个盒子上完成,可能更多)和7个配置。 Open-source projects are preferred, but that is not an absolute requirement. 开源项目是首选,但这不是绝对的要求。

Most of the tools I'm seeing seem to be catered to Java (Jenkins, CruiseControl, etc.) or .Net (CruiseControl.net, etc.) Can those be used with a C++ toolchain, or will I constantly be fighting the system? 我看到的大多数工具似乎都适用于Java(Jenkins,CruiseControl等)或.Net(CruiseControl.net等)。这些工具可以与C ++工具链一起使用,还是我会不断地与系统作斗争? Anything that you have used in the past and found works well with Qt / C++? 你过去使用过的任何东西都可以和Qt / C ++一起使用吗?

I use Jenkins for building and packaging many C++ projects, based on qmake, cmake, and makefiles. 我使用Jenkins构建和打包许多基于qmake,cmake和makefile的C ++项目。

There are plugins for cmake, qmake, and msbuild, but any command line scripts can be run as well. 有cmake,qmake和msbuild的插件 ,但也可以运行任何命令行脚本。

I have done packaging using Jenkins with no problems, as it is just another command line step in a project. 我使用Jenkins进行打包没有问题,因为它只是项目中的另一个命令行步骤。

There are good plugins for monitoring the number of warnings/errors produced by the compiler (I normally use GCC). 有很好的插件可以监视编译器产生的警告/错误的数量(我通常使用GCC)。

It also has matrix builds which allow you to build a project several times with different combinations of compiler flags, pre-processor variables, platform, etc. One project I set up is a matrix build with 5 boolean preprocessor flags on two platforms, which then does 2^6=64 builds. 它还具有矩阵构建,允许您使用编译器标志,预处理器变量,平台等的不同组合多次构建项目。我设置的一个项目是在两个平台上具有5个布尔预处理器标志的矩阵构建,然后2 ^ 6 = 64个构建。 These can take a bit of setting up to get correct. 这些可能需要一些设置才能正确。

Here you can read a quick example: 在这里你可以看到一个简单的例子:

Continuous Integration Server - Hudson 持续集成服务器 - 哈德森

I think that Hudson, jenkins and builbot are worth a try. 我认为Hudson,jenkins和builbot值得一试。 Wasting a day or two evaluating and trying them with a quick example will help you to choose confidently. 浪费一两天评估并尝试快速示例将帮助您自信地选择。

Most of the tools I'm seeing seem to be catered to Java (Jenkins, CruiseControl, etc.) or .Net (CruiseControl.net, etc.) Can those be used with a C++ toolchain, or will I constantly be fighting the system? 我看到的大多数工具似乎都适用于Java(Jenkins,CruiseControl等)或.Net(CruiseControl.net等)。这些工具可以与C ++工具链一起使用,还是我会不断地与系统作斗争? Anything that you have used in the past and found works well with Qt / C++? 你过去使用过的任何东西都可以和Qt / C ++一起使用吗?

Any reasonably capable CI system will have a piece that will allow you to execute any program you want for your build command. 任何具有合理能力的CI系统都将拥有一个允许您执行构建命令所需的任何程序的部分。

Here's what I would consider: 这是我要考虑的:

  • Does the CI system run on your system(s) of choice CI系统是否在您选择的系统上运行
  • Does it allow you an easy way to view your logs 它是否允许您轻松查看日志
  • Does it integrate with your test runner 它是否与您的测试运行器集成
  • Does it integrate with your code coverage reports (eg BullseyeCoverage w/C++ & Qt) 它是否与您的代码覆盖率报告集成(例如BullseyeCoverage w / C ++&Qt)
  • Will it publish your files in a manner sensible for your needs 它会以合理的方式发布您的文件以满足您的需求
  • Will at provide an archive/store of files, if necessary (eg pdbs & lib*.so.debug) 如有必要,将提供文件的存档/存储(例如pdbs&lib * .so.debug)
  • If the CI system doesn't support feature X, will you have to write it for each supported OS/system 如果CI系统不支持功能X,您是否必须为每个支持的OS /系统编写它
  • Is the CI system / UI easy for you to use. 是CI系统/ UI方便使用。

I did the above using CruiseControl and most things were pretty easy. 我使用CruiseControl完成了上述操作,大多数事情都非常简单。 I wrote everything in make or qmake and simply called out to the command that I needed executed. 我在make或qmake中编写了所有内容,并简单地调用了我需要执行的命令。 For unit test and code coverage integration I output stuff to XML and transformed it to something supported by CruiseControl. 对于单元测试和代码覆盖集成,我将内容输出到XML并将其转换为CruiseControl支持的内容。

My recommendation, take a look at the recommended CI systems and examine them based on the criteria above. 我的建议,看看推荐的CI系统,并根据上述标准进行检查。

I'm using buildbot for this. 我正在使用buildbot I've been using it for 4 years, and I feel very happy with it. 我已经使用它4年了,我觉得很开心。

It is an application written in python, that runs on a server and can manage multiple clients on various OSes. 它是一个用python编写的应用程序,它运行在服务器上,可以管理各种操作系统上的多个客户端。 I'm currently using Windows XP, Windows 7, Debian, Ubuntu and CentOS build slaves. 我目前正在使用Windows XP,Windows 7,Debian,Ubuntu和CentOS构建奴隶。 My projects are C++, and one of them (the end user GUI) is made in Python. 我的项目是C ++,其中一个(最终用户GUI)是用Python制作的。 But we've also integrated with other frameworks, for other features than GUI. 但是我们还与其他框架集成,用于GUI之外的其他功能。

What is really good about buildbot is that it works by running command lines on slaves. buildbot的真正好处在于它可以通过在从属服务器上运行命令行来实现。 With this, you can do whatever you want. 有了这个,你可以做任何你想做的事。 Even on Windows systems to compile using Visual Studio! 甚至在Windows系统上使用Visual Studio进行编译! From these command lines, you get all the output centralized on the server, and accessible. 从这些命令行,您可以将所有输出集中在服务器上,并且可以访问。

You may also find alternatives on this site that references many of them. 您也可以在此网站上找到引用其中许多内容的替代方案。 Disclaimer: I looked at it 3 years ago, I don't know if it is still accurate. 免责声明:3年前我看过它,我不知道它是否仍然准确。

Jenkins is indeed pretty popular for developing such a custom service, even after all these years, considering the question is already 7 years old. 詹金斯在开发这样的定制服务方面确实非常受欢迎,即使在这些年之后,考虑到这个问题已经有7年了。

Felgo also offers a Continuous Integration and Delivery (CI/CD) service for Qt. Felgo还为Qt提供持续集成和交付(CI / CD)服务。 It supports desktop platforms as well as iOS, Android and embedded targets. 它支持桌面平台以及iOS,Android和嵌入式目标。 The full feature set is described in the blog post . 博客文章中描述了完整的功能集。

Disclaimer: I am a software developer at Felgo 免责声明:我是Felgo的软件开发人员

哈德森或詹金斯非常好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM