什么是 Boost Jam? Jam 值得迁移到吗?
什么是 Boost Jam? Jam 值得迁移到吗?
我知道 jam 是由 perforce 构建的构建系统,但是我不确定 boost jam 和 是如何构建的。 普通果酱是不同的。
我也希望 SO 社区中有人使用过它,也许可以强调一些差异和/或好处。
What is Boost Jam and is Jam worth migrating to?
I understand that jam is build system built by perforce however I am not sure how the boost jam & regular jam is different.
I'm also hoping there could be someone in the SO community who has worked with it and maybe can highlight some differences and/or benefits.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我使用 Boost Jam 进行跨平台 C++ 开发。 我选择它是因为
您可以使用特定于风味的设置来细化通用规则,而不是为每种风味排列编写单独的规则。 该语法并不完全是我所选择的,但并不难习惯。
本文将 Boost Jam 与 CMake、SCons 和 Eclipse CDT 进行比较:http://syrcose.ispras .ru/2009/files/04_paper.pdf
我的理解是 Boost Jam 是由 Boost 社区维护的 Perforce Jam 的一个分支,并且 Perforce Jam 不再被积极维护(发行说明 的最新更新时间为 2003 年 4 月)。
当然,如果您不关心跨平台开发,还有更简单的方法可以选择,正如其他人在这里提到的那样。 就我个人而言,我一直想重新审视 Eclipse CDT; 5 年前它似乎还不能用,但我听说它已经取得了很大的进步。
I use Boost Jam for my cross-platform C++ development. I chose it because
You can refine generic rules with flavor-specific settings, rather than writing separate rules for each flavor permutation. The syntax isn't exactly what I would have chosen, but it's not too hard to get used to.
This paper compares Boost Jam to CMake, SCons, and Eclipse CDT: http://syrcose.ispras.ru/2009/files/04_paper.pdf
My understanding is that Boost Jam is an offshoot of Perforce Jam maintained by the Boost community, and that Perforce Jam isn't actively maintained anymore (the release notes have the last update in April 2003).
Of course, if you don't care about cross-platform development, there are easier ways to go, as others have mentioned here. Personally, I keep meaning to revisit Eclipse CDT; it didn't seem usable 5 years ago, but I hear it has come a long way.
正如您所说,Boost Jam 是一个构建系统,可以独立于任何其他 boost 库使用。 我对 Perforce Jam 一无所知,但据我了解,Boost jam 非常相似,而且大多兼容。
主要区别在于 Boost Jam 通常附带 Boost Build,这是一个集合为常见任务设计的 jam 规则,例如编译库、运行单元测试、创建 doxygen 文档等。
与其他构建系统相比,Boost Jam/Boost Build 旨在轻松编译不同的变体。 因此,如果您想要将编译设置从调试更改为发布,或者从单线程更改为多线程,它会自动确定许多更改。
缺点是语法非常挑剔,并且在 boost 网站之外没有好的文档。 但我认为 Perforce Jam 在这方面也同样糟糕。
As you state, Boost Jam is a build system, and can be used independently of any other boost libraries. I don't know anything about Perforce Jam, but to my understanding, Boost jam is very similar, and mostly compatible.
The main difference is that Boost Jam often comes with Boost Build, a collection of jam rules designed for common tasks, e.g. compiling libraries, running unit tests, creating doxygen documentation, etc.
Compared to other build systems, Boost Jam/Boost Build is designed for easily compilation of different variants. So if you want to change compilation settings from debug to release, or single- to multi-threaded, it determines a lot of the changes automatically.
The drawback is that the syntax is very finicky, and outside the boost website, there's no good documentation. But I imagine Perforce Jam is just as bad in that regard.
考虑到构建工具的选择,我不会迁移到 jam。 有更好的构建系统 - 用于 C/C++ 的 CMake / SCons、用于 Qt 的 qmake、用于 Java 的 Ant、用于 .NET 的 NAnt 和 MSBuild 等等。 它们在技术上可能并不优越,但使用起来不会那么痛苦,因为更多的人熟悉它们(另一方面,当然,它们可能在技术上更优越:D)。
Given the choice of build tools I would not migrate to jam. There are better build systems out there - CMake / SCons for C/C++, qmake for Qt, Ant for Java, NAnt and MSBuild for .NET, and so on. They might not be technically superior but they will be less painful to use simply because far more people are familiar with them (on the other hand, they might be technically superior, of course :D).
就我的目的而言,它只是为您构建 boost 库的东西,我不知道您可以用它做任何其他事情,所以我不明白您迁移到它意味着什么。 抱歉,我不知道普通果酱是什么。 由于没有人提供答案,我只提供我的理解。
Boost 是 C++ 的类和函数的集合,可用于执行各种任务。 boost 的类和函数被分组到库中。 某些库的所有代码都位于头文件中,您只需使用 #include 预处理器语句即可使用这些代码,而其他库(例如文件系统或正则表达式库)的部分实现位于 .cpp 文件中。
编译这些 .cpp 文件可能需要很长时间(大约需要 30 分钟,具体取决于您正在编译的内容),如果您每次想要重新编译程序都需要半个小时,那将是一个真正的痛苦。 所以他们所做的只是对于那些部分存储在.cpp文件中的库,你可以将它们预编译成.lib文件,这就是boost jam的目的。 这意味着您只需花费半小时编译一次,从此以后您再也不用等待半小时了。
然而,正如你可以想象的那样,每个 boost 库都由许多 cpp 文件和许多头文件组成,并且每个库都有许多不同的风格(调试版本、发布版本、多线程等),因此这不是一个简单的过程自己编译boost库就可以了。 这就是 boost jam 的用武之地。您给它命令来编译库,然后它向编译器发出所有命令,最后,您将拥有一组预编译的 .lib 文件,其中一个用于每个图书馆都有不同的风格。 头文件以某种方式告诉链接器要包含哪些 lib 文件,因此如果您设置了正确的路径,正确的预编译 .lib 文件将自动链接到您的程序,从而节省 30 分钟的编译时间。
您可以通过查看此页面来了解哪些库需要由 boost jam 编译,哪些库不需要编译: http://www.boost.org/doc/libs/1_37_0 - 如果一个库不需要 lib 文件(因此不需要你先搞乱 boost jam),它会说“构建和链接:仅标头”,而如果库确实要求您预编译 lib 文件,则会显示“构建和链接:自动链接”。
另外,如果您使用的是 Windows,则可以下载预编译的 .lib 文件,这样您就不必使用 boost jam。 为此,您应该访问 www.boost.org 页面,进入“入门”部分并完全按照它进行操作,以确保所有设置均正确。 该页面的 Windows 版本上的链接之一告诉您在哪里可以找到预编译的 .lib 文件。
For my purposes, it's just the thing that builds the boost library for you, I wasn't aware you could do anything else with it so I don't understand what you could mean by migrating to it. And I'm sorry but I'm unaware what regular jam is. Since no one else has provided an answer I'll just provide my understanding of it.
Boost is a collection of classes and functions for C++ are useful for various tasks. The classes and functions of boost are grouped into libraries. Some of the libraries have all their code in header files which you can use simply by using an #include preprocessor statement, while others (such as the filesystem or regular expressions library) have part of their implementation in .cpp files.
Compiling these .cpp files can take ages (it's like 30 minutes depending on what you're compiling) and it would be a real pain if it took half an hour every time you wanted to recompile your program. So what they have done is only for those libraries that are partly stored in .cpp files, you can precompile them into a .lib file, and that's the purpose of boost jam. That means you only have to spend half an hour compiling them once, and from then on you never have to wait half an hour again.
However, as you can imagine, each boost library consists of many cpp files and many header files, and there are many different flavours of each (debug versions, release versions, multi-threaded, etc) and so it is not a simple process to just compile the boost library yourself. That's where boost jam comes in. You give it the command to compile the libraries and then it issues all the commands for you to the compiler, and by the end of it, you'll have a collection of precompiled .lib files, one for each different flavour of each library. The header files somehow tell the linker which lib files to include, so if you have the correct paths setup, the correct flavour of precompiled .lib file will automatically be linked to your program, thus saving you a 30 minute compilation.
You can see what libraries need to be compiled by boost jam and what libraries don't by looking at this page: http://www.boost.org/doc/libs/1_37_0 - if a library does not need a lib file (and therefore does not require you to mess with boost jam first), it will say "Build & Link: Header only" whereas if a library does require you to precompile a lib file, it will say "Build & Link: Automatic linking".
Also, if you are on Windows, you can download the precompiled .lib files so you never have to use boost jam. To get that, what you should do is go to the www.boost.org page, go to the Getting Started section and follow it all the way through just to make sure you have everything setup correctly. One of the links on the windows version of that page tells you where to find the precompiled .lib files.