介子目标取决于subdir兄弟姐妹

介子目标取决于subdir兄弟姐妹

本文介绍了介子目标取决于subdir兄弟姐妹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的项目结构:

.
├── include
├── src
│   ├── abc
│   │   ├── include
│   │   └── src
│   ├── def
│   │   ├── include
│   │   └── src
│   └── ghi
│       ├── include
│       └── src
└── vendor
    ├── bar
    │   ├── include
    │   └── src
    └── foo

16 directories

我想将我的构建移植到Meson.但是,我不确定如何链接在同级文件夹中定义的目标.

I would like to port my build to Meson. However, I'm not sure how to link targets defined in sibling folders.

我的依赖图如下:

  • src/abc/meson.build定义一个静态库abc
  • src/def/meson.build定义了依赖于abcfoo
  • 的静态库def
  • src/ghi/meson.build定义了依赖于bar
  • 的静态库ghi
  • vendor/bar/meson.build定义一个静态库bar
  • vendor/foo/meson.build定义一个静态库foo
  • 顶级meson.build定义依赖于abcdefghi
  • 的可执行文件app
  • src/abc/meson.build defines a static library abc
  • src/def/meson.build defines a static library def that depends on abc and foo
  • src/ghi/meson.build defines a static library ghi that depends on bar
  • vendor/bar/meson.build defines a static library bar
  • vendor/foo/meson.build defines a static library foo
  • The top-level meson.build defines an executable app that depends on abc, def and ghi

在文档中,似乎有两种机制:

In the documentation, there seem to be two mechanisms:

  • subdir
  • subproject
  • subdir
  • subproject

我不清楚哪一个最好.我的源代码之外没有任何依赖项.

It is not clear to me which is best here. I do not have any dependencies outside of my source-code.

我应该在我的meson.build文件中写些什么来将这些目标链接在一起?

What should I write in my meson.build files to link these targets together?

推荐答案

您可以从顶级meson.build文件开始使用subdir.您在子目录meson.build文件中声明的所有变量都可用于以后的meson.build文件.只要您正确调用subdir的顺序,它就会起作用.

You can use subdir from the top-level meson.build file down. All variables you declare in the subdir meson.build files are available to later meson.build files. As long as you get the order of subdir calls correct, it will work.

这篇关于介子目标取决于subdir兄弟姐妹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 18:43