“静态插件” C++ 中的系统(通过构建系统)

发布于 2024-10-04 18:21:12 字数 552 浏览 0 评论 0原文

我目前正在开发 C++ 产品。它被设计为具有相当大的灵活性,并且已经变得越来越大。现在我们计划合作一个项目,我们愿意贡献部分产品:一些部分作为源代码,一些部分作为静态链接库,一些部分根本不贡献。

我想保留两个项目中使用的每个源文件的一个版本,并避免分支整个事情等。所以我想知道我需要什么才能在内部拥有所有文件的“完整产品”,并且还能够提取这些文件的一部分(时不时地)并将这个子集作为工作单元传递给其他人。 (我假设我们可以确保这些文件在合作项目中不会被更改,我们只会在那里添加东西。)

我想我需要

  • 一个松散耦合的软件架构,以便可以在不破坏系统的情况下删除部件。我认为术语“静态”插件在这里是合适的,因为我认为我可以从插件系统中学习,但我不需要动态加载它们的能力,它们可以以静态方式链接/构建。我希望这可以迫使我和我的同事通过添加某种插件来扩展系统,而不是到处插入类,从而引入事物之间的耦合。
  • 一个构建系统,支持我选择要构建的插件,并通过仅提取我需要的内容来“发布”新的子集。

是否有任何可能有帮助的互联网资源。搜索的关键词是什么?

您对如何处理这个问题有什么建议吗?

I am working on a C++ product currently. It was designed to have a fair amount of flexibility and has grown bigger and bigger. Now we are planning to cooperate in a project where we would like to contribute parts of the product: some parts as source code, some parts as static link libraries, some parts not at all.

I would like to keep one version of every source file which is used in both projects and avoid branching the whole thing etc. So I was wondering what I need to be able to have the "full product" internally with all files and also be able to extract a part of these files (every now and then) and pass this subset as a working unit to others. (I assume we can ensure that these files are not changed in the cooperation project, we will only add stuff there.)

I guess I need

  • a software architecture that is loosely coupled so that parts can be removed without breaking the system. I think the term "static" plugin is appropriate here because I think I can learn from plugin systems, but I do not need to have the ability to load them dynamically, they can be linked/built in a static way. I hope this could force me and my co-workers to extend the system by adding some kind of a plugin instead of inserting classes here and there, introducing coupling between things.
  • a build system that supports me with selecting which plugins to build and "releasing" new subsets by extracting only what I need.

Are there any internet resources that might help. What are the keywords to search for?

Do you have any suggestions on how to handle this?

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

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

发布评论

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

评论(2

醉酒的小男人 2024-10-11 18:21:12

多布斯博士有一篇有趣的文章系列,您可能想看看。我似乎记得除了通常的动态链接之外,它还支持插件的静态链接。查看构建您自己的插件框架

祝你好运!

There's an interesting article series from Dr Dobbs that you might want to check out. I seem to remember that it supports static linking of plugins in addition to the usual dynamic linking. Check out Building Your Own Plugin Framework.

Good luck!

好听的两个字的网名 2024-10-11 18:21:12

首先,您需要 git:

https://git-scm.com/

之类的东西来管理源代码。要管理“插件”,无论静态与否,可能需要查看已经执行此操作的现有系统:我可以建议检查 Python 是如何执行此操作的(因为有一个明确指定的 C API 来管理它)。

我所知道的最好的构建系统是.. Python。忘记了:) 预构建的是 Erick Tryzelaars fbuild(可从 github 获取)。[我认为这是最好的,因为我正在使用它:]

Primarily, you need something like git:

https://git-scm.com/

to manage the source. To manage "plugins", static or not, it may pay to look at existing systems that already do this: I can recommend examining how Python does it (since there is a well specified C API for managing it).

The best build system I know of is .. Python. Forget makes :) A prebuilt one is Erick Tryzelaars fbuild (available from github).[Well I think it is the best because I'm using it :]

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