2017-07-08 153 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 
) 
相關問題