Pkg 設定檔

Pkg-config 是一種讓共享函式庫宣告使用它們所需的編譯器標誌的方法。在 Meson 中有兩種產生 Pkg-config 檔案的方法。第一種方法是使用 configure_file 命令手動建構它們。第二種方法是使用 Meson 內建的 Pkg-config 檔案產生器。兩者之間的區別在於後者非常簡單,旨在用於基本的使用案例。前者應該在您需要提供更客製化的解決方案時使用。

在本文件中,我們將描述簡單產生器的方法。它以以下方式使用。

pkg = import('pkgconfig')
libs = ...     # the library/libraries users need to link against
h = ['.', ...] # subdirectories of ${prefix}/${includedir} to add to header path
pkg.generate(libraries : libs,
             subdirs : h,
             version : '1.0',
             name : 'libsimple',
             filebase : 'simple',
             description : 'A simple demo library.')

這會在安裝階段建立一個名為 simple.pc 的檔案並將其放置到安裝目錄中。

關於 pkg-config 模組和參數的更多資訊,請參閱pkgconfig-module 頁面。

搜尋結果是