问题描述
这是我的项目结构:
.
├── 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
定义了依赖于abc
和foo
的静态库 -
src/ghi/meson.build
定义了依赖于bar
的静态库 -
vendor/bar/meson.build
定义一个静态库bar
-
vendor/foo/meson.build
定义一个静态库foo
- 顶级
meson.build
定义依赖于abc
,def
和ghi
的可执行文件
def
ghi
app
src/abc/meson.build
defines a static libraryabc
src/def/meson.build
defines a static librarydef
that depends onabc
andfoo
src/ghi/meson.build
defines a static libraryghi
that depends onbar
vendor/bar/meson.build
defines a static librarybar
vendor/foo/meson.build
defines a static libraryfoo
- The top-level
meson.build
defines an executableapp
that depends onabc
,def
andghi
在文档中,似乎有两种机制:
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兄弟姐妹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!