Meson custom_target 尽管源和依赖项已过时,但从不执行
Meson custom_target never executes despite sources and dependencies out of date
我在项目的根目录中有这个部分 meson.build
:
if get_option('gen_py_bindings')
message('told to build py bindings')
custom_target('py_bindings',
command: ['env', '_MESON_MODULE_NAME=' + meson.project_name(), ',_MESON_MODULE_VERSION=' + meson.project_version(), './py3_bindings/setup.py', 'build'],
depends: [mainlib],
depend_files: files(['py3_bindings/module.c', 'py3_bindings/setup.py']),
input: ['py3_bindings/setup.py'],
install: false, output: 'sharedextension.so')
endif
这是一个自定义目标,它运行 setup.py
脚本来为我的项目库构建 python 绑定。
问题是它似乎总是最新的。我使用 depends
关键字参数指定它依赖于项目中的另一个构建目标,并使用 depend_files
关键字参数指定它依赖于脚本用于构建的 C 源文件扩展名,以及 运行 作为 command
的实际脚本。我也使用了 input
关键字参数,尽管我不明白它和 depend_files
.
之间的区别
如果我对 meson.build
进行更改(message()
调用显示成功),我只能让自定义目标重新生成。
没有其他更改。我已尝试更新自定义目标中列出的所有文件,但结果总是:ninja: no work to do.
。即使其他过时的目标得到 rebuilt/relinked/etc...
我在 linux 上使用 ninja 1.9.0
和 meson 0.52.1
。
我也很清楚 build_always_stale
关键字参数,但除非必要,否则我不想使用它。 (更新:将其设置为 true
仍然不会导致目标重建,看起来这里还有更多的东西在起作用,但我无法弄清楚)。
默认情况下,自定义目标不会在 运行 纯 ninja
时构建,因此需要传递 build_by_default
关键字参数并将其设置为 true
,例如
custom_target('target', build_by_default: true)
我在项目的根目录中有这个部分 meson.build
:
if get_option('gen_py_bindings')
message('told to build py bindings')
custom_target('py_bindings',
command: ['env', '_MESON_MODULE_NAME=' + meson.project_name(), ',_MESON_MODULE_VERSION=' + meson.project_version(), './py3_bindings/setup.py', 'build'],
depends: [mainlib],
depend_files: files(['py3_bindings/module.c', 'py3_bindings/setup.py']),
input: ['py3_bindings/setup.py'],
install: false, output: 'sharedextension.so')
endif
这是一个自定义目标,它运行 setup.py
脚本来为我的项目库构建 python 绑定。
问题是它似乎总是最新的。我使用 depends
关键字参数指定它依赖于项目中的另一个构建目标,并使用 depend_files
关键字参数指定它依赖于脚本用于构建的 C 源文件扩展名,以及 运行 作为 command
的实际脚本。我也使用了 input
关键字参数,尽管我不明白它和 depend_files
.
如果我对 meson.build
进行更改(message()
调用显示成功),我只能让自定义目标重新生成。
没有其他更改。我已尝试更新自定义目标中列出的所有文件,但结果总是:ninja: no work to do.
。即使其他过时的目标得到 rebuilt/relinked/etc...
我在 linux 上使用 ninja 1.9.0
和 meson 0.52.1
。
我也很清楚 build_always_stale
关键字参数,但除非必要,否则我不想使用它。 (更新:将其设置为 true
仍然不会导致目标重建,看起来这里还有更多的东西在起作用,但我无法弄清楚)。
默认情况下,自定义目标不会在 运行 纯 ninja
时构建,因此需要传递 build_by_default
关键字参数并将其设置为 true
,例如
custom_target('target', build_by_default: true)