diff options
| author | Zhe Chen <[email protected]> | 2018-12-19 21:08:08 +0900 |
|---|---|---|
| committer | Zhe Chen <[email protected]> | 2018-12-19 21:08:08 +0900 |
| commit | 3a5cc968f1bc79ad6bb1ea7cc62b3c0a7d361732 (patch) | |
| tree | 8529d6afd859e5365e1b48852588c66b866703a2 /xmake/modules/lib/detect/pkg_config.lua | |
| parent | ef7e5b09d88102ffec235af47380e14418e0acc5 (diff) | |
Add support for Linuxbrew.
Diffstat (limited to 'xmake/modules/lib/detect/pkg_config.lua')
| -rw-r--r-- | xmake/modules/lib/detect/pkg_config.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/modules/lib/detect/pkg_config.lua b/xmake/modules/lib/detect/pkg_config.lua index 4c69ff93f..8c08254dd 100644 --- a/xmake/modules/lib/detect/pkg_config.lua +++ b/xmake/modules/lib/detect/pkg_config.lua @@ -85,7 +85,14 @@ function info(name, opt) -- find the prefix directory of brew directly, because `brew --prefix name` is too slow! if not opt.mode or opt.mode == "release" then - local pcfile = find_file(name .. ".pc", "/usr/local/Cellar/" .. (opt.brewhint or name) .. "/*/lib/pkgconfig") + local brew_pkg_root = try { function () return os.iorunv(brew, {"--prefix"}) end } or "/usr/local" + if opt.plat == "linux" then + brew_pkg_root = brew_pkg_root .. "/Cellar/" + elseif opt.plat == "macosx" then + brew_pkg_root = brew_pkg_root .. "/opt/" + end + + local pcfile = find_file(name .. ".pc", brew_pkg_root .. (opt.brewhint or name) .. "/*/lib/pkgconfig") if pcfile then brewprefix = path.directory(path.directory(path.directory(pcfile))) os.addenv("PKG_CONFIG_PATH", path.directory(pcfile)) |
