2017-07-08 76 views
0

我在Meson中的基本任务遇到问题,在构建期间需要将多个文件连接成一个;基本上是:如何将多个文件连接成Meson中的一个文件?

cat *.txt > compiled.txt 

cat foo.txt bar.txt baz.txt > compiled.txt 

不过,我是否使用custom_target()generator()或其它任何功能,无论是介子找不到compiled.txt或无法处理来自多个输入文件转换到一个单一的输出文件。

有没有简单的方法来实现这一目标?

更新:

使用run_command()我已经成功地建立compiled.txt并让它出现在源目录中。最终我想compiled.txt(我已列在gresource.xml中)由gnome.compile_resources()编译。有没有办法可以运行这个命令并直接将文件传递给该函数来处理?

回答

0
从问题

感动的解决方案来回答:

解决方案:

我结束了不使用gresources,但仍然需要这种解决方案来连接文件

cat = find_program('cat') 

parts_of_the_whole = files(
    'part1.txt', 
    'part2.txt' 
) 

concat_parts = custom_target(
    'concat-parts', 
    command: [ 'cat', '@[email protected]' ], 
    capture: true, 
    input: parts_of_the_whole, 
    output: 'compiled.txt', 
    install_dir: appdatadir, 
    install: true, 
    build_by_default: true 
) 
相关问题