有没有什么好的构建工具不妨碍我?
正如标题所说,我想要一个不妨碍我的构建工具。
我宁愿指定规则,而不是构建过程中的步骤。我想说的是,我想要一个名称放在项目根目录中的二进制文件,.o 文件应该放在 obj/tmp 目录中,源代码位于 Source
目录中。
我不想告诉它这是这个'那个文件,因为我不断快速地添加新文件,它应该只扫描源目录(及其子目录)寻找 Ragel (.rl) 和 C++ 代码 (.cxx) )并做必要的事情将所有内容变成可执行文件。
我研究了很多工具,比如 auto{make,conf,header} (不太喜欢我把它想要的文件放在项目根目录的子目录中,eclipse也不喜欢那样),CMake(似乎我必须我自己添加所有源文件,在我看来这是自动工具的一个变体)。我还在 WikiPedia 上读到过有关 ant、maven(我也对 XML 过敏,它是一种为应用程序序列化数据的良好格式,但对人类来说不太好。我更喜欢 YAML)以及 WikiPedia 上的其他内容。我见过一些看起来不错但需要设置为网络服务器的工具,这有点矫枉过正。
另外,我真的需要能够在没有互联网连接的情况下离线工作!
现在看来最好的选择是制作一个小脚本来查找所有 .cxx 文件并编写一个 Unity.cxx 并使用 G++ 构建该脚本,这可能相当快,但很难看黑客,我猜。
奖励点:
- 快速构建
- 能够输入
build test-1
或其他内容,它将构建并直接运行test-1
- 多核构建(即更快的构建)
- 确实没有打断我的思路
As the title says, I want to have a build tool that quite much stays out of my way.
I would rather want to specify rules, rather than steps in the build process. I wan to say that I want a binary file with a name placed in the root directory of my project, .o files should go in an obj/tmp dir and the source is in the Source
-directory.
I do NOT want to tell it that it is this'n'that file as I keep adding new files rather quickly, it should just scan the source directory (and its subdirectories) looking for Ragel (.rl) and C++ code (.cxx) and doing what's necessary to make all into an executable.
I have looked into many tools, like auto{make,conf,header} (Did not really like that I placed the files it wanted in a subdir of project root, eclipse did not like that either), CMake (Seems like I have to add all source-files myself, and is quite much a variation of autotools in my eyes). I have also read about ant, maven (I am also allergic against XML, it's a good format to serialize data for applications, not so much for humans. I would prefer YAML) and others on WikiPedia. And I have seen tools which seems good but which require to be set up as a webserver which is kinda overkill.
Also, I really need the ability to be able to work offline without internet connection!.
Right now it seems like the best option is to make a little script that finds all .cxx files and write an Unity.cxx
and builds that one with G++, which probably is quite fast but to much an ugly hack, I guess.
Bonus Points:
- Fast builds
- Ability to type
build test-1
or something and it will build and directly runtest-1
- Multi-core builds (i.e. faster builds)
- Does really not interrupt my train of thought
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CMake 很棒。它是免费的、跨平台的,并且有相当完善的文档。它支持“源外构建”,这意味着没有任何构建文件放置在源目录中。这使得源代码控制变得更容易一些。可以将其设置为查找新文件(通配)。快吗?...它会生成 make 文件...之后就取决于您的编译器了。多核......同样,更多的是编译器的功能。我在 Windows、Linux 和 Mac 上使用过 CMake...它确实有效。
另一个我没有尝试过但已阅读并计划测试的方法是 premake... http://industriousone.com /示例脚本
CMake is great. It's free, cross-platform, and reasonably well documented. It supports "out of source builds", meaning none of the build files are placed in the source directory. That makes source control a bit easier. It can be set up to find new files (globbing). Fast?...It generates make files...after that it's up to your compiler. Multicore...again, more a function of the compiler. I've used CMake on Windows, Linux, and Mac...it just works.
Another that I haven't tried but have read about and plan to test is premake... http://industriousone.com/sample-script
蛋糕 来自CoffeeScript 非常好,我自己正在使用 Lua 编写一个类似的工具。
CMake 和 premake 不是 build/maketools,它们是 build/make 描述符生成器;这可能适合大量不会发生太大变化的项目。但对于快速原型制作是关键的项目来说则不然。
现在,我正在做一个项目,当您点击文本编辑器中的保存按钮时,浏览器就会更新;您不需要转到浏览器并按 F5(这会导致浏览器再次加载所有内容时出现轻微延迟,并且您很可能会失去页面,例如您打开了一个菜单,并且希望调整菜单的外观,您将被迫在 RIA 中再次导航到那里)。
cake from CoffeeScript is quite good, and I'm writing a similar tool using Lua myself.
CMake and premake Ain't build/maketools, they are build/make-descriptor generators; which may fit a large number of projects that ain't changing too much. But not for project where rapid prototyping is a key.
Right now, I'm doing a project where the browser updates when you hit the save-button in your text editor; You do not need to go to the browser and hit F5 (Which would cause a small delay while the browser load in everything again, and you would most likely loose the state of the page, like say that you have an menu open, and wish to tweak the look of the menu. You would be forced to navigate there again in your RIA).