为 C++ 构建服务器/持续集成建议/ 基于 Qt 的项目
我正在寻找为基于 Qt 的 C++ 项目实现构建服务器。服务器需要从 Subversion 检查必要的代码/资产,构建可执行文件,组装安装项目的工件,并构建安装媒体文件。目标平台和(粗略)工具链是:
- Windows(32 位和 64 位)qmake、nmake、msbuild、wix 工具链。最终结果是安装程序 EXE 和 DVD 映像。
- Mac OS X: qmake、make、自定义 bash 脚本来组装包。最终结果是磁盘映像和 DVD 映像中的应用程序包。
- Ubuntu(32 位和 64 位): qmake、make、基于 debuild 的脚本。最终结果是 DEB 文件和 DVD 映像的集合。
- Fedora(32 位和 64 位):基于 qmake、make、rpmbuild 的脚本。最终结果是 RPM 文件和 DVD 映像的集合。
因此,至少需要 4 个构建代理(如果无法在同一个机器上完成 32 位和 64 位,则可能需要更多)和 7 个配置。开源项目是首选,但这不是绝对要求。
我看到的大多数工具似乎都适合 Java(Jenkins、CruiseControl 等)或 .Net(CruiseControl.net 等)。这些工具可以与 C++ 工具链一起使用吗?或者我会不断地与系统作斗争吗? ?您过去使用过并发现可以与 Qt / C++ 配合使用的任何东西吗?
I'm looking to implement a build server for Qt-based C++ projects. 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. The target platforms and (rough) toolchains are:
- Windows (32- and 64-bit): qmake, nmake, msbuild, wix toolchain. The end result is an installer EXE and DVD image.
- Mac OS X: qmake, make, custom bash scripts to assemble package. The end result is an application bundle within a disk image and a DVD image.
- Ubuntu (32- and 64-bit): qmake, make, debuild-based scripts. The end result is a collection of DEB files and a DVD image.
- Fedora (32- and 64-bit): qmake, make, rpmbuild-based scripts. The end result is a collection of RPM files and a DVD image.
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. 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? Anything that you have used in the past and found works well with Qt / C++?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我使用 Jenkins 来构建和打包许多基于 qmake、cmake 和 makefile 的 C++ 项目。
有用于 cmake、qmake 和 msbuild 的插件,但也可以运行任何命令行脚本。
我已经使用 Jenkins 完成了打包,没有任何问题,因为这只是项目中的另一个命令行步骤。
有一些很好的插件可以监控编译器产生的 警告/错误 的数量(我通常使用海湾合作委员会)。
它还具有矩阵构建功能,允许您使用编译器标志、预处理器变量、平台等的不同组合多次构建项目。我设置的一个项目是在两个平台上使用 5 个布尔预处理器标志的矩阵构建,然后进行 2^6=64 次构建。这些可能需要一些设置才能正确。
I use Jenkins for building and packaging many C++ projects, based on qmake, cmake, and makefiles.
There are plugins for cmake, qmake, and msbuild, but any command line scripts can be run as well.
I have done packaging using Jenkins with no problems, as it is just another command line step in a project.
There are good plugins for monitoring the number of warnings/errors produced by the compiler (I normally use 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. These can take a bit of setting up to get correct.
您可以在这里阅读一个简单的示例:
持续集成服务器 - Hudson
我认为 Hudson、jenkins 和 builbot 值得一试。花一两天的时间来评估并尝试一个简单的例子将帮助您自信地做出选择。
Here you can read a quick example:
Continuous Integration Server - Hudson
I think that Hudson, jenkins and builbot are worth a try. Wasting a day or two evaluating and trying them with a quick example will help you to choose confidently.
任何功能合理的 CI 系统都会有一个部件,允许您执行构建命令所需的任何程序。
我会考虑以下内容:
我使用 CruiseControl 完成了上述操作,大多数事情都非常简单。我在 make 或 qmake 中编写了所有内容,然后简单地调用了我需要执行的命令。对于单元测试和代码覆盖率集成,我将内容输出到 XML 并将其转换为 CruiseControl 支持的内容。
我的建议是,查看推荐的 CI 系统并根据上述标准检查它们。
Any reasonably capable CI system will have a piece that will allow you to execute any program you want for your build command.
Here's what I would consider:
I did the above using CruiseControl and most things were pretty easy. I wrote everything in make or qmake and simply called out to the command that I needed executed. For unit test and code coverage integration I output stuff to XML and transformed it to something supported by CruiseControl.
My recommendation, take a look at the recommended CI systems and examine them based on the criteria above.
我为此使用 buildbot 。我已经使用它4年了,我对它感到非常满意。
它是一个用 python 编写的应用程序,运行在服务器上,可以管理各种操作系统上的多个客户端。我目前正在使用 Windows XP、Windows 7、Debian、Ubuntu 和 CentOS 构建从属系统。我的项目是 C++,其中之一(最终用户 GUI)是用 Python 制作的。但我们还与其他框架集成,以实现 GUI 之外的其他功能。
buildbot 的真正优点在于它通过在从属设备上运行命令行来工作。有了这个,你就可以做任何你想做的事。即使在Windows系统上也可以使用Visual Studio进行编译!通过这些命令行,您可以获取集中在服务器上且可访问的所有输出。
您还可以在此网站上找到引用其中许多内容的替代方案。
免责声明:我三年前看过它,我不知道它是否仍然准确。
I'm using buildbot for this. I've been using it for 4 years, and I feel very happy with it.
It is an application written in python, that runs on a server and can manage multiple clients on various OSes. I'm currently using Windows XP, Windows 7, Debian, Ubuntu and CentOS build slaves. My projects are C++, and one of them (the end user GUI) is made in Python. But we've also integrated with other frameworks, for other features than GUI.
What is really good about buildbot is that it works by running command lines on slaves. With this, you can do whatever you want. Even on Windows systems to compile using 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.
哈德森或詹金斯都不错。
Hudson or Jenkins is pretty good.
考虑到这个问题已经有 7 年的历史了,即使过了这么多年,Jenkins 确实很喜欢开发这样的定制服务。
Felgo 还为 Qt 提供持续集成和交付 (CI/CD) 服务。它支持桌面平台以及 iOS、Android 和嵌入式目标。 博客文章。
免责声明:我是 Felgo 的软件开发人员
Jenkins is indeed pretty popular for developing such a custom service, even after all these years, considering the question is already 7 years old.
Felgo also offers a Continuous Integration and Delivery (CI/CD) service for Qt. It supports desktop platforms as well as iOS, Android and embedded targets. The full feature set is described in the blog post.
Disclaimer: I am a software developer at Felgo