大型跨平台软件项目的技巧/资源

发布于 2024-10-01 23:10:48 字数 757 浏览 1 评论 0原文

我将开始一个大型软件项目,涉及跨平台 GUI 和大量的数字运算。我计划用 C++ 和 CUDA 编写大部分应用程序后端,并用 Qt4 编写 GUI。我计划使用 Make 作为我的构建系统。这将是一个只有两名开发人员的项目,一旦我相对深入地了解它,它可能最终会成为一个开源项目。

我的主要问题是,是否有人有任何关于开发软件背后的架构的技巧/资源。

  • 构建文件的好方法是什么? (数字处理代码位于与 gui 代码不同的文件夹中,与编译的可执行文件分开,或者其他什么?)
  • 构建系统如何为跨平台软件工作?我是否需要为每个平台设置不同的构建系统,或者我可以创建一个通用的“makefile”,根据调用它的平台进行不同的构建吗?
  • 我需要对我的代码进行哪些类型的修改才能确保它能够在所有平台上正确构建(预处理器指令等)?
  • 如何处理大型项目的修订控制并将其集成到构建系统中,以便我获得每次构建项目时都会更新的 Version.Revision.Build 编号?

令我感到沮丧的是,我即将毕业的大学几乎没有涵盖这些内容。此时,我已经进行了大量的谷歌搜索,但没有找到我需要的东西。我并不要求用勺子喂所有的东西,我会非常满意与此相关的书籍或网站的链接。

我已经分别完成了大部分工作,但我从未尝试过将所有内容合并到一个大包中。

有人会推荐发布它!:设计和部署生产就绪软件吗?我在询问什么?

I'm going to be starting a large scale software project involving a cross-platform GUI and heavy number crunching. I plan on writing most of the application back-end in C++ and CUDA, and the GUI in Qt4. I plan on using Make as my build system. This will be a project that will only have two developers, and will probably end up being an open source project once I get relatively far with it.

My main question is, does anyone have any tips/resources for developing the architecture behind the software.

  • What would be a good way to structure your files? (number crunching code in a separate folder than the gui code, which is separate from the compiled executables, or something else?)
  • How would the build system work for cross-platform software? Would I need to set-up a different build system for each platform, or could I create a common "makefile" that would build differently depending on which platform invoked it?
  • What kinds of modifications would I need to do to my code to ensure it will build properly on all platforms (pre-processor directives, etc...)?
  • How does someone handle revision control for large projects and integrate it into the build system so I get Version.Revision.Build numbers that update with each time I build my project?

I've been disheartened by the fact that my college that I'm about to graduate from covers almost none of this. At this point, I've done a lot of Google searches with little luck on what I need. I'm not asking to be spoon fed everything, I'd be perfectly content with links to books or websites relating to this.

I've done most of this stuff separately, but I've never tried to combine everything into one big package.

Would anyone recommend Release It!: Design and Deploy Production-Ready Software for what I'm inquiring about?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慢慢从新开始 2024-10-08 23:10:48

1) 结构可以相同,但如果您在子目录中包含文件,请确保使用 '/ 而不是 \。前者也适用于 Windows。

2)我会检查cmake( http://www.cmake.org/ )来管理跨平台的构建多个平台。这将为您减轻整个过程中的很多痛苦。

3)尽可能多地使用STL和Boost。这些库在设计时就考虑到了这个问题。这将涵盖您可能需要做的大部分事情。您已经选择了优秀的 Qt 库,因此您的 GUI 也不是问题。将这三者结合起来,您已经完成了大部分工作。也就是说,您可能必须做一些独立于平台且不属于任何这些内容的事情。为此,我建议您编写一个在所有平台上公开一致接口的类,并在源文件中隐藏带有预处理器指令的细节。必须公开一致的接口。

4)使用SVN。我不知道如何在其他编译器上执行此操作,但在 Visual Studio 中获取最新版本并将其插入到某个文件中,然后将其包含在您的项目中是微不足道的。您可以使用构建事件来执行此操作。抱歉,我无法详细说明其他平台。

此外,如果您必须使用 STL、Boost、Qt 等之外的语言,请注意所有平台上 API 调用的文档。过去,我曾被 fseek() API 调用的行为所困扰,该调用在一个实现上写入字节以填充到目标,但在另一个实现上则不然。这些可能是令人头痛的主要原因,也是尝试并坚持使用上面提到的经过尝试和测试的库的另一个原因。

1) The structure can be the same, but if you're including files in subdirectories, make sure you use '/ and not \. The former will also work on windows.

2) I'd check out cmake ( http://www.cmake.org/ ) for managing building across multiple platforms. This will take a lot of pain out of the process for you.

3) Use STL and Boost as much as you can. These libraries have been designed with this very problem in mind. This will cover a huge portion of what you might need to do. You've already chosen the excellent Qt library, so your GUI is not an issue either. With these 3 combined, you're already most of the way there. That said, you might have to do something that is platform independent and not covered by any of these. For this I suggest you write a class that exposes a consistent interface across all platforms, and hide the nitty-gritty with preprocessor directives in the source file. It is imperative to expose a consistent interface.

4) Use SVN. I don't know how to do it on other compilers, but it is trivial in Visual Studio to get the latest revision and insert it in to some file that then gets included in your project. You can use build events to do this. Sorry I can't elaborate on other platforms.

In addition, if you have to head outside of STL, Boost, Qt etceteras, be mindful of the documentation of the API calls on all platforms. I have been bitten in the past by the behavior of a fseek() API call that wrote bytes to pad out to the destination on one implementation, but not the other. These can be a major cause of headache and another reason to try and stick to tried-and-tested libraries as mentioned above.

白云悠悠 2024-10-08 23:10:48

Qt 将符合您的要求,IMO..我将回复信函Qt

关于文件的结构,您可以将源文件 *.cpp*.h 放在一个文件夹中,将剩余的库和依赖项放在其他文件夹中。您可以使用 Qt 设计器创建 *.ui 文件,也可以直接对其进行编码。 (其中后者会大大增加编译时间)生成的文件(如*.exe*.obj等)可以将其放在单独的文件夹中,以便您的文件系统看起来一致。在 Qt 中,有一些简单的方法可以完成上述所有操作。在这里查看QMake

关于可移植性,您可以移植< code>Qt 轻松跨各种平台应用程序。查看此处..

关于源代码控制,我习惯SVN 我们对此很满意。只需选择一款满足您需求的产品即可。

由于您即将毕业,Qt 与其他产品相比显然具有一些优势。

  1. 从我提供给您的链接来看,
    你本可以理解的
    Qt 的文档非常丰富
    你不需要太多就能完成它
    专业支持。
  2. 而且最重要的是,Qt 采用 LGPL 格式,您可以免费玩...:)

HTH..

Qt will match your reqs, IMO.. I will answer with correspondence to Qt.

Regarding the structure of the files, you can have source files *.cpp and *.h in a folder, the remaining libraries and dependencies in some other folder. You can create *.ui files using Qt designer or you can code them directly as well. (In which the later will increase the compile time considerably) The generated files (like *.exe,*.obj, etc.,) can be put it in a separate folder so that your file system will look consistent. There are simple ways of doing all those said above in Qt. Check out QMake here..

Regarding portability, you can port Qt applications across various platforms easily. Check out here..

Regarding source control, I am used to SVN and we are fine with it. Just choose a one that satisfies your need.

Since you are about to graduate, Qt has clearly some advantages when compared to others.

  1. From the links I provided to you,
    you could have understood that the
    documentation for Qt is extensive
    and you can work on it without much
    professional support.
  2. And also most importantly Qt is in LGPL and you can play for free... :)

HTH..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文